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

Unified Diff: chrome/browser/autofill/personal_data_manager_mac.mm

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
Index: chrome/browser/autofill/personal_data_manager_mac.mm
diff --git a/chrome/browser/autofill/personal_data_manager_mac.mm b/chrome/browser/autofill/personal_data_manager_mac.mm
index 13d4f8eb88fbe82ad5a2c11f3a217463c80ee4f1..b9a92a1cf2d157eb3b378e042a87c6516407f9d2 100644
--- a/chrome/browser/autofill/personal_data_manager_mac.mm
+++ b/chrome/browser/autofill/personal_data_manager_mac.mm
@@ -111,16 +111,11 @@ void AuxiliaryProfilesImpl::GetAddressBookNames(
NSString* lastName = [me valueForProperty:kABLastNameProperty];
NSString* companyName = [me valueForProperty:kABOrganizationProperty];
- profile->SetInfo(AutofillType(NAME_FIRST),
- base::SysNSStringToUTF16(firstName));
- profile->SetInfo(AutofillType(NAME_MIDDLE),
- base::SysNSStringToUTF16(middleName));
- profile->SetInfo(AutofillType(NAME_LAST),
- base::SysNSStringToUTF16(lastName));
- if ([addressLabelRaw isEqualToString:kABAddressWorkLabel]) {
- profile->SetInfo(AutofillType(COMPANY_NAME),
- base::SysNSStringToUTF16(companyName));
- }
+ profile->SetInfo(NAME_FIRST, base::SysNSStringToUTF16(firstName));
+ profile->SetInfo(NAME_MIDDLE, base::SysNSStringToUTF16(middleName));
+ profile->SetInfo(NAME_LAST, base::SysNSStringToUTF16(lastName));
+ if ([addressLabelRaw isEqualToString:kABAddressWorkLabel])
+ profile->SetInfo(COMPANY_NAME, base::SysNSStringToUTF16(companyName));
}
// Addresss information from the Address Book may span multiple lines.
@@ -146,32 +141,24 @@ void AuxiliaryProfilesImpl::GetAddressBookAddresses(
NSString* addressField2 =
[[chunks subarrayWithRange:NSMakeRange(1, [chunks count] - 1)]
componentsJoinedByString:separator];
- profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1),
+ profile->SetInfo(ADDRESS_HOME_LINE1,
base::SysNSStringToUTF16(addressField1));
- profile->SetInfo(AutofillType(ADDRESS_HOME_LINE2),
+ profile->SetInfo(ADDRESS_HOME_LINE2,
base::SysNSStringToUTF16(addressField2));
} else {
- profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1),
+ profile->SetInfo(ADDRESS_HOME_LINE1,
base::SysNSStringToUTF16(addressField));
}
}
- if (NSString* city = [address objectForKey:kABAddressCityKey]) {
- profile->SetInfo(AutofillType(ADDRESS_HOME_CITY),
- base::SysNSStringToUTF16(city));
- }
- if (NSString* state = [address objectForKey:kABAddressStateKey]) {
- profile->SetInfo(AutofillType(ADDRESS_HOME_STATE),
- base::SysNSStringToUTF16(state));
- }
- if (NSString* zip = [address objectForKey:kABAddressZIPKey]) {
- profile->SetInfo(AutofillType(ADDRESS_HOME_ZIP),
- base::SysNSStringToUTF16(zip));
- }
- if (NSString* country = [address objectForKey:kABAddressCountryKey]) {
- profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY),
- base::SysNSStringToUTF16(country));
- }
+ if (NSString* city = [address objectForKey:kABAddressCityKey])
+ profile->SetInfo(ADDRESS_HOME_CITY, base::SysNSStringToUTF16(city));
+ if (NSString* state = [address objectForKey:kABAddressStateKey])
+ profile->SetInfo(ADDRESS_HOME_STATE, base::SysNSStringToUTF16(state));
+ if (NSString* zip = [address objectForKey:kABAddressZIPKey])
+ profile->SetInfo(ADDRESS_HOME_ZIP, base::SysNSStringToUTF16(zip));
+ if (NSString* country = [address objectForKey:kABAddressCountryKey])
+ profile->SetInfo(ADDRESS_HOME_COUNTRY, base::SysNSStringToUTF16(country));
}
// Fills in email address matching current address label. Note that there may
@@ -191,8 +178,7 @@ void AuxiliaryProfilesImpl::GetAddressBookEmail(
break;
}
}
- profile->SetInfo(AutofillType(EMAIL_ADDRESS),
- base::SysNSStringToUTF16(emailAddress));
+ profile->SetInfo(EMAIL_ADDRESS, base::SysNSStringToUTF16(emailAddress));
}
// Fills in telephone numbers. Each of these are special cases.
@@ -218,36 +204,36 @@ void AuxiliaryProfilesImpl::GetAddressBookPhoneNumbers(
[phoneNumbers valueAtIndex:reverseK]);
PhoneNumber::ParsePhoneNumber(
homePhone, &number, &city_code, &country_code);
- profile->SetInfo(AutofillType(PHONE_HOME_NUMBER), number);
- profile->SetInfo(AutofillType(PHONE_HOME_CITY_CODE), city_code);
- profile->SetInfo(AutofillType(PHONE_HOME_COUNTRY_CODE), country_code);
+ profile->SetInfo(PHONE_HOME_NUMBER, number);
+ profile->SetInfo(PHONE_HOME_CITY_CODE, city_code);
+ profile->SetInfo(PHONE_HOME_COUNTRY_CODE, country_code);
} else if ([addressLabelRaw isEqualToString:kABAddressHomeLabel] &&
[phoneLabelRaw isEqualToString:kABPhoneHomeFAXLabel]) {
string16 homeFax = base::SysNSStringToUTF16(
[phoneNumbers valueAtIndex:reverseK]);
PhoneNumber::ParsePhoneNumber(homeFax,
&number, &city_code, &country_code);
- profile->SetInfo(AutofillType(PHONE_FAX_NUMBER), number);
- profile->SetInfo(AutofillType(PHONE_FAX_CITY_CODE), city_code);
- profile->SetInfo(AutofillType(PHONE_FAX_COUNTRY_CODE), country_code);
+ profile->SetInfo(PHONE_FAX_NUMBER, number);
+ profile->SetInfo(PHONE_FAX_CITY_CODE, city_code);
+ profile->SetInfo(PHONE_FAX_COUNTRY_CODE, country_code);
} else if ([addressLabelRaw isEqualToString:kABAddressWorkLabel] &&
[phoneLabelRaw isEqualToString:kABPhoneWorkLabel]) {
string16 workPhone = base::SysNSStringToUTF16(
[phoneNumbers valueAtIndex:reverseK]);
PhoneNumber::ParsePhoneNumber(workPhone,
&number, &city_code, &country_code);
- profile->SetInfo(AutofillType(PHONE_HOME_NUMBER), number);
- profile->SetInfo(AutofillType(PHONE_HOME_CITY_CODE), city_code);
- profile->SetInfo(AutofillType(PHONE_HOME_COUNTRY_CODE), country_code);
+ profile->SetInfo(PHONE_HOME_NUMBER, number);
+ profile->SetInfo(PHONE_HOME_CITY_CODE, city_code);
+ profile->SetInfo(PHONE_HOME_COUNTRY_CODE, country_code);
} else if ([addressLabelRaw isEqualToString:kABAddressWorkLabel] &&
[phoneLabelRaw isEqualToString:kABPhoneWorkFAXLabel]) {
string16 workFax = base::SysNSStringToUTF16(
[phoneNumbers valueAtIndex:reverseK]);
PhoneNumber::ParsePhoneNumber(workFax,
&number, &city_code, &country_code);
- profile->SetInfo(AutofillType(PHONE_FAX_NUMBER), number);
- profile->SetInfo(AutofillType(PHONE_FAX_CITY_CODE), city_code);
- profile->SetInfo(AutofillType(PHONE_FAX_COUNTRY_CODE), country_code);
+ profile->SetInfo(PHONE_FAX_NUMBER, number);
+ profile->SetInfo(PHONE_FAX_CITY_CODE, city_code);
+ profile->SetInfo(PHONE_FAX_COUNTRY_CODE, country_code);
}
}
}
« no previous file with comments | « chrome/browser/autofill/personal_data_manager.cc ('k') | chrome/browser/autofill/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698