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 | |
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
28 files changed, 208 insertions, 215 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; diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 3f44dbf..b9442ed 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -4204,7 +4204,7 @@ ListValue* TestingAutomationProvider::GetListFromAutofillProfiles( for (std::map<AutofillFieldType, std::string>::iterator type_it = autofill_type_to_string.begin(); type_it != autofill_type_to_string.end(); ++type_it) { - string16 value = profile->GetFieldText(type_it->first); + string16 value = profile->GetInfo(type_it->first); if (value.length()) { // If there was something stored for that value. profile_info->SetString(type_it->second, value); } @@ -4232,7 +4232,7 @@ ListValue* TestingAutomationProvider::GetListFromCreditCards( for (std::map<AutofillFieldType, std::string>::iterator type_it = credit_card_type_to_string.begin(); type_it != credit_card_type_to_string.end(); ++type_it) { - string16 value = card->GetFieldText(type_it->first); + string16 value = card->GetInfo(type_it->first); // If there was something stored for that value. if (value.length()) { card_info->SetString(type_it->second, value); diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc index 067f92a..134fea4 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_model_associator.cc @@ -243,8 +243,8 @@ bool AutofillModelAssociator::TraverseAndAssociateAllSyncNodes( all_profiles_from_db.begin(); ix != all_profiles_from_db.end(); ++ix) { AutofillProfile* p = *ix; VLOG(2) << "[AUTOFILL MIGRATION] " - << p->GetFieldText(NAME_FIRST) - << p->GetFieldText(NAME_LAST); + << p->GetInfo(NAME_FIRST) + << p->GetInfo(NAME_LAST); } } @@ -498,7 +498,7 @@ bool AutofillModelAssociator::MergeTimestamps( // the local value if they differ, and return whether the merge happened. bool MergeField(FormGroup* f, AutofillFieldType t, const std::string& specifics_field) { - if (UTF16ToUTF8(f->GetFieldText(t)) == specifics_field) + if (UTF16ToUTF8(f->GetInfo(t)) == specifics_field) return false; f->SetInfo(t, UTF8ToUTF16(specifics_field)); return true; diff --git a/chrome/browser/sync/glue/autofill_profile_change_processor.cc b/chrome/browser/sync/glue/autofill_profile_change_processor.cc index 7f4d962..ecd3cae 100644 --- a/chrome/browser/sync/glue/autofill_profile_change_processor.cc +++ b/chrome/browser/sync/glue/autofill_profile_change_processor.cc @@ -326,26 +326,26 @@ void AutofillProfileChangeProcessor::WriteAutofillProfile( DCHECK(guid::IsValidGUID(profile.guid())); specifics.set_guid(profile.guid()); - specifics.set_name_first(UTF16ToUTF8(profile.GetFieldText(NAME_FIRST))); - specifics.set_name_middle(UTF16ToUTF8(profile.GetFieldText(NAME_MIDDLE))); - specifics.set_name_last(UTF16ToUTF8(profile.GetFieldText(NAME_LAST))); + specifics.set_name_first(UTF16ToUTF8(profile.GetInfo(NAME_FIRST))); + specifics.set_name_middle(UTF16ToUTF8(profile.GetInfo(NAME_MIDDLE))); + specifics.set_name_last(UTF16ToUTF8(profile.GetInfo(NAME_LAST))); specifics.set_address_home_line1( - UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_LINE1))); + UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_LINE1))); specifics.set_address_home_line2( - UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_LINE2))); - specifics.set_address_home_city(UTF16ToUTF8(profile.GetFieldText( + UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_LINE2))); + specifics.set_address_home_city(UTF16ToUTF8(profile.GetInfo( ADDRESS_HOME_CITY))); - specifics.set_address_home_state(UTF16ToUTF8(profile.GetFieldText( + specifics.set_address_home_state(UTF16ToUTF8(profile.GetInfo( ADDRESS_HOME_STATE))); - specifics.set_address_home_country(UTF16ToUTF8(profile.GetFieldText( + specifics.set_address_home_country(UTF16ToUTF8(profile.GetInfo( ADDRESS_HOME_COUNTRY))); - specifics.set_address_home_zip(UTF16ToUTF8(profile.GetFieldText( + specifics.set_address_home_zip(UTF16ToUTF8(profile.GetInfo( ADDRESS_HOME_ZIP))); - specifics.set_email_address(UTF16ToUTF8(profile.GetFieldText(EMAIL_ADDRESS))); - specifics.set_company_name(UTF16ToUTF8(profile.GetFieldText(COMPANY_NAME))); - specifics.set_phone_fax_whole_number(UTF16ToUTF8(profile.GetFieldText( + specifics.set_email_address(UTF16ToUTF8(profile.GetInfo(EMAIL_ADDRESS))); + specifics.set_company_name(UTF16ToUTF8(profile.GetInfo(COMPANY_NAME))); + specifics.set_phone_fax_whole_number(UTF16ToUTF8(profile.GetInfo( PHONE_FAX_WHOLE_NUMBER))); - specifics.set_phone_home_whole_number(UTF16ToUTF8(profile.GetFieldText( + specifics.set_phone_home_whole_number(UTF16ToUTF8(profile.GetInfo( PHONE_HOME_WHOLE_NUMBER))); node->SetAutofillProfileSpecifics(specifics); } diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.cc b/chrome/browser/sync/glue/autofill_profile_model_associator.cc index c609510..440f9fa 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_profile_model_associator.cc @@ -62,8 +62,8 @@ bool AutofillProfileModelAssociator::TraverseAndAssociateChromeAutofillProfiles( all_profiles_from_db.begin(); ix != all_profiles_from_db.end(); ++ix) { AutofillProfile* p = *ix; VLOG(2) << "[AUTOFILL MIGRATION] " - << p->GetFieldText(NAME_FIRST) - << p->GetFieldText(NAME_LAST) + << p->GetInfo(NAME_FIRST) + << p->GetInfo(NAME_LAST) << p->guid(); } } @@ -90,8 +90,8 @@ bool AutofillProfileModelAssociator::TraverseAndAssociateChromeAutofillProfiles( current_profiles->find(guid) == current_profiles->end()) { VLOG(2) << "[AUTOFILL MIGRATION]" << " Found in sync db: " - << (*ix)->GetFieldText(NAME_FIRST) - << (*ix)->GetFieldText(NAME_LAST) + << (*ix)->GetInfo(NAME_FIRST) + << (*ix)->GetInfo(NAME_LAST) << (*ix)->guid() << " so associating with node id " << node.GetId(); const sync_pb::AutofillProfileSpecifics& autofill( @@ -210,7 +210,7 @@ bool AutofillProfileModelAssociator::DisassociateModels() { bool AutofillProfileModelAssociator::MergeField(FormGroup* f, AutofillFieldType t, const std::string& specifics_field) { - if (UTF16ToUTF8(f->GetFieldText(t)) == specifics_field) + if (UTF16ToUTF8(f->GetInfo(t)) == specifics_field) return false; f->SetInfo(t, UTF8ToUTF16(specifics_field)); return true; @@ -323,8 +323,8 @@ bool AutofillProfileModelAssociator::MakeNewAutofillProfileSyncNodeIfNeeded( current_profiles->insert(autofill_specifics.guid()); VLOG(2) << "[AUTOFILL MIGRATION]" << "Found in sync db but with a different guid: " - << UTF16ToUTF8(profile.GetFieldText(NAME_FIRST)) - << UTF16ToUTF8(profile.GetFieldText(NAME_LAST)) + << UTF16ToUTF8(profile.GetInfo(NAME_FIRST)) + << UTF16ToUTF8(profile.GetInfo(NAME_LAST)) << "New guid " << autofill_specifics.guid() << " sync node id " << sync_node_id << " so associating. Profile to be deleted " << profile.guid(); @@ -342,8 +342,8 @@ bool AutofillProfileModelAssociator::MakeNewAutofillProfileSyncNodeIfNeeded( node.SetTitle(UTF8ToWide(profile.guid())); VLOG(2) << "[AUTOFILL MIGRATION]" << "NOT Found in sync db " - << UTF16ToUTF8(profile.GetFieldText(NAME_FIRST)) - << UTF16ToUTF8(profile.GetFieldText(NAME_LAST)) + << UTF16ToUTF8(profile.GetInfo(NAME_FIRST)) + << UTF16ToUTF8(profile.GetInfo(NAME_LAST)) << profile.guid() << " so creating a new sync node. Sync node id " << node.GetId(); diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc b/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc index 81b213e..e1792a6 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc +++ b/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc @@ -254,7 +254,7 @@ TEST_F(AutofillProfileModelAssociatorTest, TestNeedToAddNativeProfile) { read_node); EXPECT_EQ(bundle.new_profiles.size(), (unsigned int)1); - EXPECT_EQ(bundle.new_profiles.front()->GetFieldText(NAME_FIRST), + EXPECT_EQ(bundle.new_profiles.front()->GetInfo(NAME_FIRST), UTF8ToUTF16(first_name)); } diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc index d5962ed..f06533e 100644 --- a/chrome/browser/ui/webui/options/autofill_options_handler.cc +++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc @@ -266,17 +266,17 @@ void AutoFillOptionsHandler::LoadAddressEditor(const ListValue* args) { DictionaryValue address; address.SetString("guid", profile->guid()); - address.SetString("fullName", profile->GetFieldText(NAME_FULL)); - address.SetString("companyName", profile->GetFieldText(COMPANY_NAME)); - address.SetString("addrLine1", profile->GetFieldText(ADDRESS_HOME_LINE1)); - address.SetString("addrLine2", profile->GetFieldText(ADDRESS_HOME_LINE2)); - address.SetString("city", profile->GetFieldText(ADDRESS_HOME_CITY)); - address.SetString("state", profile->GetFieldText(ADDRESS_HOME_STATE)); - address.SetString("postalCode", profile->GetFieldText(ADDRESS_HOME_ZIP)); + address.SetString("fullName", profile->GetInfo(NAME_FULL)); + address.SetString("companyName", profile->GetInfo(COMPANY_NAME)); + address.SetString("addrLine1", profile->GetInfo(ADDRESS_HOME_LINE1)); + address.SetString("addrLine2", profile->GetInfo(ADDRESS_HOME_LINE2)); + address.SetString("city", profile->GetInfo(ADDRESS_HOME_CITY)); + address.SetString("state", profile->GetInfo(ADDRESS_HOME_STATE)); + address.SetString("postalCode", profile->GetInfo(ADDRESS_HOME_ZIP)); address.SetString("country", profile->CountryCode()); - address.SetString("phone", profile->GetFieldText(PHONE_HOME_WHOLE_NUMBER)); - address.SetString("fax", profile->GetFieldText(PHONE_FAX_WHOLE_NUMBER)); - address.SetString("email", profile->GetFieldText(EMAIL_ADDRESS)); + address.SetString("phone", profile->GetInfo(PHONE_HOME_WHOLE_NUMBER)); + address.SetString("fax", profile->GetInfo(PHONE_FAX_WHOLE_NUMBER)); + address.SetString("email", profile->GetInfo(EMAIL_ADDRESS)); web_ui_->CallJavascriptFunction("AutoFillOptions.editAddress", address); } @@ -303,14 +303,14 @@ void AutoFillOptionsHandler::LoadCreditCardEditor(const ListValue* args) { DictionaryValue credit_card_data; credit_card_data.SetString("guid", credit_card->guid()); credit_card_data.SetString("nameOnCard", - credit_card->GetFieldText(CREDIT_CARD_NAME)); + credit_card->GetInfo(CREDIT_CARD_NAME)); credit_card_data.SetString("creditCardNumber", - credit_card->GetFieldText(CREDIT_CARD_NUMBER)); + credit_card->GetInfo(CREDIT_CARD_NUMBER)); credit_card_data.SetString("expirationMonth", - credit_card->GetFieldText(CREDIT_CARD_EXP_MONTH)); + credit_card->GetInfo(CREDIT_CARD_EXP_MONTH)); credit_card_data.SetString( "expirationYear", - credit_card->GetFieldText(CREDIT_CARD_EXP_4_DIGIT_YEAR)); + credit_card->GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)); web_ui_->CallJavascriptFunction("AutoFillOptions.editCreditCard", credit_card_data); diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index 7e6c922..a69ce86 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -293,19 +293,19 @@ void BindAutofillProfileToStatement(const AutofillProfile& profile, DCHECK(guid::IsValidGUID(profile.guid())); s->BindString(0, profile.guid()); - string16 text = profile.GetFieldText(COMPANY_NAME); + string16 text = profile.GetInfo(COMPANY_NAME); s->BindString16(1, LimitDataSize(text)); - text = profile.GetFieldText(ADDRESS_HOME_LINE1); + text = profile.GetInfo(ADDRESS_HOME_LINE1); s->BindString16(2, LimitDataSize(text)); - text = profile.GetFieldText(ADDRESS_HOME_LINE2); + text = profile.GetInfo(ADDRESS_HOME_LINE2); s->BindString16(3, LimitDataSize(text)); - text = profile.GetFieldText(ADDRESS_HOME_CITY); + text = profile.GetInfo(ADDRESS_HOME_CITY); s->BindString16(4, LimitDataSize(text)); - text = profile.GetFieldText(ADDRESS_HOME_STATE); + text = profile.GetInfo(ADDRESS_HOME_STATE); s->BindString16(5, LimitDataSize(text)); - text = profile.GetFieldText(ADDRESS_HOME_ZIP); + text = profile.GetInfo(ADDRESS_HOME_ZIP); s->BindString16(6, LimitDataSize(text)); - text = profile.GetFieldText(ADDRESS_HOME_COUNTRY); + text = profile.GetInfo(ADDRESS_HOME_COUNTRY); s->BindString16(7, LimitDataSize(text)); std::string country_code = profile.CountryCode(); s->BindString(8, country_code); @@ -369,13 +369,13 @@ void BindCreditCardToStatement(const CreditCard& credit_card, DCHECK(guid::IsValidGUID(credit_card.guid())); s->BindString(0, credit_card.guid()); - string16 text = credit_card.GetFieldText(CREDIT_CARD_NAME); + string16 text = credit_card.GetInfo(CREDIT_CARD_NAME); s->BindString16(1, LimitDataSize(text)); - text = credit_card.GetFieldText(CREDIT_CARD_EXP_MONTH); + text = credit_card.GetInfo(CREDIT_CARD_EXP_MONTH); s->BindString16(2, LimitDataSize(text)); - text = credit_card.GetFieldText(CREDIT_CARD_EXP_4_DIGIT_YEAR); + text = credit_card.GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR); s->BindString16(3, LimitDataSize(text)); - text = credit_card.GetFieldText(CREDIT_CARD_NUMBER); + text = credit_card.GetInfo(CREDIT_CARD_NUMBER); std::string encrypted_data; Encryptor::EncryptString16(text, &encrypted_data); s->BindBlob(4, encrypted_data.data(), @@ -409,9 +409,9 @@ CreditCard* CreditCardFromStatement(const sql::Statement& s) { } bool AutofillProfileHasName(const AutofillProfile& profile) { - return !profile.GetFieldText(NAME_FIRST).empty() || - !profile.GetFieldText(NAME_MIDDLE).empty() || - !profile.GetFieldText(NAME_MIDDLE).empty(); + return !profile.GetInfo(NAME_FIRST).empty() || + !profile.GetInfo(NAME_MIDDLE).empty() || + !profile.GetInfo(NAME_MIDDLE).empty(); } bool AddAutofillProfileName(const std::string& guid, @@ -430,9 +430,9 @@ bool AddAutofillProfileName(const std::string& guid, return false; } s_find.BindString(0, guid); - s_find.BindString16(1, profile.GetFieldText(NAME_FIRST)); - s_find.BindString16(2, profile.GetFieldText(NAME_MIDDLE)); - s_find.BindString16(3, profile.GetFieldText(NAME_LAST)); + s_find.BindString16(1, profile.GetInfo(NAME_FIRST)); + s_find.BindString16(2, profile.GetInfo(NAME_MIDDLE)); + s_find.BindString16(3, profile.GetInfo(NAME_LAST)); if (!s_find.Step()) { // Add the new name. @@ -445,9 +445,9 @@ bool AddAutofillProfileName(const std::string& guid, return false; } s.BindString(0, guid); - s.BindString16(1, profile.GetFieldText(NAME_FIRST)); - s.BindString16(2, profile.GetFieldText(NAME_MIDDLE)); - s.BindString16(3, profile.GetFieldText(NAME_LAST)); + s.BindString16(1, profile.GetInfo(NAME_FIRST)); + s.BindString16(2, profile.GetInfo(NAME_MIDDLE)); + s.BindString16(3, profile.GetInfo(NAME_LAST)); if (!s.Run()) { NOTREACHED(); @@ -460,7 +460,7 @@ bool AddAutofillProfileName(const std::string& guid, bool AddAutofillProfileEmail(const std::string& guid, const AutofillProfile& profile, sql::Connection* db) { - if (profile.GetFieldText(EMAIL_ADDRESS).empty()) + if (profile.GetInfo(EMAIL_ADDRESS).empty()) return true; // Check for duplicate. @@ -473,7 +473,7 @@ bool AddAutofillProfileEmail(const std::string& guid, return false; } s_find.BindString(0, guid); - s_find.BindString16(1, profile.GetFieldText(EMAIL_ADDRESS)); + s_find.BindString16(1, profile.GetInfo(EMAIL_ADDRESS)); if (!s_find.Step()) { sql::Statement s(db->GetUniqueStatement( @@ -485,7 +485,7 @@ bool AddAutofillProfileEmail(const std::string& guid, return false; } s.BindString(0, guid); - s.BindString16(1, profile.GetFieldText(EMAIL_ADDRESS)); + s.BindString16(1, profile.GetInfo(EMAIL_ADDRESS)); if (!s.Run()) { NOTREACHED(); @@ -509,7 +509,7 @@ bool AddAutofillProfilePhone(const std::string& guid, return false; } - if (profile.GetFieldText(field_type).empty()) + if (profile.GetInfo(field_type).empty()) return true; // Check for duplicate. @@ -523,8 +523,7 @@ bool AddAutofillProfilePhone(const std::string& guid, } s_find.BindString(0, guid); s_find.BindInt(1, phone_type); - s_find.BindString16( - 2, profile.GetFieldText(field_type)); + s_find.BindString16(2, profile.GetInfo(field_type)); if (!s_find.Step()) { sql::Statement s(db->GetUniqueStatement( @@ -537,8 +536,7 @@ bool AddAutofillProfilePhone(const std::string& guid, } s.BindString(0, guid); s.BindInt(1, phone_type); - s.BindString16( - 2, profile.GetFieldText(field_type)); + s.BindString16(2, profile.GetInfo(field_type)); if (!s.Run()) { NOTREACHED(); @@ -3090,14 +3088,13 @@ sql::InitStatus WebDatabase::MigrateOldVersionsAsNeeded(){ return sql::INIT_FAILURE; } s_insert.BindString(0, profile.guid()); - s_insert.BindString16(1, profile.GetFieldText(COMPANY_NAME)); - s_insert.BindString16(2, profile.GetFieldText(ADDRESS_HOME_LINE1)); - s_insert.BindString16(3, profile.GetFieldText(ADDRESS_HOME_LINE2)); - s_insert.BindString16(4, profile.GetFieldText(ADDRESS_HOME_CITY)); - s_insert.BindString16(5, profile.GetFieldText(ADDRESS_HOME_STATE)); - s_insert.BindString16(6, profile.GetFieldText(ADDRESS_HOME_ZIP)); - s_insert.BindString16(7, - profile.GetFieldText(ADDRESS_HOME_COUNTRY)); + s_insert.BindString16(1, profile.GetInfo(COMPANY_NAME)); + s_insert.BindString16(2, profile.GetInfo(ADDRESS_HOME_LINE1)); + s_insert.BindString16(3, profile.GetInfo(ADDRESS_HOME_LINE2)); + s_insert.BindString16(4, profile.GetInfo(ADDRESS_HOME_CITY)); + s_insert.BindString16(5, profile.GetInfo(ADDRESS_HOME_STATE)); + s_insert.BindString16(6, profile.GetInfo(ADDRESS_HOME_ZIP)); + s_insert.BindString16(7, profile.GetInfo(ADDRESS_HOME_COUNTRY)); s_insert.BindInt64(8, date_modified); if (!s_insert.Run()) { diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index f528e90..ac0ac1f 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -1585,7 +1585,7 @@ TEST_F(WebDatabaseTest, AutofillProfileTrashInteraction) { AutofillProfile* updated_profile = NULL; EXPECT_TRUE(db.GetAutofillProfile(profile.guid(), &updated_profile)); ASSERT_NE(static_cast<AutofillProfile*>(NULL), added_profile); - EXPECT_EQ(ASCIIToUTF16("John"), updated_profile->GetFieldText(NAME_FIRST)); + EXPECT_EQ(ASCIIToUTF16("John"), updated_profile->GetInfo(NAME_FIRST)); delete updated_profile; // Try to delete the trashed profile. This stops |RemoveAutofillProfile| from @@ -2847,20 +2847,20 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) { EXPECT_NO_FATAL_FAILURE(AutofillProfile33FromStatement( s1, &profile_a, &profile_date_modified_a)); EXPECT_EQ(profile.guid(), profile_a.guid()); - EXPECT_EQ(profile.GetFieldText(COMPANY_NAME), - profile_a.GetFieldText(COMPANY_NAME)); - EXPECT_EQ(profile.GetFieldText(ADDRESS_HOME_LINE1), - profile_a.GetFieldText(ADDRESS_HOME_LINE1)); - EXPECT_EQ(profile.GetFieldText(ADDRESS_HOME_LINE2), - profile_a.GetFieldText(ADDRESS_HOME_LINE2)); - EXPECT_EQ(profile.GetFieldText(ADDRESS_HOME_CITY), - profile_a.GetFieldText(ADDRESS_HOME_CITY)); - EXPECT_EQ(profile.GetFieldText(ADDRESS_HOME_STATE), - profile_a.GetFieldText(ADDRESS_HOME_STATE)); - EXPECT_EQ(profile.GetFieldText(ADDRESS_HOME_ZIP), - profile_a.GetFieldText(ADDRESS_HOME_ZIP)); - EXPECT_EQ(profile.GetFieldText(ADDRESS_HOME_COUNTRY), - profile_a.GetFieldText(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(profile.GetInfo(COMPANY_NAME), + profile_a.GetInfo(COMPANY_NAME)); + EXPECT_EQ(profile.GetInfo(ADDRESS_HOME_LINE1), + profile_a.GetInfo(ADDRESS_HOME_LINE1)); + EXPECT_EQ(profile.GetInfo(ADDRESS_HOME_LINE2), + profile_a.GetInfo(ADDRESS_HOME_LINE2)); + EXPECT_EQ(profile.GetInfo(ADDRESS_HOME_CITY), + profile_a.GetInfo(ADDRESS_HOME_CITY)); + EXPECT_EQ(profile.GetInfo(ADDRESS_HOME_STATE), + profile_a.GetInfo(ADDRESS_HOME_STATE)); + EXPECT_EQ(profile.GetInfo(ADDRESS_HOME_ZIP), + profile_a.GetInfo(ADDRESS_HOME_ZIP)); + EXPECT_EQ(profile.GetInfo(ADDRESS_HOME_COUNTRY), + profile_a.GetInfo(ADDRESS_HOME_COUNTRY)); EXPECT_EQ(profile_date_modified, profile_date_modified_a); sql::Statement s2( |