diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-17 23:04:55 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-17 23:04:55 +0000 |
commit | 3b3a0ca7214f89a01cea18b98b3de289165a7166 (patch) | |
tree | 6a84be99eda9211c123dc384b08deceba83e22db /chrome/browser/autofill | |
parent | 45e616f2c317128ed25714a8cdc35d7d8ff9f43a (diff) | |
download | chromium_src-3b3a0ca7214f89a01cea18b98b3de289165a7166.zip chromium_src-3b3a0ca7214f89a01cea18b98b3de289165a7166.tar.gz chromium_src-3b3a0ca7214f89a01cea18b98b3de289165a7166.tar.bz2 |
Autofill rename GetFieldText to GetInfo
Renames AutofillProfile::GetFieldText to AutofillProfile::GetInfo. To match SetInfo.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6713002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78622 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
20 files changed, 118 insertions, 122 deletions
diff --git a/chrome/browser/autofill/address.cc b/chrome/browser/autofill/address.cc index 451f953..7531d78 100644 --- a/chrome/browser/autofill/address.cc +++ b/chrome/browser/autofill/address.cc @@ -117,7 +117,7 @@ void Address::FindInfoMatches(AutofillFieldType type, } } -string16 Address::GetFieldText(AutofillFieldType type) const { +string16 Address::GetInfo(AutofillFieldType type) const { if (type == ADDRESS_HOME_LINE1) return line1_; diff --git a/chrome/browser/autofill/address.h b/chrome/browser/autofill/address.h index 009451b..d030049 100644 --- a/chrome/browser/autofill/address.h +++ b/chrome/browser/autofill/address.h @@ -29,7 +29,7 @@ class Address : public FormGroup { virtual void FindInfoMatches(AutofillFieldType type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(AutofillFieldType type) const; + virtual string16 GetInfo(AutofillFieldType type) const; virtual void SetInfo(AutofillFieldType type, const string16& value); const std::string& country_code() const { return country_code_; } diff --git a/chrome/browser/autofill/address_unittest.cc b/chrome/browser/autofill/address_unittest.cc index 1bbda9e..fb5547f 100644 --- a/chrome/browser/autofill/address_unittest.cc +++ b/chrome/browser/autofill/address_unittest.cc @@ -28,15 +28,15 @@ TEST(AddressTest, GetCountry) { EXPECT_EQ(std::string(), address.country_code()); // Make sure that nothing breaks when the country code is missing. - string16 country = address.GetFieldText(ADDRESS_HOME_COUNTRY); + string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY); EXPECT_EQ(string16(), country); address.set_country_code("US"); - country = address.GetFieldText(ADDRESS_HOME_COUNTRY); + country = address.GetInfo(ADDRESS_HOME_COUNTRY); EXPECT_EQ(ASCIIToUTF16("United States"), country); address.set_country_code("CA"); - country = address.GetFieldText(ADDRESS_HOME_COUNTRY); + country = address.GetInfo(ADDRESS_HOME_COUNTRY); EXPECT_EQ(ASCIIToUTF16("Canada"), country); } @@ -47,31 +47,31 @@ TEST(AddressTest, SetCountry) { // Test basic conversion. address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States")); - string16 country = address.GetFieldText(ADDRESS_HOME_COUNTRY); + string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY); EXPECT_EQ("US", address.country_code()); EXPECT_EQ(ASCIIToUTF16("United States"), country); // Test basic synonym detection. address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("USA")); - country = address.GetFieldText(ADDRESS_HOME_COUNTRY); + country = address.GetInfo(ADDRESS_HOME_COUNTRY); EXPECT_EQ("US", address.country_code()); EXPECT_EQ(ASCIIToUTF16("United States"), country); // Test case-insensitivity. address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("canADA")); - country = address.GetFieldText(ADDRESS_HOME_COUNTRY); + country = address.GetInfo(ADDRESS_HOME_COUNTRY); EXPECT_EQ("CA", address.country_code()); EXPECT_EQ(ASCIIToUTF16("Canada"), country); // Test country code detection. address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("JP")); - country = address.GetFieldText(ADDRESS_HOME_COUNTRY); + country = address.GetInfo(ADDRESS_HOME_COUNTRY); EXPECT_EQ("JP", address.country_code()); EXPECT_EQ(ASCIIToUTF16("Japan"), country); // Test that we ignore unknown countries. address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Unknown")); - country = address.GetFieldText(ADDRESS_HOME_COUNTRY); + country = address.GetInfo(ADDRESS_HOME_COUNTRY); EXPECT_EQ(std::string(), address.country_code()); EXPECT_EQ(string16(), country); } diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc index e8b9c29..6ff6e33 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc @@ -209,13 +209,13 @@ bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles, if (ImportSingleProfile(&profile, &key, reg_to_field)) { // Combine phones into whole phone #. string16 phone; - phone = profile.GetFieldText(PHONE_HOME_COUNTRY_CODE); - phone.append(profile.GetFieldText(PHONE_HOME_CITY_CODE)); - phone.append(profile.GetFieldText(PHONE_HOME_NUMBER)); + phone = profile.GetInfo(PHONE_HOME_COUNTRY_CODE); + phone.append(profile.GetInfo(PHONE_HOME_CITY_CODE)); + phone.append(profile.GetInfo(PHONE_HOME_NUMBER)); profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, phone); - phone = profile.GetFieldText(PHONE_FAX_COUNTRY_CODE); - phone.append(profile.GetFieldText(PHONE_FAX_CITY_CODE)); - phone.append(profile.GetFieldText(PHONE_FAX_NUMBER)); + phone = profile.GetInfo(PHONE_FAX_COUNTRY_CODE); + phone.append(profile.GetInfo(PHONE_FAX_CITY_CODE)); + phone.append(profile.GetInfo(PHONE_FAX_NUMBER)); profile.SetInfo(PHONE_FAX_WHOLE_NUMBER, phone); profiles->push_back(profile); } @@ -239,7 +239,7 @@ bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles, RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ); CreditCard credit_card; if (ImportSingleProfile(&credit_card, &key, reg_to_field)) { - string16 cc_number = credit_card.GetFieldText(CREDIT_CARD_NUMBER); + string16 cc_number = credit_card.GetInfo(CREDIT_CARD_NUMBER); if (!cc_number.empty()) credit_cards->push_back(credit_card); } diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc index 5e9a4d0..46f02a3 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc @@ -163,35 +163,31 @@ TEST_F(AutofillIeToolbarImportTest, TestAutoFillImport) { EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards)); ASSERT_EQ(profiles.size(), 2); // The profiles are read in reverse order. - EXPECT_EQ(profiles[1].GetFieldText(NAME_FIRST), profile1[0].value); - EXPECT_EQ(profiles[1].GetFieldText(NAME_MIDDLE), profile1[1].value); - EXPECT_EQ(profiles[1].GetFieldText(NAME_LAST), profile1[2].value); - EXPECT_EQ(profiles[1].GetFieldText(EMAIL_ADDRESS), profile1[3].value); - EXPECT_EQ(profiles[1].GetFieldText(COMPANY_NAME), profile1[4].value); - EXPECT_EQ(profiles[1].GetFieldText(PHONE_HOME_COUNTRY_CODE), - profile1[7].value); - EXPECT_EQ(profiles[1].GetFieldText(PHONE_HOME_CITY_CODE), profile1[6].value); - EXPECT_EQ(profiles[1].GetFieldText(PHONE_HOME_NUMBER), L"5555555"); - EXPECT_EQ(profiles[1].GetFieldText(PHONE_HOME_WHOLE_NUMBER), L"14445555555"); - - EXPECT_EQ(profiles[0].GetFieldText(NAME_FIRST), profile2[0].value); - EXPECT_EQ(profiles[0].GetFieldText(NAME_LAST), profile2[1].value); - EXPECT_EQ(profiles[0].GetFieldText(EMAIL_ADDRESS), profile2[2].value); - EXPECT_EQ(profiles[0].GetFieldText(COMPANY_NAME), profile2[3].value); - EXPECT_EQ(profiles[0].GetFieldText(PHONE_FAX_COUNTRY_CODE), - profile2[6].value); - EXPECT_EQ(profiles[0].GetFieldText(PHONE_FAX_CITY_CODE), profile2[5].value); - EXPECT_EQ(profiles[0].GetFieldText(PHONE_FAX_NUMBER), L"5556666"); - EXPECT_EQ(profiles[0].GetFieldText(PHONE_FAX_WHOLE_NUMBER), L"27775556666"); + EXPECT_EQ(profiles[1].GetInfo(NAME_FIRST), profile1[0].value); + EXPECT_EQ(profiles[1].GetInfo(NAME_MIDDLE), profile1[1].value); + EXPECT_EQ(profiles[1].GetInfo(NAME_LAST), profile1[2].value); + EXPECT_EQ(profiles[1].GetInfo(EMAIL_ADDRESS), profile1[3].value); + EXPECT_EQ(profiles[1].GetInfo(COMPANY_NAME), profile1[4].value); + EXPECT_EQ(profiles[1].GetInfo(PHONE_HOME_COUNTRY_CODE), profile1[7].value); + EXPECT_EQ(profiles[1].GetInfo(PHONE_HOME_CITY_CODE), profile1[6].value); + EXPECT_EQ(profiles[1].GetInfo(PHONE_HOME_NUMBER), L"5555555"); + EXPECT_EQ(profiles[1].GetInfo(PHONE_HOME_WHOLE_NUMBER), L"14445555555"); + + EXPECT_EQ(profiles[0].GetInfo(NAME_FIRST), profile2[0].value); + EXPECT_EQ(profiles[0].GetInfo(NAME_LAST), profile2[1].value); + EXPECT_EQ(profiles[0].GetInfo(EMAIL_ADDRESS), profile2[2].value); + EXPECT_EQ(profiles[0].GetInfo(COMPANY_NAME), profile2[3].value); + EXPECT_EQ(profiles[0].GetInfo(PHONE_FAX_COUNTRY_CODE), profile2[6].value); + EXPECT_EQ(profiles[0].GetInfo(PHONE_FAX_CITY_CODE), profile2[5].value); + EXPECT_EQ(profiles[0].GetInfo(PHONE_FAX_NUMBER), L"5556666"); + EXPECT_EQ(profiles[0].GetInfo(PHONE_FAX_WHOLE_NUMBER), L"27775556666"); ASSERT_EQ(credit_cards.size(), 1); - EXPECT_EQ(credit_cards[0].GetFieldText(CREDIT_CARD_NAME), - credit_card[0].value); - EXPECT_EQ(credit_cards[0].GetFieldText(CREDIT_CARD_NUMBER), - L"4111111111111111"); - EXPECT_EQ(credit_cards[0].GetFieldText(CREDIT_CARD_EXP_MONTH), + EXPECT_EQ(credit_cards[0].GetInfo(CREDIT_CARD_NAME), credit_card[0].value); + EXPECT_EQ(credit_cards[0].GetInfo(CREDIT_CARD_NUMBER), L"4111111111111111"); + EXPECT_EQ(credit_cards[0].GetInfo(CREDIT_CARD_EXP_MONTH), credit_card[2].value); - EXPECT_EQ(credit_cards[0].GetFieldText(CREDIT_CARD_EXP_4_DIGIT_YEAR), + EXPECT_EQ(credit_cards[0].GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR), credit_card[3].value); // Mock password encrypted cc. diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 6d443dc..2161ef2 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -740,7 +740,7 @@ void AutofillManager::GetProfileSuggestions(FormStructure* form, AutofillProfile* profile = *iter; // The value of the stored data for this field type in the |profile|. - string16 profile_field_value = profile->GetFieldText(type); + string16 profile_field_value = profile->GetInfo(type); if (!profile_field_value.empty() && StartsWith(profile_field_value, field.value, false)) { @@ -781,7 +781,7 @@ void AutofillManager::GetCreditCardSuggestions(FormStructure* form, CreditCard* credit_card = *iter; // The value of the stored data for this field type in the |credit_card|. - string16 creditcard_field_value = credit_card->GetFieldText(type); + string16 creditcard_field_value = credit_card->GetInfo(type); if (!creditcard_field_value.empty() && StartsWith(creditcard_field_value, field.value, false)) { if (type == CREDIT_CARD_NUMBER) @@ -790,7 +790,7 @@ void AutofillManager::GetCreditCardSuggestions(FormStructure* form, string16 label; if (credit_card->number().empty()) { // If there is no CC number, return name to show something. - label = credit_card->GetFieldText(CREDIT_CARD_NAME); + label = credit_card->GetInfo(CREDIT_CARD_NAME); } else { label = kCreditCardPrefix; label.append(credit_card->LastFourDigits()); @@ -815,15 +815,15 @@ void AutofillManager::FillCreditCardFormField(const CreditCard* credit_card, autofill::FillSelectControl(*credit_card, type, field); } else if (field->form_control_type == ASCIIToUTF16("month")) { // HTML5 input="month" consists of year-month. - string16 year = credit_card->GetFieldText(CREDIT_CARD_EXP_4_DIGIT_YEAR); - string16 month = credit_card->GetFieldText(CREDIT_CARD_EXP_MONTH); + string16 year = credit_card->GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR); + string16 month = credit_card->GetInfo(CREDIT_CARD_EXP_MONTH); if (!year.empty() && !month.empty()) { // Fill the value only if |credit_card| includes both year and month // information. field->value = year + ASCIIToUTF16("-") + month; } } else { - field->value = credit_card->GetFieldText(type); + field->value = credit_card->GetInfo(type); } } @@ -840,7 +840,7 @@ void AutofillManager::FillFormField(const AutofillProfile* profile, if (field->form_control_type == ASCIIToUTF16("select-one")) autofill::FillSelectControl(*profile, type, field); else - field->value = profile->GetFieldText(type); + field->value = profile->GetInfo(type); } } @@ -849,7 +849,7 @@ void AutofillManager::FillPhoneNumberField(const AutofillProfile* profile, webkit_glue::FormField* field) { // If we are filling a phone number, check to see if the size field // matches the "prefix" or "suffix" sizes and fill accordingly. - string16 number = profile->GetFieldText(type); + string16 number = profile->GetInfo(type); bool has_valid_suffix_and_prefix = (number.length() == static_cast<size_t>(PhoneNumber::kPrefixLength + PhoneNumber::kSuffixLength)); diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index eaf6321..5fd2b03 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -1672,7 +1672,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { AutofillProfile *work_profile = autofill_manager_->GetProfileWithGUID( "00000000-0000-0000-0000-000000000002"); ASSERT_TRUE(work_profile != NULL); - string16 saved_phone = work_profile->GetFieldText(PHONE_HOME_NUMBER); + string16 saved_phone = work_profile->GetInfo(PHONE_HOME_NUMBER); char test_data[] = "1234567890123456"; for (int i = arraysize(test_data) - 1; i >= 0; --i) { diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc index 8c0677f..38cb6d8 100644 --- a/chrome/browser/autofill/autofill_merge_unittest.cc +++ b/chrome/browser/autofill/autofill_merge_unittest.cc @@ -53,7 +53,7 @@ std::string SerializeProfiles(const std::vector<AutofillProfile*>& profiles) { AutofillFieldType type = kProfileFieldTypes[j]; result += AutofillType::FieldTypeToString(type); result += kFieldSeparator; - result += UTF16ToUTF8(profiles[i]->GetFieldText(type)); + result += UTF16ToUTF8(profiles[i]->GetInfo(type)); result += "\n"; } } diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc index e5f0260..01b7886 100644 --- a/chrome/browser/autofill/autofill_profile.cc +++ b/chrome/browser/autofill/autofill_profile.cc @@ -148,18 +148,6 @@ void AutofillProfile::GetAvailableFieldTypes( (*it)->GetAvailableFieldTypes(available_types); } -string16 AutofillProfile::GetFieldText(AutofillFieldType type) const { - AutofillFieldType return_type = AutofillType::GetEquivalentFieldType(type); - - FormGroupMap info = info_map(); - FormGroupMap::const_iterator it = - info.find(AutofillType(return_type).group()); - if (it == info.end()) - return string16(); - - return it->second->GetFieldText(return_type); -} - void AutofillProfile::FindInfoMatches( AutofillFieldType type, const string16& value, @@ -185,6 +173,18 @@ void AutofillProfile::FindInfoMatches( } } +string16 AutofillProfile::GetInfo(AutofillFieldType type) const { + AutofillFieldType return_type = AutofillType::GetEquivalentFieldType(type); + + FormGroupMap info = info_map(); + FormGroupMap::const_iterator it = + info.find(AutofillType(return_type).group()); + if (it == info.end()) + return string16(); + + return it->second->GetInfo(return_type); +} + void AutofillProfile::SetInfo(AutofillFieldType type, const string16& value) { MutableFormGroupMap info = mutable_info_map(); MutableFormGroupMap::iterator it = info.find(AutofillType(type).group()); @@ -291,8 +291,8 @@ int AutofillProfile::Compare(const AutofillProfile& profile) const { PHONE_FAX_NUMBER }; for (size_t index = 0; index < arraysize(types); ++index) { - int comparison = GetFieldText(types[index]).compare( - profile.GetFieldText(types[index])); + int comparison = GetInfo(types[index]).compare( + profile.GetInfo(types[index])); if (comparison != 0) return comparison; } @@ -309,10 +309,10 @@ bool AutofillProfile::operator!=(const AutofillProfile& profile) const { } const string16 AutofillProfile::PrimaryValue() const { - return GetFieldText(NAME_FULL) + - GetFieldText(ADDRESS_HOME_LINE1) + - GetFieldText(ADDRESS_HOME_LINE2) + - GetFieldText(EMAIL_ADDRESS); + return GetInfo(NAME_FULL) + + GetInfo(ADDRESS_HOME_LINE1) + + GetInfo(ADDRESS_HOME_LINE2) + + GetInfo(EMAIL_ADDRESS); } string16 AutofillProfile::ConstructInferredLabel( @@ -327,7 +327,7 @@ string16 AutofillProfile::ConstructInferredLabel( included_fields.begin(); it != included_fields.end() && num_fields_used < num_fields_to_use; ++it) { - string16 field = GetFieldText(*it); + string16 field = GetInfo(*it); if (field.empty()) continue; @@ -364,7 +364,7 @@ void AutofillProfile::CreateDifferentiatingLabels( for (std::list<size_t>::const_iterator it = indices.begin(); it != indices.end(); ++it) { const AutofillProfile* profile = profiles[*it]; - string16 field_text = profile->GetFieldText(*field); + string16 field_text = profile->GetInfo(*field); // If this label is not already in the map, add it with frequency 0. if (!field_text_frequencies.count(field_text)) @@ -391,7 +391,7 @@ void AutofillProfile::CreateDifferentiatingLabels( for (std::vector<AutofillFieldType>::const_iterator field = fields.begin(); field != fields.end(); ++field) { // Skip over empty fields. - string16 field_text = profile->GetFieldText(*field); + string16 field_text = profile->GetInfo(*field); if (field_text.empty()) continue; @@ -461,29 +461,29 @@ std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) { << " " << profile.guid() << " " - << UTF16ToUTF8(profile.GetFieldText(NAME_FIRST)) + << UTF16ToUTF8(profile.GetInfo(NAME_FIRST)) << " " - << UTF16ToUTF8(profile.GetFieldText(NAME_MIDDLE)) + << UTF16ToUTF8(profile.GetInfo(NAME_MIDDLE)) << " " - << UTF16ToUTF8(profile.GetFieldText(NAME_LAST)) + << UTF16ToUTF8(profile.GetInfo(NAME_LAST)) << " " - << UTF16ToUTF8(profile.GetFieldText(EMAIL_ADDRESS)) + << UTF16ToUTF8(profile.GetInfo(EMAIL_ADDRESS)) << " " - << UTF16ToUTF8(profile.GetFieldText(COMPANY_NAME)) + << UTF16ToUTF8(profile.GetInfo(COMPANY_NAME)) << " " - << UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_LINE1)) + << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_LINE1)) << " " - << UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_LINE2)) + << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_LINE2)) << " " - << UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_CITY)) + << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_CITY)) << " " - << UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_STATE)) + << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_STATE)) << " " - << UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_ZIP)) + << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_ZIP)) << " " - << UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_COUNTRY)) + << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_COUNTRY)) << " " - << UTF16ToUTF8(profile.GetFieldText(PHONE_HOME_WHOLE_NUMBER)) + << UTF16ToUTF8(profile.GetInfo(PHONE_HOME_WHOLE_NUMBER)) << " " - << UTF16ToUTF8(profile.GetFieldText(PHONE_FAX_WHOLE_NUMBER)); + << UTF16ToUTF8(profile.GetInfo(PHONE_FAX_WHOLE_NUMBER)); } diff --git a/chrome/browser/autofill/autofill_profile.h b/chrome/browser/autofill/autofill_profile.h index a80d062..7b8b50f 100644 --- a/chrome/browser/autofill/autofill_profile.h +++ b/chrome/browser/autofill/autofill_profile.h @@ -36,13 +36,13 @@ class AutofillProfile : public FormGroup { virtual void GetPossibleFieldTypes(const string16& text, FieldTypeSet* possible_types) const; virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; - virtual string16 GetFieldText(AutofillFieldType type) const; // Returns true if the |value| matches the profile data corresponding to type. // If the type is UNKNOWN_TYPE then |value| will be matched against all of the // profile data. virtual void FindInfoMatches(AutofillFieldType type, const string16& value, std::vector<string16>* matched_text) const; + virtual string16 GetInfo(AutofillFieldType type) const; virtual void SetInfo(AutofillFieldType type, const string16& value); // The user-visible label of the profile, generated in relation to other diff --git a/chrome/browser/autofill/contact_info.cc b/chrome/browser/autofill/contact_info.cc index 8d937db..705d778 100644 --- a/chrome/browser/autofill/contact_info.cc +++ b/chrome/browser/autofill/contact_info.cc @@ -97,7 +97,7 @@ void NameInfo::FindInfoMatches(AutofillFieldType type, } } -string16 NameInfo::GetFieldText(AutofillFieldType type) const { +string16 NameInfo::GetInfo(AutofillFieldType type) const { if (type == NAME_FIRST) return first(); @@ -406,7 +406,7 @@ void EmailInfo::FindInfoMatches(AutofillFieldType type, } } -string16 EmailInfo::GetFieldText(AutofillFieldType type) const { +string16 EmailInfo::GetInfo(AutofillFieldType type) const { if (type == EMAIL_ADDRESS) return email_; @@ -461,7 +461,7 @@ void CompanyInfo::FindInfoMatches(AutofillFieldType type, } } -string16 CompanyInfo::GetFieldText(AutofillFieldType type) const { +string16 CompanyInfo::GetInfo(AutofillFieldType type) const { if (type == COMPANY_NAME) return company_name_; diff --git a/chrome/browser/autofill/contact_info.h b/chrome/browser/autofill/contact_info.h index beb05e6..d01e20c 100644 --- a/chrome/browser/autofill/contact_info.h +++ b/chrome/browser/autofill/contact_info.h @@ -28,7 +28,7 @@ class NameInfo : public FormGroup { virtual void FindInfoMatches(AutofillFieldType type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(AutofillFieldType type) const; + virtual string16 GetInfo(AutofillFieldType type) const; virtual void SetInfo(AutofillFieldType type, const string16& value); private: @@ -117,7 +117,7 @@ class EmailInfo : public FormGroup { virtual void FindInfoMatches(AutofillFieldType type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(AutofillFieldType type) const; + virtual string16 GetInfo(AutofillFieldType type) const; virtual void SetInfo(AutofillFieldType type, const string16& value); private: @@ -139,7 +139,7 @@ class CompanyInfo : public FormGroup { virtual void FindInfoMatches(AutofillFieldType type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(AutofillFieldType type) const; + virtual string16 GetInfo(AutofillFieldType type) const; virtual void SetInfo(AutofillFieldType type, const string16& value); private: diff --git a/chrome/browser/autofill/credit_card.cc b/chrome/browser/autofill/credit_card.cc index 813761b..e32fb13 100644 --- a/chrome/browser/autofill/credit_card.cc +++ b/chrome/browser/autofill/credit_card.cc @@ -220,7 +220,7 @@ void CreditCard::FindInfoMatches(AutofillFieldType type, } } -string16 CreditCard::GetFieldText(AutofillFieldType type) const { +string16 CreditCard::GetInfo(AutofillFieldType type) const { switch (type) { case CREDIT_CARD_NAME: return name_on_card(); @@ -277,7 +277,7 @@ string16 CreditCard::GetPreviewText(AutofillFieldType type) const { return string16(); default: - return GetFieldText(type); + return GetInfo(type); } } @@ -411,8 +411,8 @@ int CreditCard::Compare(const CreditCard& credit_card) const { CREDIT_CARD_EXP_MONTH, CREDIT_CARD_EXP_4_DIGIT_YEAR }; for (size_t index = 0; index < arraysize(types); ++index) { - int comparison = GetFieldText(types[index]).compare( - credit_card.GetFieldText(types[index])); + int comparison = GetInfo(types[index]).compare( + credit_card.GetInfo(types[index])); if (comparison != 0) return comparison; } @@ -641,15 +641,15 @@ std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) { << " " << credit_card.guid() << " " - << UTF16ToUTF8(credit_card.GetFieldText(CREDIT_CARD_NAME)) + << UTF16ToUTF8(credit_card.GetInfo(CREDIT_CARD_NAME)) << " " - << UTF16ToUTF8(credit_card.GetFieldText(CREDIT_CARD_TYPE)) + << UTF16ToUTF8(credit_card.GetInfo(CREDIT_CARD_TYPE)) << " " - << UTF16ToUTF8(credit_card.GetFieldText(CREDIT_CARD_NUMBER)) + << UTF16ToUTF8(credit_card.GetInfo(CREDIT_CARD_NUMBER)) << " " - << UTF16ToUTF8(credit_card.GetFieldText(CREDIT_CARD_EXP_MONTH)) + << UTF16ToUTF8(credit_card.GetInfo(CREDIT_CARD_EXP_MONTH)) << " " - << UTF16ToUTF8(credit_card.GetFieldText(CREDIT_CARD_EXP_4_DIGIT_YEAR)); + << UTF16ToUTF8(credit_card.GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)); } // These values must match the values in WebKitClientImpl in webkit/glue. We diff --git a/chrome/browser/autofill/credit_card.h b/chrome/browser/autofill/credit_card.h index 6691ff8..dffe004 100644 --- a/chrome/browser/autofill/credit_card.h +++ b/chrome/browser/autofill/credit_card.h @@ -28,8 +28,8 @@ class CreditCard : public FormGroup { virtual void FindInfoMatches(AutofillFieldType type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(AutofillFieldType type) const; virtual string16 GetPreviewText(AutofillFieldType type) const; + virtual string16 GetInfo(AutofillFieldType type) const; virtual void SetInfo(AutofillFieldType type, const string16& value); virtual const string16 Label() const; diff --git a/chrome/browser/autofill/form_group.cc b/chrome/browser/autofill/form_group.cc index bd38d1ac..4d449a8 100644 --- a/chrome/browser/autofill/form_group.cc +++ b/chrome/browser/autofill/form_group.cc @@ -9,7 +9,7 @@ #include <iterator> string16 FormGroup::GetPreviewText(AutofillFieldType type) const { - return GetFieldText(type); + return GetInfo(type); } const string16 FormGroup::Label() const { return string16(); } @@ -35,7 +35,7 @@ bool FormGroup::IsSubsetOf(const FormGroup& form_group) const { for (FieldTypeSet::const_iterator iter = types.begin(); iter != types.end(); ++iter) { - if (GetFieldText(*iter) != form_group.GetFieldText(*iter)) + if (GetInfo(*iter) != form_group.GetInfo(*iter)) return false; } @@ -57,7 +57,7 @@ bool FormGroup::IntersectionOfTypesHasEqualValues( for (FieldTypeSet::const_iterator iter = intersection.begin(); iter != intersection.end(); ++iter) { - if (GetFieldText(*iter) != form_group.GetFieldText(*iter)) + if (GetInfo(*iter) != form_group.GetInfo(*iter)) return false; } @@ -74,7 +74,7 @@ void FormGroup::MergeWith(const FormGroup& form_group) { for (FieldTypeSet::const_iterator iter = intersection.begin(); iter != intersection.end(); ++iter) { - SetInfo(*iter, form_group.GetFieldText(*iter)); + SetInfo(*iter, form_group.GetInfo(*iter)); } } @@ -83,6 +83,6 @@ void FormGroup::OverwriteWith(const FormGroup& form_group) { form_group.GetAvailableFieldTypes(&a); for (FieldTypeSet::const_iterator iter = a.begin(); iter != a.end(); ++iter) { - SetInfo(*iter, form_group.GetFieldText(*iter)); + SetInfo(*iter, form_group.GetInfo(*iter)); } } diff --git a/chrome/browser/autofill/form_group.h b/chrome/browser/autofill/form_group.h index a7517d0..a713db0 100644 --- a/chrome/browser/autofill/form_group.h +++ b/chrome/browser/autofill/form_group.h @@ -31,7 +31,7 @@ class FormGroup { // Returns the string that should be auto-filled into a text field given the // type of that field. - virtual string16 GetFieldText(AutofillFieldType type) const = 0; + virtual string16 GetInfo(AutofillFieldType type) const = 0; // Returns the text for preview. virtual string16 GetPreviewText(AutofillFieldType type) const; diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc index ba989cc..0f26238 100644 --- a/chrome/browser/autofill/personal_data_manager.cc +++ b/chrome/browser/autofill/personal_data_manager.cc @@ -98,10 +98,10 @@ bool IsValidZip(const string16& value) { // filled. No verification of validity of the contents is preformed. This is // and existence check only. bool IsMinimumAddress(const AutofillProfile& profile) { - return !profile.GetFieldText(ADDRESS_HOME_LINE1).empty() && - !profile.GetFieldText(ADDRESS_HOME_CITY).empty() && - !profile.GetFieldText(ADDRESS_HOME_STATE).empty() && - !profile.GetFieldText(ADDRESS_HOME_ZIP).empty(); + return !profile.GetInfo(ADDRESS_HOME_LINE1).empty() && + !profile.GetInfo(ADDRESS_HOME_CITY).empty() && + !profile.GetInfo(ADDRESS_HOME_STATE).empty() && + !profile.GetInfo(ADDRESS_HOME_ZIP).empty(); } // Whether we have already logged the number of profiles this session. @@ -262,7 +262,7 @@ bool PersonalDataManager::ImportFormData( if (group == AutofillType::PHONE_FAX) number_type = PHONE_FAX_NUMBER; - string16 stored_number = imported_profile->GetFieldText(number_type); + string16 stored_number = imported_profile->GetInfo(number_type); if (stored_number.size() == static_cast<size_t>(PhoneNumber::kPrefixLength) && value.size() == static_cast<size_t>(PhoneNumber::kSuffixLength)) { @@ -297,7 +297,7 @@ bool PersonalDataManager::ImportFormData( } if (local_imported_credit_card.get() && - !CreditCard::IsCreditCardNumber(local_imported_credit_card->GetFieldText( + !CreditCard::IsCreditCardNumber(local_imported_credit_card->GetInfo( CREDIT_CARD_NUMBER))) { local_imported_credit_card.reset(); } @@ -658,19 +658,19 @@ bool PersonalDataManager::IsValidLearnableProfile( if (!IsMinimumAddress(profile)) return false; - string16 email = profile.GetFieldText(EMAIL_ADDRESS); + string16 email = profile.GetInfo(EMAIL_ADDRESS); if (!email.empty() && !IsValidEmail(email)) return false; // Reject profiles with invalid US state information. - string16 state = profile.GetFieldText(ADDRESS_HOME_STATE); + string16 state = profile.GetInfo(ADDRESS_HOME_STATE); if (profile.CountryCode() == "US" && !state.empty() && !autofill::IsValidState(state)) { return false; } // Reject profiles with invalid US zip information. - string16 zip = profile.GetFieldText(ADDRESS_HOME_ZIP); + string16 zip = profile.GetInfo(ADDRESS_HOME_ZIP); if (profile.CountryCode() == "US" && !zip.empty() && !IsValidZip(zip)) return false; diff --git a/chrome/browser/autofill/phone_number.cc b/chrome/browser/autofill/phone_number.cc index d41e60d..43634d8 100644 --- a/chrome/browser/autofill/phone_number.cc +++ b/chrome/browser/autofill/phone_number.cc @@ -92,7 +92,7 @@ void PhoneNumber::GetAvailableFieldTypes(FieldTypeSet* available_types) const { available_types->insert(GetWholeNumberType()); } -string16 PhoneNumber::GetFieldText(AutofillFieldType type) const { +string16 PhoneNumber::GetInfo(AutofillFieldType type) const { if (type == GetNumberType()) return number(); diff --git a/chrome/browser/autofill/phone_number.h b/chrome/browser/autofill/phone_number.h index 6283f85..5457022 100644 --- a/chrome/browser/autofill/phone_number.h +++ b/chrome/browser/autofill/phone_number.h @@ -29,7 +29,7 @@ class PhoneNumber : public FormGroup { virtual void FindInfoMatches(AutofillFieldType type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(AutofillFieldType type) const; + virtual string16 GetInfo(AutofillFieldType type) const; virtual void SetInfo(AutofillFieldType type, const string16& value); // Parses |value| to extract the components of a phone number. |number| diff --git a/chrome/browser/autofill/select_control_handler.cc b/chrome/browser/autofill/select_control_handler.cc index 3064be0..b2b7d1a 100644 --- a/chrome/browser/autofill/select_control_handler.cc +++ b/chrome/browser/autofill/select_control_handler.cc @@ -203,7 +203,7 @@ void FillSelectControl(const FormGroup& form_group, DCHECK(field); DCHECK_EQ(ASCIIToUTF16("select-one"), field->form_control_type); - string16 field_text = form_group.GetFieldText(type); + string16 field_text = form_group.GetInfo(type); if (field_text.empty()) return; |