summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 20:31:07 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 20:31:07 +0000
commitafbd35400d2a2ab034acb20584092aa71a808e72 (patch)
treeb29b3ce55a082b0789ec5fb689acda724a83e424 /chrome/browser/autofill
parente6cbd163a5ca21026de45af8b708710a054f5b43 (diff)
downloadchromium_src-afbd35400d2a2ab034acb20584092aa71a808e72.zip
chromium_src-afbd35400d2a2ab034acb20584092aa71a808e72.tar.gz
chromium_src-afbd35400d2a2ab034acb20584092aa71a808e72.tar.bz2
AutoFill: Implement set_whole_number and use it to load whole phone numbers from the WebDB.
BUG=38218 TEST=WebDatabaseTest.AutoFillProfile Review URL: http://codereview.chromium.org/1043003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/autofill_common_unittest.cc4
-rw-r--r--chrome/browser/autofill/phone_number.cc10
-rw-r--r--chrome/browser/autofill/phone_number.h1
3 files changed, 13 insertions, 2 deletions
diff --git a/chrome/browser/autofill/autofill_common_unittest.cc b/chrome/browser/autofill/autofill_common_unittest.cc
index bbec876..2e2fd61 100644
--- a/chrome/browser/autofill/autofill_common_unittest.cc
+++ b/chrome/browser/autofill/autofill_common_unittest.cc
@@ -26,8 +26,8 @@ void SetProfileInfo(AutoFillProfile* profile,
profile->SetInfo(AutoFillType(ADDRESS_HOME_STATE), ASCIIToUTF16(state));
profile->SetInfo(AutoFillType(ADDRESS_HOME_ZIP), ASCIIToUTF16(zipcode));
profile->SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16(country));
- profile->SetInfo(AutoFillType(PHONE_HOME_NUMBER), ASCIIToUTF16(phone));
- profile->SetInfo(AutoFillType(PHONE_FAX_NUMBER), ASCIIToUTF16(fax));
+ profile->SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), ASCIIToUTF16(phone));
+ profile->SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16(fax));
}
void SetCreditCardInfo(CreditCard* credit_card,
diff --git a/chrome/browser/autofill/phone_number.cc b/chrome/browser/autofill/phone_number.cc
index e8829aa..2f7557d 100644
--- a/chrome/browser/autofill/phone_number.cc
+++ b/chrome/browser/autofill/phone_number.cc
@@ -113,6 +113,8 @@ void PhoneNumber::SetInfo(const AutoFillType& type, const string16& value) {
set_city_code(number);
else if (subgroup == AutoFillType::PHONE_COUNTRY_CODE)
set_country_code(number);
+ else if (subgroup == AutoFillType::PHONE_WHOLE_NUMBER)
+ set_whole_number(number);
else
NOTREACHED();
// TODO(jhawkins): Add extension support.
@@ -180,6 +182,14 @@ void PhoneNumber::set_number(const string16& number) {
number_ = digits;
}
+void PhoneNumber::set_whole_number(const string16& whole_number) {
+ string16 number, city_code, country_code;
+ ParsePhoneNumber(whole_number, &number, &city_code, &country_code);
+ set_number(number);
+ set_city_code(city_code);
+ set_country_code(country_code);
+}
+
PhoneNumber::PhoneNumber(const PhoneNumber& phone_number)
: FormGroup(),
country_code_(phone_number.country_code_),
diff --git a/chrome/browser/autofill/phone_number.h b/chrome/browser/autofill/phone_number.h
index 5e8affe..60e5c96 100644
--- a/chrome/browser/autofill/phone_number.h
+++ b/chrome/browser/autofill/phone_number.h
@@ -56,6 +56,7 @@ class PhoneNumber : public FormGroup {
void set_city_code(const string16& city_code) { city_code_ = city_code; }
void set_number(const string16& number);
void set_extension(const string16& extension) { extension_ = extension; }
+ void set_whole_number(const string16& whole_number);
// A helper function for FindInfoMatches that only handles matching the info
// with the requested field type.