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

Unified Diff: chrome/browser/autofill/address.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/address.h ('k') | chrome/browser/autofill/address_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/address.cc
diff --git a/chrome/browser/autofill/address.cc b/chrome/browser/autofill/address.cc
index 183b5e179102caf910b62aea3dab7a365dfb4a20..451f953f451c1d32805f3b73c5028d4f5b7c3381 100644
--- a/chrome/browser/autofill/address.cc
+++ b/chrome/browser/autofill/address.cc
@@ -100,48 +100,47 @@ void Address::GetAvailableFieldTypes(FieldTypeSet* available_types) const {
available_types->insert(ADDRESS_HOME_COUNTRY);
}
-void Address::FindInfoMatches(const AutofillType& type,
+void Address::FindInfoMatches(AutofillFieldType type,
const string16& info,
std::vector<string16>* matched_text) const {
DCHECK(matched_text);
string16 match;
- if (type.field_type() == UNKNOWN_TYPE) {
+ if (type == UNKNOWN_TYPE) {
for (int i = 0; i < kAutoFillAddressLength; ++i) {
if (FindInfoMatchesHelper(kAutoFillAddressTypes[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);
}
}
-string16 Address::GetFieldText(const AutofillType& type) const {
- AutofillFieldType field_type = type.field_type();
- if (field_type == ADDRESS_HOME_LINE1)
+string16 Address::GetFieldText(AutofillFieldType type) const {
+ if (type == ADDRESS_HOME_LINE1)
return line1_;
- if (field_type == ADDRESS_HOME_LINE2)
+ if (type == ADDRESS_HOME_LINE2)
return line2_;
- if (field_type == ADDRESS_HOME_CITY)
+ if (type == ADDRESS_HOME_CITY)
return city_;
- if (field_type == ADDRESS_HOME_STATE)
+ if (type == ADDRESS_HOME_STATE)
return state_;
- if (field_type == ADDRESS_HOME_ZIP)
+ if (type == ADDRESS_HOME_ZIP)
return zip_code_;
- if (field_type == ADDRESS_HOME_COUNTRY)
+ if (type == ADDRESS_HOME_COUNTRY)
return Country();
return string16();
}
-void Address::SetInfo(const AutofillType& type, const string16& value) {
- FieldTypeSubGroup subgroup = type.subgroup();
+void Address::SetInfo(AutofillFieldType type, const string16& value) {
+ FieldTypeSubGroup subgroup = AutofillType(type).subgroup();
if (subgroup == AutofillType::ADDRESS_LINE1)
set_line1(value);
else if (subgroup == AutofillType::ADDRESS_LINE2)
« no previous file with comments | « chrome/browser/autofill/address.h ('k') | chrome/browser/autofill/address_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698