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

Unified Diff: chrome/browser/autofill/phone_number.cc

Issue 6673079: Reduce boxing and unboxing of AutofillFieldType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 9 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 | « chrome/browser/autofill/phone_number.h ('k') | chrome/browser/autofill/select_control_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/phone_number.cc
diff --git a/chrome/browser/autofill/phone_number.cc b/chrome/browser/autofill/phone_number.cc
index 110616a7b5feaa80ab34840c349127133ef5fea7..d41e60d512ac8135008ad41c1edb2dc28b2a6a6b 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)
« no previous file with comments | « chrome/browser/autofill/phone_number.h ('k') | chrome/browser/autofill/select_control_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698