summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/phone_number.cc
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 06:26:29 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 06:26:29 +0000
commit1ffe8e993e3052271b9a60f303bcbb8f3104d80b (patch)
treeb5b01c65813c53fa4279907baa8aa8f1eb5d5480 /chrome/browser/autofill/phone_number.cc
parentdaa826fee9fa5a59aa7b4bd82a1c6f2f4ae4a636 (diff)
downloadchromium_src-1ffe8e993e3052271b9a60f303bcbb8f3104d80b.zip
chromium_src-1ffe8e993e3052271b9a60f303bcbb8f3104d80b.tar.gz
chromium_src-1ffe8e993e3052271b9a60f303bcbb8f3104d80b.tar.bz2
Reduce boxing and unboxing of AutofillFieldType
BUG=none TEST=compiles Review URL: http://codereview.chromium.org/6673079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/phone_number.cc')
-rw-r--r--chrome/browser/autofill/phone_number.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/chrome/browser/autofill/phone_number.cc b/chrome/browser/autofill/phone_number.cc
index 110616a..d41e60d 100644
--- a/chrome/browser/autofill/phone_number.cc
+++ b/chrome/browser/autofill/phone_number.cc
@@ -92,27 +92,26 @@ void PhoneNumber::GetAvailableFieldTypes(FieldTypeSet* available_types) const {
available_types->insert(GetWholeNumberType());
}
-string16 PhoneNumber::GetFieldText(const AutofillType& type) const {
- AutofillFieldType field_type = type.field_type();
- if (field_type == GetNumberType())
+string16 PhoneNumber::GetFieldText(AutofillFieldType type) const {
+ if (type == GetNumberType())
return number();
- if (field_type == GetCityCodeType())
+ if (type == GetCityCodeType())
return city_code();
- if (field_type == GetCountryCodeType())
+ if (type == GetCountryCodeType())
return country_code();
- if (field_type == GetCityAndNumberType())
+ if (type == GetCityAndNumberType())
return CityAndNumber();
- if (field_type == GetWholeNumberType())
+ if (type == GetWholeNumberType())
return WholeNumber();
return string16();
}
-void PhoneNumber::FindInfoMatches(const AutofillType& type,
+void PhoneNumber::FindInfoMatches(AutofillFieldType type,
const string16& info,
std::vector<string16>* matched_text) const {
if (matched_text == NULL) {
@@ -126,24 +125,24 @@ void PhoneNumber::FindInfoMatches(const AutofillType& type,
return;
string16 match;
- if (type.field_type() == UNKNOWN_TYPE) {
+ if (type == UNKNOWN_TYPE) {
for (int i = 0; i < kAutoFillPhoneLength; ++i) {
if (FindInfoMatchesHelper(kAutoFillPhoneTypes[i], info, &match))
matched_text->push_back(match);
}
} else {
- if (FindInfoMatchesHelper(type.subgroup(), info, &match))
+ if (FindInfoMatchesHelper(AutofillType(type).subgroup(), info, &match))
matched_text->push_back(match);
}
}
-void PhoneNumber::SetInfo(const AutofillType& type, const string16& value) {
+void PhoneNumber::SetInfo(AutofillFieldType type, const string16& value) {
string16 number(value);
StripPunctuation(&number);
if (!Validate(number))
return;
- FieldTypeSubGroup subgroup = type.subgroup();
+ FieldTypeSubGroup subgroup = AutofillType(type).subgroup();
if (subgroup == AutofillType::PHONE_NUMBER)
set_number(number);
else if (subgroup == AutofillType::PHONE_CITY_CODE)