diff options
61 files changed, 818 insertions, 817 deletions
diff --git a/chrome/browser/autofill/address.cc b/chrome/browser/autofill/address.cc index 7a5a60e..59d1b1e 100644 --- a/chrome/browser/autofill/address.cc +++ b/chrome/browser/autofill/address.cc @@ -14,13 +14,13 @@ namespace { const char16 kAddressSplitChars[] = {'-', ',', '#', '.', ' ', 0}; -const AutoFillType::FieldTypeSubGroup kAutoFillAddressTypes[] = { - AutoFillType::ADDRESS_LINE1, - AutoFillType::ADDRESS_LINE2, - AutoFillType::ADDRESS_CITY, - AutoFillType::ADDRESS_STATE, - AutoFillType::ADDRESS_ZIP, - AutoFillType::ADDRESS_COUNTRY, +const AutofillType::FieldTypeSubGroup kAutoFillAddressTypes[] = { + AutofillType::ADDRESS_LINE1, + AutofillType::ADDRESS_LINE2, + AutofillType::ADDRESS_CITY, + AutofillType::ADDRESS_STATE, + AutofillType::ADDRESS_ZIP, + AutofillType::ADDRESS_COUNTRY, }; const int kAutoFillAddressLength = arraysize(kAutoFillAddressTypes); @@ -85,7 +85,7 @@ void Address::GetAvailableFieldTypes(FieldTypeSet* available_types) const { available_types->insert(ADDRESS_HOME_COUNTRY); } -void Address::FindInfoMatches(const AutoFillType& type, +void Address::FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const { DCHECK(matched_text); @@ -102,7 +102,7 @@ void Address::FindInfoMatches(const AutoFillType& type, } } -string16 Address::GetFieldText(const AutoFillType& type) const { +string16 Address::GetFieldText(const AutofillType& type) const { AutofillFieldType field_type = type.field_type(); if (field_type == ADDRESS_HOME_LINE1) return line1_; @@ -125,19 +125,19 @@ string16 Address::GetFieldText(const AutoFillType& type) const { return string16(); } -void Address::SetInfo(const AutoFillType& type, const string16& value) { +void Address::SetInfo(const AutofillType& type, const string16& value) { FieldTypeSubGroup subgroup = type.subgroup(); - if (subgroup == AutoFillType::ADDRESS_LINE1) + if (subgroup == AutofillType::ADDRESS_LINE1) set_line1(value); - else if (subgroup == AutoFillType::ADDRESS_LINE2) + else if (subgroup == AutofillType::ADDRESS_LINE2) set_line2(value); - else if (subgroup == AutoFillType::ADDRESS_CITY) + else if (subgroup == AutofillType::ADDRESS_CITY) city_ = value; - else if (subgroup == AutoFillType::ADDRESS_STATE) + else if (subgroup == AutofillType::ADDRESS_STATE) state_ = value; - else if (subgroup == AutoFillType::ADDRESS_COUNTRY) + else if (subgroup == AutofillType::ADDRESS_COUNTRY) SetCountry(value); - else if (subgroup == AutoFillType::ADDRESS_ZIP) + else if (subgroup == AutofillType::ADDRESS_ZIP) zip_code_ = value; else NOTREACHED(); @@ -229,22 +229,22 @@ bool Address::FindInfoMatchesHelper(const FieldTypeSubGroup& subgroup, DCHECK(match); match->clear(); - if (subgroup == AutoFillType::ADDRESS_LINE1 && + if (subgroup == AutofillType::ADDRESS_LINE1 && StartsWith(line1_, info, false)) { *match = line1_; - } else if (subgroup == AutoFillType::ADDRESS_LINE2 && + } else if (subgroup == AutofillType::ADDRESS_LINE2 && StartsWith(line2_, info, false)) { *match = line2_; - } else if (subgroup == AutoFillType::ADDRESS_CITY && + } else if (subgroup == AutofillType::ADDRESS_CITY && StartsWith(city_, info, false)) { *match = city_; - } else if (subgroup == AutoFillType::ADDRESS_STATE && + } else if (subgroup == AutofillType::ADDRESS_STATE && StartsWith(state_, info, false)) { *match = state_; - } else if (subgroup == AutoFillType::ADDRESS_COUNTRY && + } else if (subgroup == AutofillType::ADDRESS_COUNTRY && StartsWith(Country(), info, false)) { *match = Country(); - } else if (subgroup == AutoFillType::ADDRESS_ZIP && + } else if (subgroup == AutofillType::ADDRESS_ZIP && StartsWith(zip_code_, info, true)) { *match = zip_code_; } diff --git a/chrome/browser/autofill/address.h b/chrome/browser/autofill/address.h index 219234a..8040c69 100644 --- a/chrome/browser/autofill/address.h +++ b/chrome/browser/autofill/address.h @@ -23,11 +23,11 @@ class Address : public FormGroup { virtual void GetPossibleFieldTypes(const string16& text, FieldTypeSet* possible_types) const; virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; - virtual void FindInfoMatches(const AutoFillType& type, + virtual void FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(const AutoFillType& type) const; - virtual void SetInfo(const AutoFillType& type, const string16& value); + virtual string16 GetFieldText(const AutofillType& type) const; + virtual void SetInfo(const AutofillType& type, const string16& value); const std::string& country_code() const { return country_code_; } void set_country_code(const std::string& country_code) { diff --git a/chrome/browser/autofill/address_field.cc b/chrome/browser/autofill/address_field.cc index 3bb3c21..06fb859 100644 --- a/chrome/browser/autofill/address_field.cc +++ b/chrome/browser/autofill/address_field.cc @@ -51,19 +51,19 @@ bool AddressField::GetFieldInfo(FieldTypeMap* field_type_map) const { } bool ok; - ok = Add(field_type_map, company_, AutoFillType(address_company)); + ok = Add(field_type_map, company_, AutofillType(address_company)); DCHECK(ok); - ok = ok && Add(field_type_map, address1_, AutoFillType(address_line1)); + ok = ok && Add(field_type_map, address1_, AutofillType(address_line1)); DCHECK(ok); - ok = ok && Add(field_type_map, address2_, AutoFillType(address_line2)); + ok = ok && Add(field_type_map, address2_, AutofillType(address_line2)); DCHECK(ok); - ok = ok && Add(field_type_map, city_, AutoFillType(address_city)); + ok = ok && Add(field_type_map, city_, AutofillType(address_city)); DCHECK(ok); - ok = ok && Add(field_type_map, state_, AutoFillType(address_state)); + ok = ok && Add(field_type_map, state_, AutofillType(address_state)); DCHECK(ok); - ok = ok && Add(field_type_map, zip_, AutoFillType(address_zip)); + ok = ok && Add(field_type_map, zip_, AutofillType(address_zip)); DCHECK(ok); - ok = ok && Add(field_type_map, country_, AutoFillType(address_country)); + ok = ok && Add(field_type_map, country_, AutofillType(address_country)); DCHECK(ok); return ok; diff --git a/chrome/browser/autofill/address_unittest.cc b/chrome/browser/autofill/address_unittest.cc index fd85121..11ae945 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(AutoFillType(ADDRESS_HOME_COUNTRY)); + string16 country = address.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); EXPECT_EQ(string16(), country); address.set_country_code("US"); - country = address.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)); + country = address.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); EXPECT_EQ(ASCIIToUTF16("United States"), country); address.set_country_code("CA"); - country = address.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)); + country = address.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); EXPECT_EQ(ASCIIToUTF16("Canada"), country); } @@ -46,33 +46,33 @@ TEST(AddressTest, SetCountry) { EXPECT_EQ(std::string(), address.country_code()); // Test basic conversion. - address.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), + address.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("United States")); - string16 country = address.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)); + string16 country = address.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); EXPECT_EQ("US", address.country_code()); EXPECT_EQ(ASCIIToUTF16("United States"), country); // Test basic synonym detection. - address.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("USA")); - country = address.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)); + address.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("USA")); + country = address.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); EXPECT_EQ("US", address.country_code()); EXPECT_EQ(ASCIIToUTF16("United States"), country); // Test case-insensitivity. - address.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("canADA")); - country = address.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)); + address.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("canADA")); + country = address.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); EXPECT_EQ("CA", address.country_code()); EXPECT_EQ(ASCIIToUTF16("Canada"), country); // Test country code detection. - address.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("JP")); - country = address.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)); + address.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("JP")); + country = address.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); EXPECT_EQ("JP", address.country_code()); EXPECT_EQ(ASCIIToUTF16("Japan"), country); // Test that we ignore unknown countries. - address.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("Unknown")); - country = address.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)); + address.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("Unknown")); + country = address.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); EXPECT_EQ(std::string(), address.country_code()); EXPECT_EQ(string16(), country); } diff --git a/chrome/browser/autofill/autofill_address_model_mac.mm b/chrome/browser/autofill/autofill_address_model_mac.mm index 3b1623b..4a1d7c3 100644 --- a/chrome/browser/autofill/autofill_address_model_mac.mm +++ b/chrome/browser/autofill/autofill_address_model_mac.mm @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "chrome/browser/autofill/autofill_address_model_mac.h" #include "base/sys_string_conversions.h" +#import "chrome/browser/autofill/autofill_address_model_mac.h" #include "chrome/browser/autofill/autofill_profile.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -25,27 +25,27 @@ - (id)initWithProfile:(const AutoFillProfile&)profile { if ((self = [super init])) { [self setFullName:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(NAME_FULL)))]; + profile.GetFieldText(AutofillType(NAME_FULL)))]; [self setEmail:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(EMAIL_ADDRESS)))]; + profile.GetFieldText(AutofillType(EMAIL_ADDRESS)))]; [self setCompanyName:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(COMPANY_NAME)))]; + profile.GetFieldText(AutofillType(COMPANY_NAME)))]; [self setAddressLine1:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)))]; + profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1)))]; [self setAddressLine2:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)))]; + profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2)))]; [self setAddressCity:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY)))]; + profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY)))]; [self setAddressState:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE)))]; + profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE)))]; [self setAddressZip:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)))]; + profile.GetFieldText(AutofillType(ADDRESS_HOME_ZIP)))]; [self setAddressCountry:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)))]; + profile.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)))]; [self setPhoneWholeNumber:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER)))]; + profile.GetFieldText(AutofillType(PHONE_HOME_WHOLE_NUMBER)))]; [self setFaxWholeNumber:SysUTF16ToNSString( - profile.GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER)))]; + profile.GetFieldText(AutofillType(PHONE_FAX_WHOLE_NUMBER)))]; } return self; } @@ -67,27 +67,27 @@ - (void)copyModelToProfile:(AutoFillProfile*)profile { DCHECK(profile); - profile->SetInfo(AutoFillType(NAME_FULL), + profile->SetInfo(AutofillType(NAME_FULL), base::SysNSStringToUTF16([self fullName])); - profile->SetInfo(AutoFillType(EMAIL_ADDRESS), + profile->SetInfo(AutofillType(EMAIL_ADDRESS), base::SysNSStringToUTF16([self email])); - profile->SetInfo(AutoFillType(COMPANY_NAME), + profile->SetInfo(AutofillType(COMPANY_NAME), base::SysNSStringToUTF16([self companyName])); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1), base::SysNSStringToUTF16([self addressLine1])); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE2), + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE2), base::SysNSStringToUTF16([self addressLine2])); - profile->SetInfo(AutoFillType(ADDRESS_HOME_CITY), + profile->SetInfo(AutofillType(ADDRESS_HOME_CITY), base::SysNSStringToUTF16([self addressCity])); - profile->SetInfo(AutoFillType(ADDRESS_HOME_STATE), + profile->SetInfo(AutofillType(ADDRESS_HOME_STATE), base::SysNSStringToUTF16([self addressState])); - profile->SetInfo(AutoFillType(ADDRESS_HOME_ZIP), + profile->SetInfo(AutofillType(ADDRESS_HOME_ZIP), base::SysNSStringToUTF16([self addressZip])); - profile->SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), + profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), base::SysNSStringToUTF16([self addressCountry])); - profile->SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), + profile->SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), base::SysNSStringToUTF16([self phoneWholeNumber])); - profile->SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), + profile->SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), base::SysNSStringToUTF16([self faxWholeNumber])); } diff --git a/chrome/browser/autofill/autofill_address_model_mac_unittest.mm b/chrome/browser/autofill/autofill_address_model_mac_unittest.mm index 6299a4f..b1f50bf 100644 --- a/chrome/browser/autofill/autofill_address_model_mac_unittest.mm +++ b/chrome/browser/autofill/autofill_address_model_mac_unittest.mm @@ -92,33 +92,33 @@ TEST(AutoFillAddressModelTest, CopyModelToProfile) { [model copyModelToProfile:&profile]; EXPECT_EQ(ASCIIToUTF16("MarionX"), - profile.GetFieldText(AutoFillType(NAME_FIRST))); + profile.GetFieldText(AutofillType(NAME_FIRST))); EXPECT_EQ(ASCIIToUTF16("MitchellX"), - profile.GetFieldText(AutoFillType(NAME_MIDDLE))); + profile.GetFieldText(AutofillType(NAME_MIDDLE))); EXPECT_EQ(ASCIIToUTF16("MorrisonX"), - profile.GetFieldText(AutoFillType(NAME_LAST))); + profile.GetFieldText(AutofillType(NAME_LAST))); EXPECT_EQ(ASCIIToUTF16("MarionX MitchellX MorrisonX"), - profile.GetFieldText(AutoFillType(NAME_FULL))); + profile.GetFieldText(AutofillType(NAME_FULL))); EXPECT_EQ(ASCIIToUTF16("trigger@me.xyz"), - profile.GetFieldText(AutoFillType(EMAIL_ADDRESS))); + profile.GetFieldText(AutofillType(EMAIL_ADDRESS))); EXPECT_EQ(ASCIIToUTF16("FoxX"), - profile.GetFieldText(AutoFillType(COMPANY_NAME))); + profile.GetFieldText(AutofillType(COMPANY_NAME))); EXPECT_EQ(ASCIIToUTF16("123 Xoo St."), - profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1))); + profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1))); EXPECT_EQ(ASCIIToUTF16("unit 5X"), - profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2))); + profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2))); EXPECT_EQ(ASCIIToUTF16("Seattle"), - profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY))); + profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY))); EXPECT_EQ(ASCIIToUTF16("WA"), - profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE))); + profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE))); EXPECT_EQ(ASCIIToUTF16("81601"), - profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))); + profile.GetFieldText(AutofillType(ADDRESS_HOME_ZIP))); EXPECT_EQ(ASCIIToUTF16("Canada"), - profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))); + profile.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY))); EXPECT_EQ(ASCIIToUTF16("23346678910"), - profile.GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER))); + profile.GetFieldText(AutofillType(PHONE_HOME_WHOLE_NUMBER))); EXPECT_EQ(ASCIIToUTF16("12988654321"), - profile.GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER))); + profile.GetFieldText(AutofillType(PHONE_FAX_WHOLE_NUMBER))); } } // namespace diff --git a/chrome/browser/autofill/autofill_common_test.cc b/chrome/browser/autofill/autofill_common_test.cc index 5dea527..bc0cac9 100644 --- a/chrome/browser/autofill/autofill_common_test.cc +++ b/chrome/browser/autofill/autofill_common_test.cc @@ -28,7 +28,7 @@ void CreateTestFormField(const char* label, inline void check_and_set( FormGroup* profile, AutofillFieldType type, const char* value) { if (value) - profile->SetInfo(AutoFillType(type), ASCIIToUTF16(value)); + profile->SetInfo(AutofillType(type), ASCIIToUTF16(value)); } void SetProfileInfo(AutoFillProfile* profile, diff --git a/chrome/browser/autofill/autofill_credit_card_model_mac.mm b/chrome/browser/autofill/autofill_credit_card_model_mac.mm index 6c939ca..2f0e3c0 100644 --- a/chrome/browser/autofill/autofill_credit_card_model_mac.mm +++ b/chrome/browser/autofill/autofill_credit_card_model_mac.mm @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "chrome/browser/autofill/autofill_credit_card_model_mac.h" #include "base/sys_string_conversions.h" +#import "chrome/browser/autofill/autofill_credit_card_model_mac.h" #include "chrome/browser/autofill/credit_card.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -19,13 +19,13 @@ - (id)initWithCreditCard:(const CreditCard&)creditCard { if ((self = [super init])) { [self setNameOnCard:SysUTF16ToNSString( - creditCard.GetFieldText(AutoFillType(CREDIT_CARD_NAME)))]; + creditCard.GetFieldText(AutofillType(CREDIT_CARD_NAME)))]; [self setCreditCardNumber:SysUTF16ToNSString( - creditCard.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER)))]; + creditCard.GetFieldText(AutofillType(CREDIT_CARD_NUMBER)))]; [self setExpirationMonth:SysUTF16ToNSString( - creditCard.GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)))]; + creditCard.GetFieldText(AutofillType(CREDIT_CARD_EXP_MONTH)))]; [self setExpirationYear:SysUTF16ToNSString( - creditCard.GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)))]; + creditCard.GetFieldText(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)))]; } return self; } @@ -40,13 +40,13 @@ - (void)copyModelToCreditCard:(CreditCard*)creditCard { DCHECK(creditCard); - creditCard->SetInfo(AutoFillType(CREDIT_CARD_NAME), + creditCard->SetInfo(AutofillType(CREDIT_CARD_NAME), base::SysNSStringToUTF16([self nameOnCard])); - creditCard->SetInfo(AutoFillType(CREDIT_CARD_NUMBER), + creditCard->SetInfo(AutofillType(CREDIT_CARD_NUMBER), base::SysNSStringToUTF16([self creditCardNumber])); - creditCard->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), + creditCard->SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), base::SysNSStringToUTF16([self expirationMonth])); - creditCard->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + creditCard->SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), base::SysNSStringToUTF16([self expirationYear])); } diff --git a/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm b/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm index 90f9ef4..ad7a7e2 100644 --- a/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm +++ b/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm @@ -54,14 +54,14 @@ TEST(AutoFillCreditCardModelTest, CopyModelToCreditCard) { [model copyModelToCreditCard:&credit_card]; EXPECT_EQ(ASCIIToUTF16("John DillingerX"), - credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NAME))); + credit_card.GetFieldText(AutofillType(CREDIT_CARD_NAME))); EXPECT_EQ(ASCIIToUTF16("223456789012"), - credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER))); + credit_card.GetFieldText(AutofillType(CREDIT_CARD_NUMBER))); EXPECT_EQ(ASCIIToUTF16("11"), - credit_card.GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH))); + credit_card.GetFieldText(AutofillType(CREDIT_CARD_EXP_MONTH))); EXPECT_EQ(ASCIIToUTF16("2011"), credit_card.GetFieldText( - AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); + AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); } } // namespace diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm index 74f4249..1d02fad 100644 --- a/chrome/browser/autofill/autofill_dialog_controller_mac.mm +++ b/chrome/browser/autofill/autofill_dialog_controller_mac.mm @@ -1,28 +1,28 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "chrome/browser/autofill/autofill_dialog_controller_mac.h" #include "base/lazy_instance.h" #include "base/mac/mac_util.h" #include "base/sys_string_conversions.h" +#import "chrome/browser/autofill/autofill-inl.h" #import "chrome/browser/autofill/autofill_address_model_mac.h" #import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h" #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" #import "chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h" -#import "chrome/browser/autofill/autofill-inl.h" +#import "chrome/browser/autofill/autofill_dialog_controller_mac.h" #import "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/browser_process.h" -#import "chrome/browser/ui/cocoa/window_size_autosaver.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" +#import "chrome/browser/ui/cocoa/window_size_autosaver.h" #include "chrome/common/notification_details.h" #include "chrome/common/notification_observer.h" #include "chrome/common/pref_names.h" -#include "grit/generated_resources.h" #include "grit/app_resources.h" +#include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -920,9 +920,9 @@ class PreferenceObserver : public NotificationObserver { // have explicit validation method. More robust validation is needed as // well eventually. AutoFillProfile profile; - profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), + profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), base::SysNSStringToUTF16(string)); - if (profile.GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER)).empty()) { + if (profile.GetFieldText(AutofillType(PHONE_HOME_WHOLE_NUMBER)).empty()) { image = rb.GetNativeImageNamed(IDR_INPUT_ALERT); DCHECK(image); return image; diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm b/chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm index 6e885e3..0e7ccf7 100644 --- a/chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm +++ b/chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm @@ -208,23 +208,23 @@ TEST_F(AutoFillDialogControllerTest, NoEditsDoNotChangeObserverCreditCards) { TEST_F(AutoFillDialogControllerTest, AutoFillDataMutation) { AutoFillProfile profile; - profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("John")); - profile.SetInfo(AutoFillType(NAME_MIDDLE), ASCIIToUTF16("C")); - profile.SetInfo(AutoFillType(NAME_LAST), ASCIIToUTF16("Smith")); - profile.SetInfo(AutoFillType(EMAIL_ADDRESS), + profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("John")); + profile.SetInfo(AutofillType(NAME_MIDDLE), ASCIIToUTF16("C")); + profile.SetInfo(AutofillType(NAME_LAST), ASCIIToUTF16("Smith")); + profile.SetInfo(AutofillType(EMAIL_ADDRESS), ASCIIToUTF16("john@chromium.org")); - profile.SetInfo(AutoFillType(COMPANY_NAME), ASCIIToUTF16("Google Inc.")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + profile.SetInfo(AutofillType(COMPANY_NAME), ASCIIToUTF16("Google Inc.")); + profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("1122 Mountain View Road")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE2), ASCIIToUTF16("Suite #1")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_CITY), + profile.SetInfo(AutofillType(ADDRESS_HOME_LINE2), ASCIIToUTF16("Suite #1")); + profile.SetInfo(AutofillType(ADDRESS_HOME_CITY), ASCIIToUTF16("Mountain View")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_ZIP), ASCIIToUTF16("94111")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("USA")); - profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), + profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); + profile.SetInfo(AutofillType(ADDRESS_HOME_ZIP), ASCIIToUTF16("94111")); + profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("USA")); + profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), ASCIIToUTF16("014155552258")); - profile.SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), + profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16("024087172258")); profiles().push_back(&profile); @@ -257,11 +257,11 @@ TEST_F(AutoFillDialogControllerTest, AutoFillDataMutation) { TEST_F(AutoFillDialogControllerTest, CreditCardDataMutation) { CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("DCH")); - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), + credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("DCH")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_NUMBER), ASCIIToUTF16("1234 5678 9101 1121")); - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), ASCIIToUTF16("2012")); credit_cards().push_back(&credit_card); @@ -293,10 +293,10 @@ TEST_F(AutoFillDialogControllerTest, CreditCardDataMutation) { TEST_F(AutoFillDialogControllerTest, TwoProfiles) { AutoFillProfile profile1; - profile1.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joe")); + profile1.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Joe")); profiles().push_back(&profile1); AutoFillProfile profile2; - profile2.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Bob")); + profile2.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Bob")); profiles().push_back(&profile2); LoadDialog(); [controller_ closeDialog]; @@ -316,10 +316,10 @@ TEST_F(AutoFillDialogControllerTest, TwoProfiles) { TEST_F(AutoFillDialogControllerTest, TwoCreditCards) { CreditCard credit_card1; - credit_card1.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); + credit_card1.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); credit_cards().push_back(&credit_card1); CreditCard credit_card2; - credit_card2.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Bob")); + credit_card2.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Bob")); credit_cards().push_back(&credit_card2); LoadDialog(); [controller_ closeDialog]; @@ -339,7 +339,7 @@ TEST_F(AutoFillDialogControllerTest, TwoCreditCards) { TEST_F(AutoFillDialogControllerTest, AddNewProfile) { AutoFillProfile profile; - profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joe")); + profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Joe")); profiles().push_back(&profile); LoadDialog(); [controller_ addNewAddress:nil]; @@ -360,13 +360,13 @@ TEST_F(AutoFillDialogControllerTest, AddNewProfile) { // New address should match. Don't compare labels. AutoFillProfile new_profile; - new_profile.SetInfo(AutoFillType(NAME_FULL), ASCIIToUTF16("Don")); + new_profile.SetInfo(AutofillType(NAME_FULL), ASCIIToUTF16("Don")); ASSERT_EQ(0, observer_.profiles_[1].Compare(new_profile)); } TEST_F(AutoFillDialogControllerTest, AddNewCreditCard) { CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); credit_cards().push_back(&credit_card); LoadDialog(); [controller_ addNewCreditCard:nil]; @@ -388,13 +388,13 @@ TEST_F(AutoFillDialogControllerTest, AddNewCreditCard) { // New credit card should match. Don't compare labels. CreditCard new_credit_card; - new_credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Don")); + new_credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Don")); ASSERT_EQ(0, observer_.credit_cards_[1].Compare(new_credit_card)); } TEST_F(AutoFillDialogControllerTest, AddNewEmptyProfile) { AutoFillProfile profile; - profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joe")); + profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Joe")); profiles().push_back(&profile); LoadDialog(); [controller_ addNewAddress:nil]; @@ -412,7 +412,7 @@ TEST_F(AutoFillDialogControllerTest, AddNewEmptyProfile) { TEST_F(AutoFillDialogControllerTest, AddNewEmptyCreditCard) { CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); credit_cards().push_back(&credit_card); LoadDialog(); [controller_ addNewCreditCard:nil]; @@ -431,7 +431,7 @@ TEST_F(AutoFillDialogControllerTest, AddNewEmptyCreditCard) { TEST_F(AutoFillDialogControllerTest, DeleteProfile) { AutoFillProfile profile; - profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joe")); + profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Joe")); profiles().push_back(&profile); LoadDialog(); [controller_ selectAddressAtIndex:0]; @@ -448,7 +448,7 @@ TEST_F(AutoFillDialogControllerTest, DeleteProfile) { TEST_F(AutoFillDialogControllerTest, DeleteCreditCard) { CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); credit_cards().push_back(&credit_card); LoadDialog(); [controller_ selectCreditCardAtIndex:0]; @@ -465,10 +465,10 @@ TEST_F(AutoFillDialogControllerTest, DeleteCreditCard) { TEST_F(AutoFillDialogControllerTest, TwoProfilesDeleteOne) { AutoFillProfile profile; - profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joe")); + profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Joe")); profiles().push_back(&profile); AutoFillProfile profile2; - profile2.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Bob")); + profile2.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Bob")); profiles().push_back(&profile2); LoadDialog(); [controller_ selectAddressAtIndex:1]; @@ -486,10 +486,10 @@ TEST_F(AutoFillDialogControllerTest, TwoProfilesDeleteOne) { TEST_F(AutoFillDialogControllerTest, TwoCreditCardsDeleteOne) { CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); credit_cards().push_back(&credit_card); CreditCard credit_card2; - credit_card2.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Bob")); + credit_card2.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Bob")); credit_cards().push_back(&credit_card2); LoadDialog(); [controller_ selectCreditCardAtIndex:1]; @@ -509,17 +509,17 @@ TEST_F(AutoFillDialogControllerTest, TwoCreditCardsDeleteOne) { TEST_F(AutoFillDialogControllerTest, DeleteMultiple) { AutoFillProfile profile; - profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joe")); + profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Joe")); profiles().push_back(&profile); AutoFillProfile profile2; - profile2.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Bob")); + profile2.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Bob")); profiles().push_back(&profile2); CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); credit_cards().push_back(&credit_card); CreditCard credit_card2; - credit_card2.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Bob")); + credit_card2.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Bob")); credit_cards().push_back(&credit_card2); LoadDialog(); diff --git a/chrome/browser/autofill/autofill_editor_gtk.cc b/chrome/browser/autofill/autofill_editor_gtk.cc index 3c05cf5..2043a4e 100644 --- a/chrome/browser/autofill/autofill_editor_gtk.cc +++ b/chrome/browser/autofill/autofill_editor_gtk.cc @@ -7,15 +7,15 @@ #include <gtk/gtk.h> #include "base/message_loop.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/task.h" #include "base/time.h" -#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/autofill/phone_number.h" -#include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/gtk/gtk_util.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -37,7 +37,7 @@ GtkWidget* CreateLabel(int label_id) { void SetEntryText(GtkWidget* entry, FormGroup* profile, _FieldType type) { gtk_entry_set_text( GTK_ENTRY(entry), - UTF16ToUTF8(profile->GetFieldText(AutoFillType(type))).c_str()); + UTF16ToUTF8(profile->GetFieldText(AutofillType(type))).c_str()); } // Returns the current value of |entry|. @@ -47,7 +47,7 @@ string16 GetEntryText(GtkWidget* entry) { // Sets |form|'s field of type |type| to the text in |entry|. void SetFormValue(GtkWidget* entry, FormGroup* form, _FieldType type) { - form->SetInfo(AutoFillType(type), GetEntryText(entry)); + form->SetInfo(AutofillType(type), GetEntryText(entry)); } // Sets the number of characters to display in |combobox| to |width|. @@ -428,15 +428,15 @@ void AutoFillProfileEditor::SetProfileValuesFromWidgets( string16 number, city_code, country_code; PhoneNumber::ParsePhoneNumber( GetEntryText(phone_), &number, &city_code, &country_code); - profile->SetInfo(AutoFillType(PHONE_HOME_COUNTRY_CODE), country_code); - profile->SetInfo(AutoFillType(PHONE_HOME_CITY_CODE), city_code); - profile->SetInfo(AutoFillType(PHONE_HOME_NUMBER), number); + profile->SetInfo(AutofillType(PHONE_HOME_COUNTRY_CODE), country_code); + profile->SetInfo(AutofillType(PHONE_HOME_CITY_CODE), city_code); + profile->SetInfo(AutofillType(PHONE_HOME_NUMBER), number); PhoneNumber::ParsePhoneNumber( GetEntryText(fax_), &number, &city_code, &country_code); - profile->SetInfo(AutoFillType(PHONE_FAX_COUNTRY_CODE), country_code); - profile->SetInfo(AutoFillType(PHONE_FAX_CITY_CODE), city_code); - profile->SetInfo(AutoFillType(PHONE_FAX_NUMBER), number); + profile->SetInfo(AutofillType(PHONE_FAX_COUNTRY_CODE), country_code); + profile->SetInfo(AutofillType(PHONE_FAX_CITY_CODE), city_code); + profile->SetInfo(AutofillType(PHONE_FAX_NUMBER), number); } void AutoFillProfileEditor::UpdatePhoneImage(GtkWidget* entry, @@ -714,7 +714,7 @@ void AutoFillCreditCardEditor::SetWidgetValues(CreditCard* card) { UTF16ToUTF8(card->ObfuscatedNumber()).c_str()); int month; - base::StringToInt(card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)), + base::StringToInt(card->GetFieldText(AutofillType(CREDIT_CARD_EXP_MONTH)), &month); if (month >= 1 && month <= 12) { gtk_combo_box_set_active(GTK_COMBO_BOX(month_), month - 1); @@ -724,7 +724,7 @@ void AutoFillCreditCardEditor::SetWidgetValues(CreditCard* card) { int year; if (!base::StringToInt( - card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)), + card->GetFieldText(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)), &year)) { NOTREACHED(); } @@ -782,14 +782,14 @@ void AutoFillCreditCardEditor::SetCreditCardValuesFromWidgets( gtk_combo_box_get_active(GTK_COMBO_BOX(month_)); if (selected_month_index == -1) selected_month_index = 0; - card->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), + card->SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), base::IntToString16(selected_month_index + 1)); int selected_year_index = gtk_combo_box_get_active(GTK_COMBO_BOX(year_)); if (selected_year_index == -1) selected_year_index = 0; - card->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + card->SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), base::IntToString16(selected_year_index + base_year_)); } diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc index 6bd1c06..39b985a 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -137,7 +137,7 @@ bool ImportSingleProfile(FormGroup* profile, if (it->second == CREDIT_CARD_NUMBER) { field_value = DecryptCCNumber(field_value); } - profile->SetInfo(AutoFillType(it->second), field_value); + profile->SetInfo(AutofillType(it->second), field_value); } } return has_non_empty_fields; @@ -209,14 +209,14 @@ bool ImportCurrentUserProfiles(std::vector<AutoFillProfile>* profiles, if (ImportSingleProfile(&profile, &key, reg_to_field)) { // Combine phones into whole phone #. string16 phone; - phone = profile.GetFieldText(AutoFillType(PHONE_HOME_COUNTRY_CODE)); - phone.append(profile.GetFieldText(AutoFillType(PHONE_HOME_CITY_CODE))); - phone.append(profile.GetFieldText(AutoFillType(PHONE_HOME_NUMBER))); - profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), phone); - phone = profile.GetFieldText(AutoFillType(PHONE_FAX_COUNTRY_CODE)); - phone.append(profile.GetFieldText(AutoFillType(PHONE_FAX_CITY_CODE))); - phone.append(profile.GetFieldText(AutoFillType(PHONE_FAX_NUMBER))); - profile.SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), phone); + phone = profile.GetFieldText(AutofillType(PHONE_HOME_COUNTRY_CODE)); + phone.append(profile.GetFieldText(AutofillType(PHONE_HOME_CITY_CODE))); + phone.append(profile.GetFieldText(AutofillType(PHONE_HOME_NUMBER))); + profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), phone); + phone = profile.GetFieldText(AutofillType(PHONE_FAX_COUNTRY_CODE)); + phone.append(profile.GetFieldText(AutofillType(PHONE_FAX_CITY_CODE))); + phone.append(profile.GetFieldText(AutofillType(PHONE_FAX_NUMBER))); + profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), phone); profiles->push_back(profile); } } @@ -240,7 +240,7 @@ bool ImportCurrentUserProfiles(std::vector<AutoFillProfile>* profiles, CreditCard credit_card; if (ImportSingleProfile(&credit_card, &key, reg_to_field)) { string16 cc_number = credit_card.GetFieldText( - AutoFillType(CREDIT_CARD_NUMBER)); + AutofillType(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 972badb..86e13b8 100644 --- a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc +++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -163,51 +163,51 @@ 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(AutoFillType(NAME_FIRST)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(NAME_FIRST)), profile1[0].value); - EXPECT_EQ(profiles[1].GetFieldText(AutoFillType(NAME_MIDDLE)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(NAME_MIDDLE)), profile1[1].value); - EXPECT_EQ(profiles[1].GetFieldText(AutoFillType(NAME_LAST)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(NAME_LAST)), profile1[2].value); - EXPECT_EQ(profiles[1].GetFieldText(AutoFillType(EMAIL_ADDRESS)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(EMAIL_ADDRESS)), profile1[3].value); - EXPECT_EQ(profiles[1].GetFieldText(AutoFillType(COMPANY_NAME)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(COMPANY_NAME)), profile1[4].value); - EXPECT_EQ(profiles[1].GetFieldText(AutoFillType(PHONE_HOME_COUNTRY_CODE)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(PHONE_HOME_COUNTRY_CODE)), profile1[7].value); - EXPECT_EQ(profiles[1].GetFieldText(AutoFillType(PHONE_HOME_CITY_CODE)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(PHONE_HOME_CITY_CODE)), profile1[6].value); - EXPECT_EQ(profiles[1].GetFieldText(AutoFillType(PHONE_HOME_NUMBER)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(PHONE_HOME_NUMBER)), L"5555555"); - EXPECT_EQ(profiles[1].GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER)), + EXPECT_EQ(profiles[1].GetFieldText(AutofillType(PHONE_HOME_WHOLE_NUMBER)), L"14445555555"); - EXPECT_EQ(profiles[0].GetFieldText(AutoFillType(NAME_FIRST)), + EXPECT_EQ(profiles[0].GetFieldText(AutofillType(NAME_FIRST)), profile2[0].value); - EXPECT_EQ(profiles[0].GetFieldText(AutoFillType(NAME_LAST)), + EXPECT_EQ(profiles[0].GetFieldText(AutofillType(NAME_LAST)), profile2[1].value); - EXPECT_EQ(profiles[0].GetFieldText(AutoFillType(EMAIL_ADDRESS)), + EXPECT_EQ(profiles[0].GetFieldText(AutofillType(EMAIL_ADDRESS)), profile2[2].value); - EXPECT_EQ(profiles[0].GetFieldText(AutoFillType(COMPANY_NAME)), + EXPECT_EQ(profiles[0].GetFieldText(AutofillType(COMPANY_NAME)), profile2[3].value); - EXPECT_EQ(profiles[0].GetFieldText(AutoFillType(PHONE_FAX_COUNTRY_CODE)), + EXPECT_EQ(profiles[0].GetFieldText(AutofillType(PHONE_FAX_COUNTRY_CODE)), profile2[6].value); - EXPECT_EQ(profiles[0].GetFieldText(AutoFillType(PHONE_FAX_CITY_CODE)), + EXPECT_EQ(profiles[0].GetFieldText(AutofillType(PHONE_FAX_CITY_CODE)), profile2[5].value); - EXPECT_EQ(profiles[0].GetFieldText(AutoFillType(PHONE_FAX_NUMBER)), + EXPECT_EQ(profiles[0].GetFieldText(AutofillType(PHONE_FAX_NUMBER)), L"5556666"); - EXPECT_EQ(profiles[0].GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER)), + EXPECT_EQ(profiles[0].GetFieldText(AutofillType(PHONE_FAX_WHOLE_NUMBER)), L"27775556666"); ASSERT_EQ(credit_cards.size(), 1); - EXPECT_EQ(credit_cards[0].GetFieldText(AutoFillType(CREDIT_CARD_NAME)), + EXPECT_EQ(credit_cards[0].GetFieldText(AutofillType(CREDIT_CARD_NAME)), credit_card[0].value); - EXPECT_EQ(credit_cards[0].GetFieldText(AutoFillType(CREDIT_CARD_NUMBER)), + EXPECT_EQ(credit_cards[0].GetFieldText(AutofillType(CREDIT_CARD_NUMBER)), L"4111111111111111"); - EXPECT_EQ(credit_cards[0].GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)), + EXPECT_EQ(credit_cards[0].GetFieldText(AutofillType(CREDIT_CARD_EXP_MONTH)), credit_card[2].value); EXPECT_EQ(credit_cards[0].GetFieldText( - AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)), + AutofillType(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 0933d4e..8d46c84 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -110,7 +110,7 @@ void FindSectionBounds(const FormStructure& form, for (size_t i = 0; i < form.field_count(); ++i) { const AutofillField* current_field = form.field(i); const AutofillFieldType current_type = - AutoFillType::GetEquivalentFieldType(current_field->type()); + AutofillType::GetEquivalentFieldType(current_field->type()); // Fields of unknown type don't help us to distinguish sections. if (current_type == UNKNOWN_TYPE) @@ -120,15 +120,15 @@ void FindSectionBounds(const FormStructure& form, // Forms often ask for multiple phone numbers -- e.g. both a daytime and // evening phone number. Our phone and fax number detection is also // generally a little off. Hence, ignore both field types as a signal here. - AutoFillType::FieldTypeGroup current_type_group = - AutoFillType(current_type).group(); - if (current_type_group == AutoFillType::PHONE_HOME || - current_type_group == AutoFillType::PHONE_FAX) + AutofillType::FieldTypeGroup current_type_group = + AutofillType(current_type).group(); + if (current_type_group == AutofillType::PHONE_HOME || + current_type_group == AutofillType::PHONE_FAX) already_saw_current_type = false; // If we are filling credit card data, the relevant section should include // only credit card fields; and similarly for profile data. - bool is_credit_card_field = current_type_group == AutoFillType::CREDIT_CARD; + bool is_credit_card_field = current_type_group == AutofillType::CREDIT_CARD; bool is_appropriate_type = is_credit_card_field == is_filling_credit_card; if (already_saw_current_type || !is_appropriate_type) { @@ -192,7 +192,7 @@ bool SectionIsAutoFilled(const FormStructure* form_structure, if (k >= form_structure->field_count()) continue; - AutoFillType autofill_type(form_structure->field(k)->type()); + AutofillType autofill_type(form_structure->field(k)->type()); if (form.fields[j].is_autofilled()) return true; @@ -331,8 +331,8 @@ void AutofillManager::OnQueryFormFieldAutoFill( FindCachedFormAndField(form, field, &form_structure, &autofill_field) && // Don't send suggestions for forms that aren't auto-fillable. form_structure->IsAutoFillable(false)) { - AutoFillType type(autofill_field->type()); - bool is_filling_credit_card = (type.group() == AutoFillType::CREDIT_CARD); + AutofillType type(autofill_field->type()); + bool is_filling_credit_card = (type.group() == AutofillType::CREDIT_CARD); if (is_filling_credit_card) { GetCreditCardSuggestions( form_structure, field, type, &values, &labels, &icons, &unique_ids); @@ -450,12 +450,12 @@ void AutofillManager::OnFillAutoFillFormData(int query_id, for (std::vector<FormField>::iterator iter = result.fields.begin(); iter != result.fields.end(); ++iter) { if ((*iter) == field) { - AutoFillType autofill_type(autofill_field->type()); + AutofillType autofill_type(autofill_field->type()); if (profile) { - DCHECK_NE(AutoFillType::CREDIT_CARD, autofill_type.group()); + DCHECK_NE(AutofillType::CREDIT_CARD, autofill_type.group()); FillFormField(profile, autofill_type, &(*iter)); } else { - DCHECK_EQ(AutoFillType::CREDIT_CARD, autofill_type.group()); + DCHECK_EQ(AutofillType::CREDIT_CARD, autofill_type.group()); FillCreditCardFormField(credit_card, autofill_type, &(*iter)); } break; @@ -488,13 +488,13 @@ void AutofillManager::OnFillAutoFillFormData(int query_id, if (k >= section_end) continue; - AutoFillType autofill_type(form_structure->field(k)->type()); - if (autofill_type.group() != AutoFillType::NO_GROUP) { + AutofillType autofill_type(form_structure->field(k)->type()); + if (autofill_type.group() != AutofillType::NO_GROUP) { if (profile) { - DCHECK_NE(AutoFillType::CREDIT_CARD, autofill_type.group()); + DCHECK_NE(AutofillType::CREDIT_CARD, autofill_type.group()); FillFormField(profile, autofill_type, &result.fields[j]); } else { - DCHECK_EQ(AutoFillType::CREDIT_CARD, autofill_type.group()); + DCHECK_EQ(AutofillType::CREDIT_CARD, autofill_type.group()); FillCreditCardFormField(credit_card, autofill_type, &result.fields[j]); } } @@ -802,7 +802,7 @@ bool AutofillManager::FindCachedFormAndField(const FormData& form, void AutofillManager::GetProfileSuggestions(FormStructure* form, const FormField& field, - AutoFillType type, + AutofillType type, std::vector<string16>* values, std::vector<string16>* labels, std::vector<string16>* icons, @@ -844,7 +844,7 @@ void AutofillManager::GetProfileSuggestions(FormStructure* form, void AutofillManager::GetCreditCardSuggestions(FormStructure* form, const FormField& field, - AutoFillType type, + AutofillType type, std::vector<string16>* values, std::vector<string16>* labels, std::vector<string16>* icons, @@ -870,10 +870,10 @@ void AutofillManager::GetCreditCardSuggestions(FormStructure* form, } void AutofillManager::FillCreditCardFormField(const CreditCard* credit_card, - AutoFillType type, + AutofillType type, webkit_glue::FormField* field) { DCHECK(credit_card); - DCHECK_EQ(AutoFillType::CREDIT_CARD, type.group()); + DCHECK_EQ(AutofillType::CREDIT_CARD, type.group()); DCHECK(field); if (field->form_control_type() == ASCIIToUTF16("select-one")) { @@ -881,9 +881,9 @@ void AutofillManager::FillCreditCardFormField(const CreditCard* credit_card, } else if (field->form_control_type() == ASCIIToUTF16("month")) { // HTML5 input="month" consists of year-month. string16 year = credit_card->GetFieldText( - AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); + AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); string16 month = credit_card->GetFieldText( - AutoFillType(CREDIT_CARD_EXP_MONTH)); + AutofillType(CREDIT_CARD_EXP_MONTH)); if (!year.empty() && !month.empty()) { // Fill the value only if |credit_card| includes both year and month // information. @@ -895,13 +895,13 @@ void AutofillManager::FillCreditCardFormField(const CreditCard* credit_card, } void AutofillManager::FillFormField(const AutoFillProfile* profile, - AutoFillType type, + AutofillType type, webkit_glue::FormField* field) { DCHECK(profile); - DCHECK_NE(AutoFillType::CREDIT_CARD, type.group()); + DCHECK_NE(AutofillType::CREDIT_CARD, type.group()); DCHECK(field); - if (type.subgroup() == AutoFillType::PHONE_NUMBER) { + if (type.subgroup() == AutofillType::PHONE_NUMBER) { FillPhoneNumberField(profile, type, field); } else { if (field->form_control_type() == ASCIIToUTF16("select-one")) @@ -912,11 +912,11 @@ void AutofillManager::FillFormField(const AutoFillProfile* profile, } void AutofillManager::FillPhoneNumberField(const AutoFillProfile* profile, - AutoFillType type, + AutofillType type, 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(AutoFillType(type)); + string16 number = profile->GetFieldText(AutofillType(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.h b/chrome/browser/autofill/autofill_manager.h index 3659c45..c9697c3 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -140,7 +140,7 @@ class AutofillManager : public TabContentsObserver, // is filled with the Profile label. void GetProfileSuggestions(FormStructure* form, const webkit_glue::FormField& field, - AutoFillType type, + AutofillType type, std::vector<string16>* values, std::vector<string16>* labels, std::vector<string16>* icons, @@ -150,7 +150,7 @@ class AutofillManager : public TabContentsObserver, // the value of |field| and returns the labels of the matching credit cards. void GetCreditCardSuggestions(FormStructure* form, const webkit_glue::FormField& field, - AutoFillType type, + AutofillType type, std::vector<string16>* values, std::vector<string16>* labels, std::vector<string16>* icons, @@ -159,18 +159,18 @@ class AutofillManager : public TabContentsObserver, // Set |field| argument's value based on |type| and contents of the // |credit_card|. void FillCreditCardFormField(const CreditCard* credit_card, - AutoFillType type, + AutofillType type, webkit_glue::FormField* field); // Set |field| argument's value based on |type| and contents of the |profile|. void FillFormField(const AutoFillProfile* profile, - AutoFillType type, + AutofillType type, webkit_glue::FormField* field); // Set |field| argument's value for phone/fax number based on contents of the // |profile|. |type| is the type of the phone. void FillPhoneNumberField(const AutoFillProfile* profile, - AutoFillType type, + AutofillType type, webkit_glue::FormField* field); // Parses the forms using heuristic matching and querying the Autofill server. diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index c374170..422f676 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -1640,7 +1640,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { AutoFillProfile *work_profile = autofill_manager_->GetProfileWithGUID( "00000000-0000-0000-0000-000000000002"); ASSERT_TRUE(work_profile != NULL); - const AutoFillType phone_type(PHONE_HOME_NUMBER); + const AutofillType phone_type(PHONE_HOME_NUMBER); string16 saved_phone = work_profile->GetFieldText(phone_type); char test_data[] = "1234567890123456"; diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc index 4ed3b00..0ce01b2 100644 --- a/chrome/browser/autofill/autofill_merge_unittest.cc +++ b/chrome/browser/autofill/autofill_merge_unittest.cc @@ -51,9 +51,9 @@ std::string SerializeProfiles(const std::vector<AutoFillProfile*>& profiles) { result += "\n"; for (size_t j = 0; j < arraysize(kProfileFieldTypes); ++j) { AutofillFieldType type = kProfileFieldTypes[j]; - result += AutoFillType::FieldTypeToString(type); + result += AutofillType::FieldTypeToString(type); result += kFieldSeparator; - result += UTF16ToUTF8(profiles[i]->GetFieldText(AutoFillType(type))); + result += UTF16ToUTF8(profiles[i]->GetFieldText(AutofillType(type))); result += "\n"; } } @@ -198,7 +198,7 @@ void AutoFillMergeTest::MergeProfiles(const std::string& profiles, AutofillField* field = const_cast<AutofillField*>(form_structure.field(i)); AutofillFieldType type = - AutoFillType::StringToFieldType(UTF16ToUTF8(field->name())); + AutofillType::StringToFieldType(UTF16ToUTF8(field->name())); field->set_heuristic_type(type); } std::vector<const FormStructure*> form_structures(1, &form_structure); diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc index 13d2b04..e30fa53 100644 --- a/chrome/browser/autofill/autofill_profile.cc +++ b/chrome/browser/autofill/autofill_profile.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,13 +22,13 @@ namespace { void InitPersonalInfo(FormGroupMap* personal_info) { - (*personal_info)[AutoFillType::CONTACT_INFO] = new ContactInfo(); - (*personal_info)[AutoFillType::PHONE_HOME] = new HomePhoneNumber(); - (*personal_info)[AutoFillType::PHONE_FAX] = new FaxNumber(); - (*personal_info)[AutoFillType::ADDRESS_HOME] = new Address(); + (*personal_info)[AutofillType::CONTACT_INFO] = new ContactInfo(); + (*personal_info)[AutofillType::PHONE_HOME] = new HomePhoneNumber(); + (*personal_info)[AutofillType::PHONE_FAX] = new FaxNumber(); + (*personal_info)[AutofillType::ADDRESS_HOME] = new Address(); } -// Like |AutoFillType::GetEquivalentFieldType()|, but also returns |NAME_FULL| +// Like |AutofillType::GetEquivalentFieldType()|, but also returns |NAME_FULL| // for first, middle, and last name field types. AutofillFieldType GetEquivalentFieldTypeCollapsingNames( AutofillFieldType field_type) { @@ -36,7 +36,7 @@ AutofillFieldType GetEquivalentFieldTypeCollapsingNames( field_type == NAME_LAST) return NAME_FULL; - return AutoFillType::GetEquivalentFieldType(field_type); + return AutofillType::GetEquivalentFieldType(field_type); } // Fills |distinguishing_fields| with a list of fields to use when creating @@ -148,9 +148,9 @@ void AutoFillProfile::GetAvailableFieldTypes( } } -string16 AutoFillProfile::GetFieldText(const AutoFillType& type) const { - AutoFillType return_type( - AutoFillType::GetEquivalentFieldType(type.field_type())); +string16 AutoFillProfile::GetFieldText(const AutofillType& type) const { + AutofillType return_type( + AutofillType::GetEquivalentFieldType(type.field_type())); FormGroupMap::const_iterator iter = personal_info_.find(return_type.group()); if (iter == personal_info_.end() || iter->second == NULL) @@ -160,7 +160,7 @@ string16 AutoFillProfile::GetFieldText(const AutoFillType& type) const { } void AutoFillProfile::FindInfoMatches( - const AutoFillType& type, + const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const { if (matched_text == NULL) { @@ -184,7 +184,7 @@ void AutoFillProfile::FindInfoMatches( } } -void AutoFillProfile::SetInfo(const AutoFillType& type, const string16& value) { +void AutoFillProfile::SetInfo(const AutofillType& type, const string16& value) { FormGroupMap::const_iterator iter = personal_info_.find(type.group()); if (iter == personal_info_.end() || iter->second == NULL) return; @@ -202,7 +202,7 @@ const string16 AutoFillProfile::Label() const { const std::string AutoFillProfile::CountryCode() const { FormGroup* form_group = - personal_info_.find(AutoFillType::ADDRESS_HOME)->second; + personal_info_.find(AutofillType::ADDRESS_HOME)->second; DCHECK(form_group); Address* address = static_cast<Address*>(form_group); return address->country_code(); @@ -210,7 +210,7 @@ const std::string AutoFillProfile::CountryCode() const { void AutoFillProfile::SetCountryCode(const std::string& country_code) { FormGroup* form_group = - personal_info_.find(AutoFillType::ADDRESS_HOME)->second; + personal_info_.find(AutofillType::ADDRESS_HOME)->second; DCHECK(form_group); Address* address = static_cast<Address*>(form_group); address->set_country_code(country_code); @@ -322,8 +322,8 @@ int AutoFillProfile::Compare(const AutoFillProfile& profile) const { PHONE_FAX_NUMBER }; for (size_t index = 0; index < arraysize(types); ++index) { - int comparison = GetFieldText(AutoFillType(types[index])).compare( - profile.GetFieldText(AutoFillType(types[index]))); + int comparison = GetFieldText(AutofillType(types[index])).compare( + profile.GetFieldText(AutofillType(types[index]))); if (comparison != 0) return comparison; } @@ -343,10 +343,10 @@ bool AutoFillProfile::operator!=(const AutoFillProfile& profile) const { } const string16 AutoFillProfile::PrimaryValue() const { - return GetFieldText(AutoFillType(NAME_FULL)) + - GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)) + - GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)) + - GetFieldText(AutoFillType(EMAIL_ADDRESS)); + return GetFieldText(AutofillType(NAME_FULL)) + + GetFieldText(AutofillType(ADDRESS_HOME_LINE1)) + + GetFieldText(AutofillType(ADDRESS_HOME_LINE2)) + + GetFieldText(AutofillType(EMAIL_ADDRESS)); } string16 AutoFillProfile::ConstructInferredLabel( @@ -361,7 +361,7 @@ string16 AutoFillProfile::ConstructInferredLabel( included_fields.begin(); it != included_fields.end() && num_fields_used < num_fields_to_use; ++it) { - string16 field = GetFieldText(AutoFillType(*it)); + string16 field = GetFieldText(AutofillType(*it)); if (field.empty()) continue; @@ -398,7 +398,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(AutoFillType(*field)); + string16 field_text = profile->GetFieldText(AutofillType(*field)); // If this label is not already in the map, add it with frequency 0. if (!field_text_frequencies.count(field_text)) @@ -425,7 +425,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(AutoFillType(*field)); + string16 field_text = profile->GetFieldText(AutofillType(*field)); if (field_text.empty()) continue; @@ -463,31 +463,31 @@ std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile) { << " " << profile.guid() << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_FIRST))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(NAME_FIRST))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_MIDDLE))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(NAME_MIDDLE))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(NAME_LAST))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(EMAIL_ADDRESS))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(EMAIL_ADDRESS))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(COMPANY_NAME))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(COMPANY_NAME))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_ZIP))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType( + << UTF16ToUTF8(profile.GetFieldText(AutofillType( PHONE_HOME_WHOLE_NUMBER))) << " " - << UTF16ToUTF8(profile.GetFieldText(AutoFillType( + << UTF16ToUTF8(profile.GetFieldText(AutofillType( PHONE_FAX_WHOLE_NUMBER))); } diff --git a/chrome/browser/autofill/autofill_profile.h b/chrome/browser/autofill/autofill_profile.h index d7c6d0b..6f31139 100644 --- a/chrome/browser/autofill/autofill_profile.h +++ b/chrome/browser/autofill/autofill_profile.h @@ -32,14 +32,14 @@ class AutoFillProfile : public FormGroup { virtual void GetPossibleFieldTypes(const string16& text, FieldTypeSet* possible_types) const; virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; - virtual string16 GetFieldText(const AutoFillType& type) const; + virtual string16 GetFieldText(const AutofillType& type) const; // Returns true if the info matches the profile data corresponding to type. // If the type is UNKNOWN_TYPE then info will be matched against all of the // profile data. - virtual void FindInfoMatches(const AutoFillType& type, + virtual void FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const; - virtual void SetInfo(const AutoFillType& type, const string16& value); + virtual void SetInfo(const AutofillType& type, const string16& value); // Returns a copy of the profile it is called on. The caller is responsible // for deleting profile when they are done with it. virtual FormGroup* Clone() const; diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc index 1792429..982bcb7 100644 --- a/chrome/browser/autofill/autofill_profile_unittest.cc +++ b/chrome/browser/autofill/autofill_profile_unittest.cc @@ -481,7 +481,7 @@ TEST(AutoFillProfileTest, CreateInferredLabelsSkipsEmptyFields) { // A field must have a non-empty value for each profile to be considered a // distinguishing field. - profiles[1]->SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + profiles[1]->SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("88 Nowhere Ave.")); AutoFillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 1, &labels); diff --git a/chrome/browser/autofill/autofill_text_field_mac.mm b/chrome/browser/autofill/autofill_text_field_mac.mm index 5db2ffb..19aa2f7 100644 --- a/chrome/browser/autofill/autofill_text_field_mac.mm +++ b/chrome/browser/autofill/autofill_text_field_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -35,7 +35,7 @@ // Obfuscate the number. NSString* string = static_cast<NSString*>(object); CreditCard card; - card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), + card.SetInfo(AutofillType(CREDIT_CARD_NUMBER), base::SysNSStringToUTF16(string)); NSString* starredString = base::SysUTF16ToNSString(card.ObfuscatedNumber()); diff --git a/chrome/browser/autofill/autofill_type.cc b/chrome/browser/autofill/autofill_type.cc index 56ae9dd..7ca8c7c 100644 --- a/chrome/browser/autofill/autofill_type.cc +++ b/chrome/browser/autofill/autofill_type.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,135 +9,135 @@ namespace { -const AutoFillType::AutoFillTypeDefinition kUnknownAutoFillTypeDefinition = { - /* UNKNOWN_TYPE */ AutoFillType::NO_GROUP, AutoFillType::NO_SUBGROUP +const AutofillType::AutofillTypeDefinition kUnknownAutofillTypeDefinition = { + /* UNKNOWN_TYPE */ AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }; -AutoFillType::AutoFillTypeDefinition kAutoFillTypeDefinitions[] = { +AutofillType::AutofillTypeDefinition kAutofillTypeDefinitions[] = { // NO_SERVER_DATA - { AutoFillType::NO_GROUP, AutoFillType::NO_SUBGROUP }, + { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, // UNKNOWN_TYPE - kUnknownAutoFillTypeDefinition, + kUnknownAutofillTypeDefinition, // EMPTY_TYPE - { AutoFillType::NO_GROUP, AutoFillType::NO_SUBGROUP }, + { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, // NAME_FIRST - { AutoFillType::CONTACT_INFO, AutoFillType::NO_SUBGROUP }, + { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, // NAME_MIDDLE - { AutoFillType::CONTACT_INFO, AutoFillType::NO_SUBGROUP }, + { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, // NAME_LAST - { AutoFillType::CONTACT_INFO, AutoFillType::NO_SUBGROUP }, + { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, // NAME_MIDDLE_INITIAL - { AutoFillType::CONTACT_INFO, AutoFillType::NO_SUBGROUP }, + { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, // NAME_FULL - { AutoFillType::CONTACT_INFO, AutoFillType::NO_SUBGROUP }, + { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, // NAME_SUFFIX - { AutoFillType::CONTACT_INFO, AutoFillType::NO_SUBGROUP }, + { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, // EMAIL_ADDRESS - { AutoFillType::CONTACT_INFO, AutoFillType::NO_SUBGROUP }, + { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, // PHONE_HOME_NUMBER - { AutoFillType::PHONE_HOME, AutoFillType::PHONE_NUMBER }, + { AutofillType::PHONE_HOME, AutofillType::PHONE_NUMBER }, // PHONE_HOME_CITY_CODE - { AutoFillType::PHONE_HOME, AutoFillType::PHONE_CITY_CODE }, + { AutofillType::PHONE_HOME, AutofillType::PHONE_CITY_CODE }, // PHONE_HOME_COUNTRY_CODE - { AutoFillType::PHONE_HOME, AutoFillType::PHONE_COUNTRY_CODE }, + { AutofillType::PHONE_HOME, AutofillType::PHONE_COUNTRY_CODE }, // PHONE_HOME_CITY_AND_NUMBER - { AutoFillType::PHONE_HOME, AutoFillType::PHONE_CITY_AND_NUMBER }, + { AutofillType::PHONE_HOME, AutofillType::PHONE_CITY_AND_NUMBER }, // PHONE_HOME_WHOLE_NUMBER - { AutoFillType::PHONE_HOME, AutoFillType::PHONE_WHOLE_NUMBER }, + { AutofillType::PHONE_HOME, AutofillType::PHONE_WHOLE_NUMBER }, // Work phone numbers (values [15,19]) are deprecated. - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, // PHONE_FAX_NUMBER - { AutoFillType::PHONE_FAX, AutoFillType::PHONE_NUMBER }, + { AutofillType::PHONE_FAX, AutofillType::PHONE_NUMBER }, // PHONE_FAX_CITY_CODE - { AutoFillType::PHONE_FAX, AutoFillType::PHONE_CITY_CODE }, + { AutofillType::PHONE_FAX, AutofillType::PHONE_CITY_CODE }, // PHONE_FAX_COUNTRY_CODE - { AutoFillType::PHONE_FAX, AutoFillType::PHONE_COUNTRY_CODE }, + { AutofillType::PHONE_FAX, AutofillType::PHONE_COUNTRY_CODE }, // PHONE_FAX_CITY_AND_NUMBER - { AutoFillType::PHONE_FAX, AutoFillType::PHONE_CITY_AND_NUMBER }, + { AutofillType::PHONE_FAX, AutofillType::PHONE_CITY_AND_NUMBER }, // PHONE_FAX_WHOLE_NUMBER - { AutoFillType::PHONE_FAX, AutoFillType::PHONE_WHOLE_NUMBER }, + { AutofillType::PHONE_FAX, AutofillType::PHONE_WHOLE_NUMBER }, // Cell phone numbers (values [25, 29]) are deprecated. - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, // ADDRESS_HOME_LINE1 - { AutoFillType::ADDRESS_HOME, AutoFillType::ADDRESS_LINE1 }, + { AutofillType::ADDRESS_HOME, AutofillType::ADDRESS_LINE1 }, // ADDRESS_HOME_LINE2 - { AutoFillType::ADDRESS_HOME, AutoFillType::ADDRESS_LINE2 }, + { AutofillType::ADDRESS_HOME, AutofillType::ADDRESS_LINE2 }, // ADDRESS_HOME_APT_NUM - { AutoFillType::ADDRESS_HOME, AutoFillType::ADDRESS_APT_NUM }, + { AutofillType::ADDRESS_HOME, AutofillType::ADDRESS_APT_NUM }, // ADDRESS_HOME_CITY - { AutoFillType::ADDRESS_HOME, AutoFillType::ADDRESS_CITY }, + { AutofillType::ADDRESS_HOME, AutofillType::ADDRESS_CITY }, // ADDRESS_HOME_STATE - { AutoFillType::ADDRESS_HOME, AutoFillType::ADDRESS_STATE }, + { AutofillType::ADDRESS_HOME, AutofillType::ADDRESS_STATE }, // ADDRESS_HOME_ZIP - { AutoFillType::ADDRESS_HOME, AutoFillType::ADDRESS_ZIP }, + { AutofillType::ADDRESS_HOME, AutofillType::ADDRESS_ZIP }, // ADDRESS_HOME_COUNTRY - { AutoFillType::ADDRESS_HOME, AutoFillType::ADDRESS_COUNTRY }, + { AutofillType::ADDRESS_HOME, AutofillType::ADDRESS_COUNTRY }, // ADDRESS_BILLING_LINE1 - { AutoFillType::ADDRESS_BILLING, AutoFillType::ADDRESS_LINE1 }, + { AutofillType::ADDRESS_BILLING, AutofillType::ADDRESS_LINE1 }, // ADDRESS_BILLING_LINE2 - { AutoFillType::ADDRESS_BILLING, AutoFillType::ADDRESS_LINE2 }, + { AutofillType::ADDRESS_BILLING, AutofillType::ADDRESS_LINE2 }, // ADDRESS_BILLING_APT_NUM - { AutoFillType::ADDRESS_BILLING, AutoFillType::ADDRESS_APT_NUM }, + { AutofillType::ADDRESS_BILLING, AutofillType::ADDRESS_APT_NUM }, // ADDRESS_BILLING_CITY - { AutoFillType::ADDRESS_BILLING, AutoFillType::ADDRESS_CITY }, + { AutofillType::ADDRESS_BILLING, AutofillType::ADDRESS_CITY }, // ADDRESS_BILLING_STATE - { AutoFillType::ADDRESS_BILLING, AutoFillType::ADDRESS_STATE }, + { AutofillType::ADDRESS_BILLING, AutofillType::ADDRESS_STATE }, // ADDRESS_BILLING_ZIP - { AutoFillType::ADDRESS_BILLING, AutoFillType::ADDRESS_ZIP }, + { AutofillType::ADDRESS_BILLING, AutofillType::ADDRESS_ZIP }, // ADDRESS_BILLING_COUNTRY - { AutoFillType::ADDRESS_BILLING, AutoFillType::ADDRESS_COUNTRY }, + { AutofillType::ADDRESS_BILLING, AutofillType::ADDRESS_COUNTRY }, // ADDRESS_SHIPPING values [44,50] are deprecated. - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, - kUnknownAutoFillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, + kUnknownAutofillTypeDefinition, // CREDIT_CARD_NAME - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // CREDIT_CARD_NUMBER - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // CREDIT_CARD_EXP_MONTH - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // CREDIT_CARD_EXP_2_DIGIT_YEAR - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // CREDIT_CARD_EXP_4_DIGIT_YEAR - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // CREDIT_CARD_TYPE - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // CREDIT_CARD_VERIFICATION_CODE - { AutoFillType::CREDIT_CARD, AutoFillType::NO_SUBGROUP }, + { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, // COMPANY_NAME - { AutoFillType::CONTACT_INFO, AutoFillType::NO_SUBGROUP }, + { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, }; } // namespace -AutoFillType::AutoFillType(AutofillFieldType field_type) { +AutofillType::AutofillType(AutofillFieldType field_type) { if ((field_type < NO_SERVER_DATA || field_type >= MAX_VALID_FIELD_TYPE) || (field_type >= 15 && field_type <= 19) || (field_type >= 25 && field_type <= 29) || @@ -147,30 +147,30 @@ AutoFillType::AutoFillType(AutofillFieldType field_type) { field_type_ = field_type; } -AutoFillType::AutoFillType(const AutoFillType& autofill_type) { +AutofillType::AutofillType(const AutofillType& autofill_type) { *this = autofill_type; } -AutoFillType& AutoFillType::operator=(const AutoFillType& autofill_type) { +AutofillType& AutofillType::operator=(const AutofillType& autofill_type) { if (this != &autofill_type) this->field_type_ = autofill_type.field_type_; return *this; } -AutofillFieldType AutoFillType::field_type() const { +AutofillFieldType AutofillType::field_type() const { return field_type_; } -FieldTypeGroup AutoFillType::group() const { - return kAutoFillTypeDefinitions[field_type_].group; +FieldTypeGroup AutofillType::group() const { + return kAutofillTypeDefinitions[field_type_].group; } -FieldTypeSubGroup AutoFillType::subgroup() const { - return kAutoFillTypeDefinitions[field_type_].subgroup; +FieldTypeSubGroup AutofillType::subgroup() const { + return kAutofillTypeDefinitions[field_type_].subgroup; } // static -AutofillFieldType AutoFillType::GetEquivalentFieldType( +AutofillFieldType AutofillType::GetEquivalentFieldType( AutofillFieldType field_type) { // When billing information is requested from the profile we map to the // home address equivalents. @@ -202,7 +202,7 @@ AutofillFieldType AutoFillType::GetEquivalentFieldType( } // static -std::string AutoFillType::FieldTypeToString(AutofillFieldType type) { +std::string AutofillType::FieldTypeToString(AutofillFieldType type) { switch (type) { case NO_SERVER_DATA: return "NO_SERVER_DATA"; @@ -299,7 +299,7 @@ std::string AutoFillType::FieldTypeToString(AutofillFieldType type) { } // static -AutofillFieldType AutoFillType::StringToFieldType(const std::string& str) { +AutofillFieldType AutofillType::StringToFieldType(const std::string& str) { if (str == "NO_SERVER_DATA") return NO_SERVER_DATA; if (str == "UNKNOWN_TYPE") diff --git a/chrome/browser/autofill/autofill_type.h b/chrome/browser/autofill/autofill_type.h index e634f7e..dc24c86 100644 --- a/chrome/browser/autofill/autofill_type.h +++ b/chrome/browser/autofill/autofill_type.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,7 @@ // The high-level description of AutoFill types, used to categorize form fields // and for associating form fields with form values in the Web Database. -class AutoFillType { +class AutofillType { public: enum FieldTypeGroup { NO_GROUP, @@ -46,14 +46,14 @@ class AutoFillType { PHONE_WHOLE_NUMBER }; - struct AutoFillTypeDefinition { + struct AutofillTypeDefinition { FieldTypeGroup group; FieldTypeSubGroup subgroup; }; - explicit AutoFillType(AutofillFieldType field_type); - AutoFillType(const AutoFillType& autofill_type); - AutoFillType& operator=(const AutoFillType& autofill_type); + explicit AutofillType(AutofillFieldType field_type); + AutofillType(const AutofillType& autofill_type); + AutofillType& operator=(const AutofillType& autofill_type); AutofillFieldType field_type() const; FieldTypeGroup group() const; @@ -72,8 +72,8 @@ class AutoFillType { AutofillFieldType field_type_; }; -typedef AutoFillType::FieldTypeGroup FieldTypeGroup; -typedef AutoFillType::FieldTypeSubGroup FieldTypeSubGroup; +typedef AutofillType::FieldTypeGroup FieldTypeGroup; +typedef AutofillType::FieldTypeSubGroup FieldTypeSubGroup; typedef std::set<AutofillFieldType> FieldTypeSet; typedef std::map<string16, AutofillFieldType> FieldTypeMap; diff --git a/chrome/browser/autofill/autofill_type_unittest.cc b/chrome/browser/autofill/autofill_type_unittest.cc index d764eed..6f812e2 100644 --- a/chrome/browser/autofill/autofill_type_unittest.cc +++ b/chrome/browser/autofill/autofill_type_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,54 +7,54 @@ namespace { -TEST(AutoFillTypeTest, Basic) { +TEST(AutofillTypeTest, Basic) { // No server data. - AutoFillType none(NO_SERVER_DATA); + AutofillType none(NO_SERVER_DATA); EXPECT_EQ(NO_SERVER_DATA, none.field_type()); - EXPECT_EQ(AutoFillType::NO_GROUP, none.group()); - EXPECT_EQ(AutoFillType::NO_SUBGROUP, none.subgroup()); + EXPECT_EQ(AutofillType::NO_GROUP, none.group()); + EXPECT_EQ(AutofillType::NO_SUBGROUP, none.subgroup()); // Unknown type. - AutoFillType unknown(UNKNOWN_TYPE); + AutofillType unknown(UNKNOWN_TYPE); EXPECT_EQ(UNKNOWN_TYPE, unknown.field_type()); - EXPECT_EQ(AutoFillType::NO_GROUP, unknown.group()); - EXPECT_EQ(AutoFillType::NO_SUBGROUP, unknown.subgroup()); + EXPECT_EQ(AutofillType::NO_GROUP, unknown.group()); + EXPECT_EQ(AutofillType::NO_SUBGROUP, unknown.subgroup()); // Type with group but no subgroup. - AutoFillType first(NAME_FIRST); + AutofillType first(NAME_FIRST); EXPECT_EQ(NAME_FIRST, first.field_type()); - EXPECT_EQ(AutoFillType::CONTACT_INFO, first.group()); - EXPECT_EQ(AutoFillType::NO_SUBGROUP, first.subgroup()); + EXPECT_EQ(AutofillType::CONTACT_INFO, first.group()); + EXPECT_EQ(AutofillType::NO_SUBGROUP, first.subgroup()); // Type with group and subgroup. - AutoFillType phone(PHONE_HOME_NUMBER); + AutofillType phone(PHONE_HOME_NUMBER); EXPECT_EQ(PHONE_HOME_NUMBER, phone.field_type()); - EXPECT_EQ(AutoFillType::PHONE_HOME, phone.group()); - EXPECT_EQ(AutoFillType::PHONE_NUMBER, phone.subgroup()); + EXPECT_EQ(AutofillType::PHONE_HOME, phone.group()); + EXPECT_EQ(AutofillType::PHONE_NUMBER, phone.subgroup()); // Last value, to check any offset errors. - AutoFillType last(COMPANY_NAME); + AutofillType last(COMPANY_NAME); EXPECT_EQ(COMPANY_NAME, last.field_type()); - EXPECT_EQ(AutoFillType::CONTACT_INFO, last.group()); - EXPECT_EQ(AutoFillType::NO_SUBGROUP, last.subgroup()); + EXPECT_EQ(AutofillType::CONTACT_INFO, last.group()); + EXPECT_EQ(AutofillType::NO_SUBGROUP, last.subgroup()); // Boundary (error) condition. - AutoFillType boundary(MAX_VALID_FIELD_TYPE); + AutofillType boundary(MAX_VALID_FIELD_TYPE); EXPECT_EQ(UNKNOWN_TYPE, boundary.field_type()); - EXPECT_EQ(AutoFillType::NO_GROUP, boundary.group()); - EXPECT_EQ(AutoFillType::NO_SUBGROUP, boundary.subgroup()); + EXPECT_EQ(AutofillType::NO_GROUP, boundary.group()); + EXPECT_EQ(AutofillType::NO_SUBGROUP, boundary.subgroup()); // Beyond the boundary (error) condition. - AutoFillType beyond(static_cast<AutofillFieldType>(MAX_VALID_FIELD_TYPE+10)); + AutofillType beyond(static_cast<AutofillFieldType>(MAX_VALID_FIELD_TYPE+10)); EXPECT_EQ(UNKNOWN_TYPE, beyond.field_type()); - EXPECT_EQ(AutoFillType::NO_GROUP, beyond.group()); - EXPECT_EQ(AutoFillType::NO_SUBGROUP, beyond.subgroup()); + EXPECT_EQ(AutofillType::NO_GROUP, beyond.group()); + EXPECT_EQ(AutofillType::NO_SUBGROUP, beyond.subgroup()); // In-between value. Missing from enum but within range. Error condition. - AutoFillType between(static_cast<AutofillFieldType>(16)); + AutofillType between(static_cast<AutofillFieldType>(16)); EXPECT_EQ(UNKNOWN_TYPE, between.field_type()); - EXPECT_EQ(AutoFillType::NO_GROUP, between.group()); - EXPECT_EQ(AutoFillType::NO_SUBGROUP, between.subgroup()); + EXPECT_EQ(AutofillType::NO_GROUP, between.group()); + EXPECT_EQ(AutofillType::NO_SUBGROUP, between.subgroup()); } } // namespace diff --git a/chrome/browser/autofill/autofill_xml_parser_unittest.cc b/chrome/browser/autofill/autofill_xml_parser_unittest.cc index 5f5146c..0732992 100644 --- a/chrome/browser/autofill/autofill_xml_parser_unittest.cc +++ b/chrome/browser/autofill/autofill_xml_parser_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -186,7 +186,7 @@ TEST(AutoFillQueryXmlParserTest, ParseErrors) { EXPECT_TRUE(parse_handler->succeeded()); EXPECT_EQ(USE_UPLOAD_RATES, upload_required); ASSERT_EQ(1U, field_types.size()); - // AutoFillType was out of range and should be set to NO_SERVER_DATA. + // AutofillType was out of range and should be set to NO_SERVER_DATA. EXPECT_EQ(NO_SERVER_DATA, field_types[0]); EXPECT_EQ(std::string(), experiment_id); diff --git a/chrome/browser/autofill/contact_info.cc b/chrome/browser/autofill/contact_info.cc index 0beb1e3..c951d660 100644 --- a/chrome/browser/autofill/contact_info.cc +++ b/chrome/browser/autofill/contact_info.cc @@ -88,7 +88,7 @@ void ContactInfo::GetAvailableFieldTypes(FieldTypeSet* available_types) const { available_types->insert(COMPANY_NAME); } -void ContactInfo::FindInfoMatches(const AutoFillType& type, +void ContactInfo::FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const { DCHECK(matched_text); @@ -104,7 +104,7 @@ void ContactInfo::FindInfoMatches(const AutoFillType& type, } } -string16 ContactInfo::GetFieldText(const AutoFillType& type) const { +string16 ContactInfo::GetFieldText(const AutofillType& type) const { AutofillFieldType field_type = type.field_type(); if (field_type == NAME_FIRST) return first(); @@ -133,9 +133,9 @@ string16 ContactInfo::GetFieldText(const AutoFillType& type) const { return string16(); } -void ContactInfo::SetInfo(const AutoFillType& type, const string16& value) { +void ContactInfo::SetInfo(const AutofillType& type, const string16& value) { AutofillFieldType field_type = type.field_type(); - DCHECK_EQ(AutoFillType::CONTACT_INFO, type.group()); + DCHECK_EQ(AutofillType::CONTACT_INFO, type.group()); if (field_type == NAME_FIRST) SetFirst(value); else if (field_type == NAME_MIDDLE || field_type == NAME_MIDDLE_INITIAL) diff --git a/chrome/browser/autofill/contact_info.h b/chrome/browser/autofill/contact_info.h index 98692ac..d743630 100644 --- a/chrome/browser/autofill/contact_info.h +++ b/chrome/browser/autofill/contact_info.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,11 +24,11 @@ class ContactInfo : public FormGroup { virtual void GetPossibleFieldTypes(const string16& text, FieldTypeSet* possible_types) const; virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; - virtual void FindInfoMatches(const AutoFillType& type, + virtual void FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(const AutoFillType& type) const; - virtual void SetInfo(const AutoFillType& type, const string16& value); + virtual string16 GetFieldText(const AutofillType& type) const; + virtual void SetInfo(const AutofillType& type, const string16& value); private: friend class ContactInfoTest; diff --git a/chrome/browser/autofill/credit_card.cc b/chrome/browser/autofill/credit_card.cc index 93e6e4e..3954a99 100644 --- a/chrome/browser/autofill/credit_card.cc +++ b/chrome/browser/autofill/credit_card.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,10 +7,10 @@ #include <string> #include "base/basictypes.h" +#include "base/string16.h" +#include "base/string_number_conversions.h" #include "base/string_split.h" #include "base/string_util.h" -#include "base/string_number_conversions.h" -#include "base/string16.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/field_types.h" @@ -189,7 +189,7 @@ void CreditCard::GetAvailableFieldTypes(FieldTypeSet* available_types) const { available_types->insert(CREDIT_CARD_NUMBER); } -void CreditCard::FindInfoMatches(const AutoFillType& type, +void CreditCard::FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const { DCHECK(matched_text); @@ -200,7 +200,7 @@ void CreditCard::FindInfoMatches(const AutoFillType& type, // Because the credit card number is encrypted and we are not able to do // comparisons with it we will say that any field that is known to be a // credit card number field will match all credit card numbers. - string16 text = GetPreviewText(AutoFillType(CREDIT_CARD_NUMBER)); + string16 text = GetPreviewText(AutofillType(CREDIT_CARD_NUMBER)); if (!text.empty()) matched_text->push_back(text); break; @@ -224,7 +224,7 @@ void CreditCard::FindInfoMatches(const AutoFillType& type, } } -string16 CreditCard::GetFieldText(const AutoFillType& type) const { +string16 CreditCard::GetFieldText(const AutofillType& type) const { switch (type.field_type()) { case CREDIT_CARD_NAME: return name_on_card(); @@ -271,7 +271,7 @@ string16 CreditCard::GetFieldText(const AutoFillType& type) const { } } -string16 CreditCard::GetPreviewText(const AutoFillType& type) const { +string16 CreditCard::GetPreviewText(const AutofillType& type) const { switch (type.field_type()) { case CREDIT_CARD_NUMBER: return last_four_digits(); @@ -285,7 +285,7 @@ string16 CreditCard::GetPreviewText(const AutoFillType& type) const { } } -void CreditCard::SetInfo(const AutoFillType& type, const string16& value) { +void CreditCard::SetInfo(const AutofillType& type, const string16& value) { switch (type.field_type()) { case CREDIT_CARD_NAME: set_name_on_card(value); @@ -416,8 +416,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(AutoFillType(types[index])).compare( - credit_card.GetFieldText(AutoFillType(types[index]))); + int comparison = GetFieldText(AutofillType(types[index])).compare( + credit_card.GetFieldText(AutofillType(types[index]))); if (comparison != 0) return comparison; } @@ -646,17 +646,17 @@ std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) { << " " << credit_card.guid() << " " - << UTF16ToUTF8(credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NAME))) + << UTF16ToUTF8(credit_card.GetFieldText(AutofillType(CREDIT_CARD_NAME))) << " " - << UTF16ToUTF8(credit_card.GetFieldText(AutoFillType(CREDIT_CARD_TYPE))) + << UTF16ToUTF8(credit_card.GetFieldText(AutofillType(CREDIT_CARD_TYPE))) << " " - << UTF16ToUTF8(credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER))) + << UTF16ToUTF8(credit_card.GetFieldText(AutofillType(CREDIT_CARD_NUMBER))) << " " << UTF16ToUTF8(credit_card.GetFieldText( - AutoFillType(CREDIT_CARD_EXP_MONTH))) + AutofillType(CREDIT_CARD_EXP_MONTH))) << " " << UTF16ToUTF8(credit_card.GetFieldText( - AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); + AutofillType(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 3b3a99b..ab18c5a 100644 --- a/chrome/browser/autofill/credit_card.h +++ b/chrome/browser/autofill/credit_card.h @@ -26,12 +26,12 @@ class CreditCard : public FormGroup { virtual void GetPossibleFieldTypes(const string16& text, FieldTypeSet* possible_types) const; virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; - virtual void FindInfoMatches(const AutoFillType& type, + virtual void FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(const AutoFillType& type) const; - virtual string16 GetPreviewText(const AutoFillType& type) const; - virtual void SetInfo(const AutoFillType& type, const string16& value); + virtual string16 GetFieldText(const AutofillType& type) const; + virtual string16 GetPreviewText(const AutofillType& type) const; + virtual void SetInfo(const AutofillType& type, const string16& value); virtual const string16 Label() const; // Special method to set value for HTML5 month input type. diff --git a/chrome/browser/autofill/credit_card_field.cc b/chrome/browser/autofill/credit_card_field.cc index f0c4e80..0a0ac43 100644 --- a/chrome/browser/autofill/credit_card_field.cc +++ b/chrome/browser/autofill/credit_card_field.cc @@ -12,7 +12,7 @@ #include "ui/base/l10n/l10n_util.h" bool CreditCardField::GetFieldInfo(FieldTypeMap* field_type_map) const { - bool ok = Add(field_type_map, number_, AutoFillType(CREDIT_CARD_NUMBER)); + bool ok = Add(field_type_map, number_, AutofillType(CREDIT_CARD_NUMBER)); DCHECK(ok); // If the heuristics detected first and last name in separate fields, @@ -21,17 +21,17 @@ bool CreditCardField::GetFieldInfo(FieldTypeMap* field_type_map) const { // initial. if (cardholder_last_ == NULL) { // Add() will check if cardholder_ is != NULL. - ok = ok && Add(field_type_map, cardholder_, AutoFillType(CREDIT_CARD_NAME)); + ok = ok && Add(field_type_map, cardholder_, AutofillType(CREDIT_CARD_NAME)); DCHECK(ok); } - ok = ok && Add(field_type_map, type_, AutoFillType(CREDIT_CARD_TYPE)); + ok = ok && Add(field_type_map, type_, AutofillType(CREDIT_CARD_TYPE)); DCHECK(ok); ok = ok && Add(field_type_map, expiration_month_, - AutoFillType(CREDIT_CARD_EXP_MONTH)); + AutofillType(CREDIT_CARD_EXP_MONTH)); DCHECK(ok); ok = ok && Add(field_type_map, expiration_year_, - AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); + AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); DCHECK(ok); return ok; diff --git a/chrome/browser/autofill/form_field.cc b/chrome/browser/autofill/form_field.cc index ab32729..c34e27d 100644 --- a/chrome/browser/autofill/form_field.cc +++ b/chrome/browser/autofill/form_field.cc @@ -66,7 +66,7 @@ const char kEcmlCardExpireYear[] = "ecom_payment_card_expdate_year"; class EmailField : public FormField { public: virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const { - bool ok = Add(field_type_map, field_, AutoFillType(EMAIL_ADDRESS)); + bool ok = Add(field_type_map, field_, AutofillType(EMAIL_ADDRESS)); DCHECK(ok); return true; } @@ -238,7 +238,7 @@ bool FormField::ParseEmpty(std::vector<AutofillField*>::const_iterator* iter) { // static bool FormField::Add(FieldTypeMap* field_type_map, AutofillField* field, - const AutoFillType& type) { + const AutofillType& type) { // Several fields are optional. if (field) field_type_map->insert(make_pair(field->unique_name(), type.field_type())); diff --git a/chrome/browser/autofill/form_field.h b/chrome/browser/autofill/form_field.h index 03c9f7d..7d663f6 100644 --- a/chrome/browser/autofill/form_field.h +++ b/chrome/browser/autofill/form_field.h @@ -70,7 +70,7 @@ class FormField { public: virtual ~FormField() {} - // Associates the available AutoFillTypes of a FormField into + // Associates the available AutofillTypes of a FormField into // |field_type_map|. virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const = 0; @@ -116,7 +116,7 @@ class FormField { // Adds an association between a field and a type to |field_type_map|. static bool Add(FieldTypeMap* field_type_map, AutofillField* field, - const AutoFillType& type); + const AutofillType& type); protected: // Only derived classes may instantiate. diff --git a/chrome/browser/autofill/form_group.cc b/chrome/browser/autofill/form_group.cc index f702a3a..3f77f8f 100644 --- a/chrome/browser/autofill/form_group.cc +++ b/chrome/browser/autofill/form_group.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,7 +8,7 @@ #include <iterator> -string16 FormGroup::GetPreviewText(const AutoFillType& type) const { +string16 FormGroup::GetPreviewText(const AutofillType& type) const { return GetFieldText(type); } @@ -35,7 +35,7 @@ bool FormGroup::IsSubsetOf(const FormGroup& form_group) const { for (FieldTypeSet::const_iterator iter = types.begin(); iter != types.end(); ++iter) { - AutoFillType type(*iter); + AutofillType type(*iter); if (GetFieldText(type) != form_group.GetFieldText(type)) return false; } @@ -58,7 +58,7 @@ bool FormGroup::IntersectionOfTypesHasEqualValues( for (FieldTypeSet::const_iterator iter = intersection.begin(); iter != intersection.end(); ++iter) { - AutoFillType type(*iter); + AutofillType type(*iter); if (GetFieldText(type) != form_group.GetFieldText(type)) return false; } @@ -76,7 +76,7 @@ void FormGroup::MergeWith(const FormGroup& form_group) { for (FieldTypeSet::const_iterator iter = intersection.begin(); iter != intersection.end(); ++iter) { - AutoFillType type(*iter); + AutofillType type(*iter); SetInfo(type, form_group.GetFieldText(type)); } } @@ -86,7 +86,7 @@ void FormGroup::OverwriteWith(const FormGroup& form_group) { form_group.GetAvailableFieldTypes(&a); for (FieldTypeSet::const_iterator iter = a.begin(); iter != a.end(); ++iter) { - AutoFillType type(*iter); + AutofillType type(*iter); SetInfo(type, form_group.GetFieldText(type)); } } diff --git a/chrome/browser/autofill/form_group.h b/chrome/browser/autofill/form_group.h index dd40fcd..de1229f 100644 --- a/chrome/browser/autofill/form_group.h +++ b/chrome/browser/autofill/form_group.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -35,21 +35,21 @@ class FormGroup { // Returns the string that should be auto-filled into a text field given the // type of that field. - virtual string16 GetFieldText(const AutoFillType& type) const = 0; + virtual string16 GetFieldText(const AutofillType& type) const = 0; // Returns the text for preview. - virtual string16 GetPreviewText(const AutoFillType& type) const; + virtual string16 GetPreviewText(const AutofillType& type) const; // Used to determine if the text being typed into a field matches the // information in this FormGroup object. This is used by the preview // functionality. |matched_text| will be populated with all of the possible // matches given the type. This method is additive on |matched_text|. - virtual void FindInfoMatches(const AutoFillType& type, + virtual void FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const = 0; // Used to populate this FormGroup object with data. - virtual void SetInfo(const AutoFillType& type, const string16& value) = 0; + virtual void SetInfo(const AutofillType& type, const string16& value) = 0; // Returns the label for this FormGroup item. This should be overridden for // form group items that implement a label. diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index 539c124..cef629d 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -25,7 +25,7 @@ const char kFormMethodPost[] = "post"; // XML elements and attributes. const char kAttributeAcceptedFeatures[] = "accepts"; const char kAttributeAutoFillUsed[] = "autofillused"; -const char kAttributeAutoFillType[] = "autofilltype"; +const char kAttributeAutofillType[] = "autofilltype"; const char kAttributeClientVersion[] = "clientversion"; const char kAttributeDataPresent[] = "datapresent"; const char kAttributeFormSignature[] = "formsignature"; @@ -68,7 +68,7 @@ FormStructure::FormStructure(const FormData& form) // Terminate the vector with a NULL item. fields_.push_back(NULL); - GetHeuristicAutoFillTypes(); + GetHeuristicAutofillTypes(); std::string method = UTF16ToUTF8(form.method); if (StringToLowerASCII(method) == kFormMethodPost) { @@ -218,8 +218,8 @@ void FormStructure::ParseQueryResponse(const std::string& response_xml, if (heuristic_type != (*field)->type()) query_response_overrode_heuristics = true; - AutoFillType autofill_type((*field)->type()); - if (autofill_type.group() == AutoFillType::CREDIT_CARD) + AutofillType autofill_type((*field)->type()); + if (autofill_type.group() == AutofillType::CREDIT_CARD) form->has_credit_card_field_ = true; if (autofill_type.field_type() != UNKNOWN_TYPE) form->has_autofillable_field_ = true; @@ -358,7 +358,7 @@ std::string FormStructure::Hash64Bit(const std::string& str) { return base::Uint64ToString(hash64); } -void FormStructure::GetHeuristicAutoFillTypes() { +void FormStructure::GetHeuristicAutofillTypes() { has_credit_card_field_ = false; has_autofillable_field_ = false; @@ -380,8 +380,8 @@ void FormStructure::GetHeuristicAutoFillTypes() { field->set_heuristic_type(heuristic_auto_fill_type); - AutoFillType autofill_type(field->type()); - if (autofill_type.group() == AutoFillType::CREDIT_CARD) + AutofillType autofill_type(field->type()); + if (autofill_type.group() == AutofillType::CREDIT_CARD) has_credit_card_field_ = true; if (autofill_type.field_type() != UNKNOWN_TYPE) has_autofillable_field_ = true; @@ -425,7 +425,7 @@ bool FormStructure::EncodeFormRequest( field_element->SetAttr(buzz::QName(kAttributeSignature), field->FieldSignature()); - field_element->SetAttr(buzz::QName(kAttributeAutoFillType), + field_element->SetAttr(buzz::QName(kAttributeAutofillType), base::IntToString(*field_type)); encompassing_xml_element->AddElement(field_element); } diff --git a/chrome/browser/autofill/form_structure.h b/chrome/browser/autofill/form_structure.h index 664b181..69d4f19 100644 --- a/chrome/browser/autofill/form_structure.h +++ b/chrome/browser/autofill/form_structure.h @@ -123,7 +123,7 @@ class FormStructure { // Runs several heuristics against the form fields to determine their possible // types. - void GetHeuristicAutoFillTypes(); + void GetHeuristicAutofillTypes(); // Associates the field with the heuristic type for each of the field views. void GetHeuristicFieldInfo(FieldTypeMap* field_types_map); diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc index 02e91a0..8fb100b 100644 --- a/chrome/browser/autofill/form_structure_browsertest.cc +++ b/chrome/browser/autofill/form_structure_browsertest.cc @@ -80,7 +80,7 @@ std::string FormStructureBrowserTest::FormStructuresToString( // The field list is NULL-terminated. Exit loop when at the end. if (!*field_iter) break; - forms_string += AutoFillType::FieldTypeToString((*field_iter)->type()); + forms_string += AutofillType::FieldTypeToString((*field_iter)->type()); forms_string += "\n"; } } diff --git a/chrome/browser/autofill/name_field.cc b/chrome/browser/autofill/name_field.cc index 5fa49cd..63fa602 100644 --- a/chrome/browser/autofill/name_field.cc +++ b/chrome/browser/autofill/name_field.cc @@ -22,7 +22,7 @@ NameField* NameField::Parse(std::vector<AutofillField*>::const_iterator* iter, } bool FullNameField::GetFieldInfo(FieldTypeMap* field_type_map) const { - bool ok = Add(field_type_map, field_, AutoFillType(NAME_FULL)); + bool ok = Add(field_type_map, field_, AutofillType(NAME_FULL)); DCHECK(ok); return true; } @@ -153,12 +153,12 @@ FirstLastNameField* FirstLastNameField::Parse( } bool FirstLastNameField::GetFieldInfo(FieldTypeMap* field_type_map) const { - bool ok = Add(field_type_map, first_name_, AutoFillType(NAME_FIRST)); + bool ok = Add(field_type_map, first_name_, AutofillType(NAME_FIRST)); DCHECK(ok); - ok = ok && Add(field_type_map, last_name_, AutoFillType(NAME_LAST)); + ok = ok && Add(field_type_map, last_name_, AutofillType(NAME_LAST)); DCHECK(ok); - AutoFillType type = middle_initial_ ? - AutoFillType(NAME_MIDDLE_INITIAL) : AutoFillType(NAME_MIDDLE); + AutofillType type = middle_initial_ ? + AutofillType(NAME_MIDDLE_INITIAL) : AutofillType(NAME_MIDDLE); ok = ok && Add(field_type_map, middle_name_, type); DCHECK(ok); diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc index 8b7410b..7962529 100644 --- a/chrome/browser/autofill/personal_data_manager.cc +++ b/chrome/browser/autofill/personal_data_manager.cc @@ -87,10 +87,10 @@ bool IsValidEmail(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(AutoFillType(ADDRESS_HOME_LINE1)).empty() && - !profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY)).empty() && - !profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE)).empty() && - !profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)).empty(); + return !profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1)).empty() && + !profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY)).empty() && + !profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE)).empty() && + !profile.GetFieldText(AutofillType(ADDRESS_HOME_ZIP)).empty(); } // Whether we have already logged the number of profiles this session. @@ -189,10 +189,10 @@ bool PersonalDataManager::ImportFormData( if (!field->IsFieldFillable() || value.empty()) continue; - AutoFillType field_type(field->type()); + AutofillType field_type(field->type()); FieldTypeGroup group(field_type.group()); - if (group == AutoFillType::CREDIT_CARD) { + if (group == AutofillType::CREDIT_CARD) { // If the user has a password set, we have no way of setting credit // card numbers. if (!HasPassword()) { @@ -201,14 +201,14 @@ bool PersonalDataManager::ImportFormData( local_imported_credit_card->SetInfoForMonthInputType(value); } else { local_imported_credit_card->SetInfo( - AutoFillType(field_type.field_type()), value); + AutofillType(field_type.field_type()), value); } ++importable_credit_card_fields; } } else { // In the case of a phone number, if the whole phone number was entered // into a single field, then parse it and set the sub components. - if (field_type.subgroup() == AutoFillType::PHONE_WHOLE_NUMBER) { + if (field_type.subgroup() == AutofillType::PHONE_WHOLE_NUMBER) { string16 number; string16 city_code; string16 country_code; @@ -219,18 +219,18 @@ bool PersonalDataManager::ImportFormData( if (number.empty()) continue; - if (group == AutoFillType::PHONE_HOME) { - imported_profile->SetInfo(AutoFillType(PHONE_HOME_COUNTRY_CODE), + if (group == AutofillType::PHONE_HOME) { + imported_profile->SetInfo(AutofillType(PHONE_HOME_COUNTRY_CODE), country_code); - imported_profile->SetInfo(AutoFillType(PHONE_HOME_CITY_CODE), + imported_profile->SetInfo(AutofillType(PHONE_HOME_CITY_CODE), city_code); - imported_profile->SetInfo(AutoFillType(PHONE_HOME_NUMBER), number); - } else if (group == AutoFillType::PHONE_FAX) { - imported_profile->SetInfo(AutoFillType(PHONE_FAX_COUNTRY_CODE), + imported_profile->SetInfo(AutofillType(PHONE_HOME_NUMBER), number); + } else if (group == AutofillType::PHONE_FAX) { + imported_profile->SetInfo(AutofillType(PHONE_FAX_COUNTRY_CODE), country_code); - imported_profile->SetInfo(AutoFillType(PHONE_FAX_CITY_CODE), + imported_profile->SetInfo(AutofillType(PHONE_FAX_CITY_CODE), city_code); - imported_profile->SetInfo(AutoFillType(PHONE_FAX_NUMBER), number); + imported_profile->SetInfo(AutofillType(PHONE_FAX_NUMBER), number); } continue; @@ -239,11 +239,11 @@ bool PersonalDataManager::ImportFormData( // Phone and fax numbers can be split across multiple fields, so we // might have already stored the prefix, and now be at the suffix. // If so, combine them to form the full number. - if (group == AutoFillType::PHONE_HOME || - group == AutoFillType::PHONE_FAX) { - AutoFillType number_type(PHONE_HOME_NUMBER); - if (group == AutoFillType::PHONE_FAX) - number_type = AutoFillType(PHONE_FAX_NUMBER); + if (group == AutofillType::PHONE_HOME || + group == AutofillType::PHONE_FAX) { + AutofillType number_type(PHONE_HOME_NUMBER); + if (group == AutofillType::PHONE_FAX) + number_type = AutofillType(PHONE_FAX_NUMBER); string16 stored_number = imported_profile->GetFieldText(number_type); if (stored_number.size() == @@ -256,7 +256,7 @@ bool PersonalDataManager::ImportFormData( if (field_type.field_type() == EMAIL_ADDRESS && !IsValidEmail(value)) continue; - imported_profile->SetInfo(AutoFillType(field_type.field_type()), + imported_profile->SetInfo(AutofillType(field_type.field_type()), value); ++importable_fields; } @@ -275,7 +275,7 @@ bool PersonalDataManager::ImportFormData( if (local_imported_credit_card.get() && !CreditCard::IsCreditCardNumber(local_imported_credit_card->GetFieldText( - AutoFillType(CREDIT_CARD_NUMBER)))) { + AutofillType(CREDIT_CARD_NUMBER)))) { local_imported_credit_card.reset(); } diff --git a/chrome/browser/autofill/personal_data_manager_mac.mm b/chrome/browser/autofill/personal_data_manager_mac.mm index a081122..838ef6c 100644 --- a/chrome/browser/autofill/personal_data_manager_mac.mm +++ b/chrome/browser/autofill/personal_data_manager_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -111,14 +111,14 @@ void AuxiliaryProfilesImpl::GetAddressBookNames( NSString* lastName = [me valueForProperty:kABLastNameProperty]; NSString* companyName = [me valueForProperty:kABOrganizationProperty]; - profile->SetInfo(AutoFillType(NAME_FIRST), + profile->SetInfo(AutofillType(NAME_FIRST), base::SysNSStringToUTF16(firstName)); - profile->SetInfo(AutoFillType(NAME_MIDDLE), + profile->SetInfo(AutofillType(NAME_MIDDLE), base::SysNSStringToUTF16(middleName)); - profile->SetInfo(AutoFillType(NAME_LAST), + profile->SetInfo(AutofillType(NAME_LAST), base::SysNSStringToUTF16(lastName)); if ([addressLabelRaw isEqualToString:kABAddressWorkLabel]) { - profile->SetInfo(AutoFillType(COMPANY_NAME), + profile->SetInfo(AutofillType(COMPANY_NAME), base::SysNSStringToUTF16(companyName)); } } @@ -146,30 +146,30 @@ void AuxiliaryProfilesImpl::GetAddressBookAddresses( NSString* addressField2 = [[chunks subarrayWithRange:NSMakeRange(1, [chunks count] - 1)] componentsJoinedByString:separator]; - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1), base::SysNSStringToUTF16(addressField1)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE2), + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE2), base::SysNSStringToUTF16(addressField2)); } else { - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1), base::SysNSStringToUTF16(addressField)); } } if (NSString* city = [address objectForKey:kABAddressCityKey]) { - profile->SetInfo(AutoFillType(ADDRESS_HOME_CITY), + profile->SetInfo(AutofillType(ADDRESS_HOME_CITY), base::SysNSStringToUTF16(city)); } if (NSString* state = [address objectForKey:kABAddressStateKey]) { - profile->SetInfo(AutoFillType(ADDRESS_HOME_STATE), + profile->SetInfo(AutofillType(ADDRESS_HOME_STATE), base::SysNSStringToUTF16(state)); } if (NSString* zip = [address objectForKey:kABAddressZIPKey]) { - profile->SetInfo(AutoFillType(ADDRESS_HOME_ZIP), + profile->SetInfo(AutofillType(ADDRESS_HOME_ZIP), base::SysNSStringToUTF16(zip)); } if (NSString* country = [address objectForKey:kABAddressCountryKey]) { - profile->SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), + profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), base::SysNSStringToUTF16(country)); } } @@ -191,7 +191,7 @@ void AuxiliaryProfilesImpl::GetAddressBookEmail( break; } } - profile->SetInfo(AutoFillType(EMAIL_ADDRESS), + profile->SetInfo(AutofillType(EMAIL_ADDRESS), base::SysNSStringToUTF16(emailAddress)); } @@ -218,36 +218,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(AutofillType(PHONE_HOME_NUMBER), number); + profile->SetInfo(AutofillType(PHONE_HOME_CITY_CODE), city_code); + profile->SetInfo(AutofillType(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(AutofillType(PHONE_FAX_NUMBER), number); + profile->SetInfo(AutofillType(PHONE_FAX_CITY_CODE), city_code); + profile->SetInfo(AutofillType(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(AutofillType(PHONE_HOME_NUMBER), number); + profile->SetInfo(AutofillType(PHONE_HOME_CITY_CODE), city_code); + profile->SetInfo(AutofillType(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(AutofillType(PHONE_FAX_NUMBER), number); + profile->SetInfo(AutofillType(PHONE_FAX_CITY_CODE), city_code); + profile->SetInfo(AutofillType(PHONE_FAX_COUNTRY_CODE), country_code); } } } diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc index 6bd1c62..a075abc 100644 --- a/chrome/browser/autofill/personal_data_manager_unittest.cc +++ b/chrome/browser/autofill/personal_data_manager_unittest.cc @@ -26,6 +26,7 @@ #include "webkit/glue/form_data.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "webkit/glue/form_data.h" using webkit_glue::FormData; @@ -129,7 +130,7 @@ TEST_F(PersonalDataManagerTest, SetProfiles) { // - Update profile0 // - Remove profile1 // - Add profile2 - profile0.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("John")); + profile0.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("John")); update.clear(); update.push_back(profile0); update.push_back(profile2); @@ -197,7 +198,7 @@ TEST_F(PersonalDataManagerTest, SetCreditCards) { // - Update creditcard0 // - Remove creditcard1 // - Add creditcard2 - creditcard0.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); + creditcard0.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Joe")); update.clear(); update.push_back(creditcard0); update.push_back(creditcard2); @@ -498,7 +499,7 @@ TEST_F(PersonalDataManagerTest, Refresh) { // open with a previous snapshot of the profiles, and something [e.g. sync] // removed a profile from the browser. In this edge case, we will end up // in a consistent state by dropping the write). - profile2.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Jo")); + profile2.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Jo")); update.clear(); update.push_back(profile0); update.push_back(profile1); @@ -696,17 +697,17 @@ TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) { TEST_F(PersonalDataManagerTest, SetUniqueCreditCardLabels) { CreditCard credit_card0; - credit_card0.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("John")); + credit_card0.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("John")); CreditCard credit_card1; - credit_card1.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Paul")); + credit_card1.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Paul")); CreditCard credit_card2; - credit_card2.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Ringo")); + credit_card2.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Ringo")); CreditCard credit_card3; - credit_card3.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Other")); + credit_card3.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Other")); CreditCard credit_card4; - credit_card4.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Ozzy")); + credit_card4.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Ozzy")); CreditCard credit_card5; - credit_card5.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Dio")); + credit_card5.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Dio")); // This will verify that the web database has been loaded and the notification // sent out. diff --git a/chrome/browser/autofill/phone_field.cc b/chrome/browser/autofill/phone_field.cc index 2679abe..cd7e493 100644 --- a/chrome/browser/autofill/phone_field.cc +++ b/chrome/browser/autofill/phone_field.cc @@ -146,33 +146,33 @@ bool PhoneField::GetFieldInfo(FieldTypeMap* field_type_map) const { if (parsed_phone_fields_[FIELD_COUNTRY_CODE] != NULL) { ok = Add(field_type_map, parsed_phone_fields_[FIELD_COUNTRY_CODE], - AutoFillType(number_->GetCountryCodeType())); + AutofillType(number_->GetCountryCodeType())); DCHECK(ok); } if (parsed_phone_fields_[FIELD_AREA_CODE] != NULL) { ok = Add(field_type_map, parsed_phone_fields_[FIELD_AREA_CODE], - AutoFillType(number_->GetCityCodeType())); + AutofillType(number_->GetCityCodeType())); DCHECK(ok); } // We tag the prefix as PHONE_HOME_NUMBER, then when filling the form // we fill only the prefix depending on the size of the input field. ok = Add(field_type_map, parsed_phone_fields_[FIELD_PHONE], - AutoFillType(number_->GetNumberType())); + AutofillType(number_->GetNumberType())); DCHECK(ok); // We tag the suffix as PHONE_HOME_NUMBER, then when filling the form // we fill only the suffix depending on the size of the input field. if (parsed_phone_fields_[FIELD_SUFFIX] != NULL) { ok = Add(field_type_map, parsed_phone_fields_[FIELD_SUFFIX], - AutoFillType(number_->GetNumberType())); + AutofillType(number_->GetNumberType())); DCHECK(ok); } } else { ok = Add(field_type_map, parsed_phone_fields_[FIELD_PHONE], - AutoFillType(number_->GetWholeNumberType())); + AutofillType(number_->GetWholeNumberType())); DCHECK(ok); } diff --git a/chrome/browser/autofill/phone_number.cc b/chrome/browser/autofill/phone_number.cc index c7c0c7c..2b8a0cc 100644 --- a/chrome/browser/autofill/phone_number.cc +++ b/chrome/browser/autofill/phone_number.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,12 +20,12 @@ const size_t kPhoneNumberLength = 7; // The number of digits in an area code. const size_t kPhoneCityCodeLength = 3; -const AutoFillType::FieldTypeSubGroup kAutoFillPhoneTypes[] = { - AutoFillType::PHONE_NUMBER, - AutoFillType::PHONE_CITY_CODE, - AutoFillType::PHONE_COUNTRY_CODE, - AutoFillType::PHONE_CITY_AND_NUMBER, - AutoFillType::PHONE_WHOLE_NUMBER, +const AutofillType::FieldTypeSubGroup kAutoFillPhoneTypes[] = { + AutofillType::PHONE_NUMBER, + AutofillType::PHONE_CITY_CODE, + AutofillType::PHONE_COUNTRY_CODE, + AutofillType::PHONE_CITY_AND_NUMBER, + AutofillType::PHONE_WHOLE_NUMBER, }; const int kAutoFillPhoneLength = arraysize(kAutoFillPhoneTypes); @@ -78,7 +78,7 @@ void PhoneNumber::GetAvailableFieldTypes(FieldTypeSet* available_types) const { available_types->insert(GetWholeNumberType()); } -string16 PhoneNumber::GetFieldText(const AutoFillType& type) const { +string16 PhoneNumber::GetFieldText(const AutofillType& type) const { AutofillFieldType field_type = type.field_type(); if (field_type == GetNumberType()) return number(); @@ -98,7 +98,7 @@ string16 PhoneNumber::GetFieldText(const AutoFillType& type) const { return string16(); } -void PhoneNumber::FindInfoMatches(const AutoFillType& type, +void PhoneNumber::FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const { if (matched_text == NULL) { @@ -123,21 +123,21 @@ void PhoneNumber::FindInfoMatches(const AutoFillType& type, } } -void PhoneNumber::SetInfo(const AutoFillType& type, const string16& value) { +void PhoneNumber::SetInfo(const AutofillType& type, const string16& value) { string16 number(value); StripPunctuation(&number); if (!Validate(number)) return; FieldTypeSubGroup subgroup = type.subgroup(); - if (subgroup == AutoFillType::PHONE_NUMBER) + if (subgroup == AutofillType::PHONE_NUMBER) set_number(number); - else if (subgroup == AutoFillType::PHONE_CITY_CODE) + else if (subgroup == AutofillType::PHONE_CITY_CODE) set_city_code(number); - else if (subgroup == AutoFillType::PHONE_COUNTRY_CODE) + else if (subgroup == AutofillType::PHONE_COUNTRY_CODE) set_country_code(number); - else if (subgroup == AutoFillType::PHONE_CITY_AND_NUMBER || - subgroup == AutoFillType::PHONE_WHOLE_NUMBER) + else if (subgroup == AutofillType::PHONE_CITY_AND_NUMBER || + subgroup == AutofillType::PHONE_WHOLE_NUMBER) set_whole_number(number); else NOTREACHED(); @@ -229,19 +229,19 @@ bool PhoneNumber::FindInfoMatchesHelper(const FieldTypeSubGroup& subgroup, } match->clear(); - if (subgroup == AutoFillType::PHONE_NUMBER && + if (subgroup == AutofillType::PHONE_NUMBER && StartsWith(number(), info, true)) { *match = number(); - } else if (subgroup == AutoFillType::PHONE_CITY_CODE && + } else if (subgroup == AutofillType::PHONE_CITY_CODE && StartsWith(city_code(), info, true)) { *match = city_code(); - } else if (subgroup == AutoFillType::PHONE_COUNTRY_CODE && + } else if (subgroup == AutofillType::PHONE_COUNTRY_CODE && StartsWith(country_code(), info, true)) { *match = country_code(); - } else if (subgroup == AutoFillType::PHONE_CITY_AND_NUMBER && + } else if (subgroup == AutofillType::PHONE_CITY_AND_NUMBER && StartsWith(CityAndNumber(), info, true)) { *match = CityAndNumber(); - } else if (subgroup == AutoFillType::PHONE_WHOLE_NUMBER && + } else if (subgroup == AutofillType::PHONE_WHOLE_NUMBER && StartsWith(WholeNumber(), info, true)) { *match = WholeNumber(); } diff --git a/chrome/browser/autofill/phone_number.h b/chrome/browser/autofill/phone_number.h index 8cf873b..23fcb69 100644 --- a/chrome/browser/autofill/phone_number.h +++ b/chrome/browser/autofill/phone_number.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,8 +8,8 @@ #include <vector> -#include "base/string16.h" #include "base/gtest_prod_util.h" +#include "base/string16.h" #include "chrome/browser/autofill/form_group.h" // A form group that stores phone number information. @@ -23,11 +23,11 @@ class PhoneNumber : public FormGroup { virtual void GetPossibleFieldTypes(const string16& text, FieldTypeSet* possible_types) const; virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; - virtual void FindInfoMatches(const AutoFillType& type, + virtual void FindInfoMatches(const AutofillType& type, const string16& info, std::vector<string16>* matched_text) const; - virtual string16 GetFieldText(const AutoFillType& type) const; - virtual void SetInfo(const AutoFillType& type, const string16& value); + virtual string16 GetFieldText(const AutofillType& type) const; + virtual void SetInfo(const AutofillType& type, const string16& value); // Parses |value| to extract the components of a phone number. |number| // returns the trailing 7 digits, |city_code| returns the next 3 digits, and diff --git a/chrome/browser/autofill/select_control_handler.cc b/chrome/browser/autofill/select_control_handler.cc index c36cf1f..cf1ed31 100644 --- a/chrome/browser/autofill/select_control_handler.cc +++ b/chrome/browser/autofill/select_control_handler.cc @@ -8,8 +8,8 @@ #include "base/basictypes.h" #include "base/logging.h" -#include "base/string_number_conversions.h" #include "base/string16.h" +#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/autofill_country.h" #include "chrome/browser/autofill/autofill_profile.h" @@ -199,7 +199,7 @@ bool FillExpirationMonthSelectControl(const string16& value, namespace autofill { void FillSelectControl(const FormGroup& form_group, - AutoFillType type, + AutofillType type, webkit_glue::FormField* field) { DCHECK(field); DCHECK_EQ(ASCIIToUTF16("select-one"), field->form_control_type()); diff --git a/chrome/browser/autofill/select_control_handler.h b/chrome/browser/autofill/select_control_handler.h index c883e730..bb27148 100644 --- a/chrome/browser/autofill/select_control_handler.h +++ b/chrome/browser/autofill/select_control_handler.h @@ -21,7 +21,7 @@ namespace autofill { // variations of a value, e.g., (tx, TX, Texas) or credit card expiration // months, e.g., (04, April). void FillSelectControl(const FormGroup& form_group, - AutoFillType type, + AutofillType type, webkit_glue::FormField* field); } // namespace autofill diff --git a/chrome/browser/autofill/select_control_handler_unittest.cc b/chrome/browser/autofill/select_control_handler_unittest.cc index 1b40355..c2edd8c 100644 --- a/chrome/browser/autofill/select_control_handler_unittest.cc +++ b/chrome/browser/autofill/select_control_handler_unittest.cc @@ -23,9 +23,9 @@ TEST(SelectControlHandlerTest, CreditCardMonthExact) { field.set_option_strings(options); CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); autofill::FillSelectControl(credit_card, - AutoFillType(CREDIT_CARD_EXP_MONTH), + AutofillType(CREDIT_CARD_EXP_MONTH), &field); EXPECT_EQ(ASCIIToUTF16("01"), field.value()); } @@ -44,9 +44,9 @@ TEST(SelectControlHandlerTest, CreditCardMonthAbbreviated) { field.set_option_strings(options); CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); autofill::FillSelectControl(credit_card, - AutoFillType(CREDIT_CARD_EXP_MONTH), + AutofillType(CREDIT_CARD_EXP_MONTH), &field); EXPECT_EQ(ASCIIToUTF16("Jan"), field.value()); } @@ -65,9 +65,9 @@ TEST(SelectControlHandlerTest, CreditCardMonthFull) { field.set_option_strings(options); CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); autofill::FillSelectControl(credit_card, - AutoFillType(CREDIT_CARD_EXP_MONTH), + AutofillType(CREDIT_CARD_EXP_MONTH), &field); EXPECT_EQ(ASCIIToUTF16("January"), field.value()); } @@ -85,9 +85,9 @@ TEST(SelectControlHandlerTest, CreditCardMonthNumeric) { field.set_option_strings(options); CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); autofill::FillSelectControl(credit_card, - AutoFillType(CREDIT_CARD_EXP_MONTH), + AutofillType(CREDIT_CARD_EXP_MONTH), &field); EXPECT_EQ(ASCIIToUTF16("1"), field.value()); } @@ -105,9 +105,9 @@ TEST(SelectControlHandlerTest, AddressCountryFull) { field.set_option_strings(options); AutoFillProfile profile; - profile.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("CA")); + profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("CA")); autofill::FillSelectControl(profile, - AutoFillType(ADDRESS_HOME_COUNTRY), + AutofillType(ADDRESS_HOME_COUNTRY), &field); EXPECT_EQ(ASCIIToUTF16("Canada"), field.value()); } @@ -125,9 +125,9 @@ TEST(SelectControlHandlerTest, AddressCountryAbbrev) { field.set_option_strings(options); AutoFillProfile profile; - profile.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("Canada")); + profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("Canada")); autofill::FillSelectControl(profile, - AutoFillType(ADDRESS_HOME_COUNTRY), + AutofillType(ADDRESS_HOME_COUNTRY), &field); EXPECT_EQ(ASCIIToUTF16("CA"), field.value()); } @@ -145,9 +145,9 @@ TEST(SelectControlHandlerTest, AddressStateFull) { field.set_option_strings(options); AutoFillProfile profile; - profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); + profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); autofill::FillSelectControl(profile, - AutoFillType(ADDRESS_HOME_STATE), + AutofillType(ADDRESS_HOME_STATE), &field); EXPECT_EQ(ASCIIToUTF16("California"), field.value()); } @@ -165,9 +165,9 @@ TEST(SelectControlHandlerTest, AddressStateAbbrev) { field.set_option_strings(options); AutoFillProfile profile; - profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), ASCIIToUTF16("California")); + profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("California")); autofill::FillSelectControl(profile, - AutoFillType(ADDRESS_HOME_STATE), + AutofillType(ADDRESS_HOME_STATE), &field); EXPECT_EQ(ASCIIToUTF16("CA"), field.value()); } diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 82b62ae..aa76685 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -4250,7 +4250,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(AutoFillType(type_it->first)); + string16 value = profile->GetFieldText(AutofillType(type_it->first)); if (value.length()) { // If there was something stored for that value. profile_info->SetString(type_it->second, value); } @@ -4278,7 +4278,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(AutoFillType(type_it->first)); + string16 value = card->GetFieldText(AutofillType(type_it->first)); // If there was something stored for that value. if (value.length()) { card_info->SetString(type_it->second, value); @@ -4311,7 +4311,7 @@ TestingAutomationProvider::GetAutoFillProfilesFromList( if (profile_info->HasKey(type_it->second)) { if (profile_info->GetString(type_it->second, ¤t_value)) { - profile.SetInfo(AutoFillType(type_it->first), current_value); + profile.SetInfo(AutofillType(type_it->first), current_value); } else { *error_message= "All values must be strings"; break; @@ -4343,7 +4343,7 @@ std::vector<CreditCard> TestingAutomationProvider::GetCreditCardsFromList( type_it != credit_card_type_to_string.end(); ++type_it) { if (card_info->HasKey(type_it->second)) { if (card_info->GetString(type_it->second, ¤t_value)) { - card.SetInfo(AutoFillType(type_it->first), current_value); + card.SetInfo(AutofillType(type_it->first), current_value); } else { *error_message= "All values must be strings"; break; diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc index ae71788..5ecefc6 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_model_associator.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,9 +7,9 @@ #include <functional> #include <vector> +#include "base/string_number_conversions.h" #include "base/task.h" #include "base/time.h" -#include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/profiles/profile.h" @@ -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(AutoFillType(NAME_FIRST)) - << p->GetFieldText(AutoFillType(NAME_LAST)); + << p->GetFieldText(AutofillType(NAME_FIRST)) + << p->GetFieldText(AutofillType(NAME_LAST)); } } @@ -498,9 +498,9 @@ 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(AutoFillType(t))) == specifics_field) + if (UTF16ToUTF8(f->GetFieldText(AutofillType(t))) == specifics_field) return false; - f->SetInfo(AutoFillType(t), UTF8ToUTF16(specifics_field)); + f->SetInfo(AutofillType(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 1ba896b..ccf9c5a 100644 --- a/chrome/browser/sync/glue/autofill_profile_change_processor.cc +++ b/chrome/browser/sync/glue/autofill_profile_change_processor.cc @@ -213,7 +213,7 @@ void AutofillProfileChangeProcessor::ApplyAutofillProfileChange( DCHECK_NE(sync_api::SyncManager::ChangeRecord::ACTION_DELETE, action); switch (action) { case sync_api::SyncManager::ChangeRecord::ACTION_ADD: { - if(guid::IsValidGUID(profile_specifics.guid()) == false) { + if (guid::IsValidGUID(profile_specifics.guid()) == false) { NOTREACHED() << "Guid from the server is invalid " << profile_specifics.guid(); return; @@ -282,7 +282,7 @@ void AutofillProfileChangeProcessor::AddAutofillProfileSyncNode( std::string guid = profile.guid(); - if(guid::IsValidGUID(guid) == false) { + if (guid::IsValidGUID(guid) == false) { DCHECK(false) << "Guid set on the profile is invalid " << guid; return; } @@ -327,31 +327,31 @@ void AutofillProfileChangeProcessor::WriteAutofillProfile( specifics.set_guid(profile.guid()); specifics.set_name_first(UTF16ToUTF8( - profile.GetFieldText(AutoFillType(NAME_FIRST)))); + profile.GetFieldText(AutofillType(NAME_FIRST)))); specifics.set_name_middle(UTF16ToUTF8( - profile.GetFieldText(AutoFillType(NAME_MIDDLE)))); + profile.GetFieldText(AutofillType(NAME_MIDDLE)))); specifics.set_name_last( - UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST)))); + UTF16ToUTF8(profile.GetFieldText(AutofillType(NAME_LAST)))); specifics.set_address_home_line1( - UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)))); + UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1)))); specifics.set_address_home_line2( - UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)))); + UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2)))); specifics.set_address_home_city(UTF16ToUTF8(profile.GetFieldText( - AutoFillType(ADDRESS_HOME_CITY)))); + AutofillType(ADDRESS_HOME_CITY)))); specifics.set_address_home_state(UTF16ToUTF8(profile.GetFieldText( - AutoFillType(ADDRESS_HOME_STATE)))); + AutofillType(ADDRESS_HOME_STATE)))); specifics.set_address_home_country(UTF16ToUTF8(profile.GetFieldText( - AutoFillType(ADDRESS_HOME_COUNTRY)))); + AutofillType(ADDRESS_HOME_COUNTRY)))); specifics.set_address_home_zip(UTF16ToUTF8(profile.GetFieldText( - AutoFillType(ADDRESS_HOME_ZIP)))); + AutofillType(ADDRESS_HOME_ZIP)))); specifics.set_email_address(UTF16ToUTF8(profile.GetFieldText( - AutoFillType(EMAIL_ADDRESS)))); + AutofillType(EMAIL_ADDRESS)))); specifics.set_company_name(UTF16ToUTF8(profile.GetFieldText( - AutoFillType(COMPANY_NAME)))); + AutofillType(COMPANY_NAME)))); specifics.set_phone_fax_whole_number(UTF16ToUTF8(profile.GetFieldText( - AutoFillType(PHONE_FAX_WHOLE_NUMBER)))); + AutofillType(PHONE_FAX_WHOLE_NUMBER)))); specifics.set_phone_home_whole_number(UTF16ToUTF8(profile.GetFieldText( - AutoFillType(PHONE_HOME_WHOLE_NUMBER)))); + AutofillType(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 8e263f3..1cadaf0 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(AutoFillType(NAME_FIRST)) - << p->GetFieldText(AutoFillType(NAME_LAST)) + << p->GetFieldText(AutofillType(NAME_FIRST)) + << p->GetFieldText(AutofillType(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(AutoFillType(NAME_FIRST)) - << (*ix)->GetFieldText(AutoFillType(NAME_LAST)) + << (*ix)->GetFieldText(AutofillType(NAME_FIRST)) + << (*ix)->GetFieldText(AutofillType(NAME_LAST)) << (*ix)->guid() << " so associating with node id " << node.GetId(); const sync_pb::AutofillProfileSpecifics& autofill( @@ -210,9 +210,9 @@ bool AutofillProfileModelAssociator::DisassociateModels() { bool AutofillProfileModelAssociator::MergeField(FormGroup* f, AutofillFieldType t, const std::string& specifics_field) { - if (UTF16ToUTF8(f->GetFieldText(AutoFillType(t))) == specifics_field) + if (UTF16ToUTF8(f->GetFieldText(AutofillType(t))) == specifics_field) return false; - f->SetInfo(AutoFillType(t), UTF8ToUTF16(specifics_field)); + f->SetInfo(AutofillType(t), UTF8ToUTF16(specifics_field)); return true; } bool AutofillProfileModelAssociator::SyncModelHasUserCreatedNodes( @@ -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(AutoFillType(NAME_FIRST))) - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(NAME_FIRST))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(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(AutoFillType(NAME_FIRST))) - << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(NAME_FIRST))) + << UTF16ToUTF8(profile.GetFieldText(AutofillType(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 8843b5a..46287fd4 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc +++ b/chrome/browser/sync/glue/autofill_profile_model_associator_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -255,7 +255,7 @@ TEST_F(AutofillProfileModelAssociatorTest, TestNeedToAddNativeProfile) { EXPECT_EQ(bundle.new_profiles.size(), (unsigned int)1); EXPECT_EQ( - bundle.new_profiles.front()->GetFieldText(AutoFillType(NAME_FIRST)), + bundle.new_profiles.front()->GetFieldText(AutofillType(NAME_FIRST)), UTF8ToUTF16(first_name)); } diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.cc b/chrome/browser/ui/views/autofill_profiles_view_win.cc index 46ea0df..c7b4b7b 100644 --- a/chrome/browser/ui/views/autofill_profiles_view_win.cc +++ b/chrome/browser/ui/views/autofill_profiles_view_win.cc @@ -851,7 +851,7 @@ void AutoFillProfilesView::EditableSetViewContents::ContentsChanged( if (!UpdateContentsPhoneViews(address_fields_[field].text_field, sender, new_contents)) { temporary_info_.address.SetInfo( - AutoFillType(address_fields_[field].type), new_contents); + AutofillType(address_fields_[field].type), new_contents); } UpdateButtons(); return; @@ -864,7 +864,7 @@ void AutoFillProfilesView::EditableSetViewContents::ContentsChanged( UpdateContentsPhoneViews(address_fields_[field].text_field, sender, new_contents); temporary_info_.credit_card.SetInfo( - AutoFillType(credit_card_fields_[field].type), new_contents); + AutofillType(credit_card_fields_[field].type), new_contents); UpdateButtons(); return; } @@ -893,7 +893,7 @@ void AutoFillProfilesView::EditableSetViewContents::ItemChanged( NOTREACHED(); } else { temporary_info_.credit_card.SetInfo( - AutoFillType(CREDIT_CARD_EXP_MONTH), + AutofillType(CREDIT_CARD_EXP_MONTH), UTF16ToWideHack(combo_box_model_month_->GetItemAt(new_index))); } } else if (combo_box == combo_box_year_) { @@ -901,7 +901,7 @@ void AutoFillProfilesView::EditableSetViewContents::ItemChanged( NOTREACHED(); } else { temporary_info_.credit_card.SetInfo( - AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), UTF16ToWideHack(combo_box_model_year_->GetItemAt(new_index))); } } else { @@ -922,7 +922,7 @@ void AutoFillProfilesView::EditableSetViewContents::InitAddressFields( text_fields_[address_fields_[field].text_field]->SetController(this); text_fields_[address_fields_[field].text_field]->SetText( temporary_info_.address.GetFieldText( - AutoFillType(address_fields_[field].type))); + AutofillType(address_fields_[field].type))); } layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); @@ -1036,12 +1036,12 @@ void AutoFillProfilesView::EditableSetViewContents::InitCreditCardFields( string16 field_text; if (credit_card_fields_[field].text_field == TEXT_CC_NUMBER) { field_text = temporary_info_.credit_card.GetFieldText( - AutoFillType(credit_card_fields_[field].type)); + AutofillType(credit_card_fields_[field].type)); if (!field_text.empty()) field_text = temporary_info_.credit_card.ObfuscatedNumber(); } else { field_text = temporary_info_.credit_card.GetFieldText( - AutoFillType(credit_card_fields_[field].type)); + AutofillType(credit_card_fields_[field].type)); } text_fields_[credit_card_fields_[field].text_field]->SetText(field_text); } @@ -1071,14 +1071,14 @@ void AutoFillProfilesView::EditableSetViewContents::InitCreditCardFields( combo_box_month_->set_listener(this); string16 field_text; field_text = temporary_info_.credit_card.GetFieldText( - AutoFillType(CREDIT_CARD_EXP_MONTH)); + AutofillType(CREDIT_CARD_EXP_MONTH)); combo_box_month_->SetSelectedItem( combo_box_model_month_->GetIndex(field_text)); combo_box_year_ = new views::Combobox(combo_box_model_year_.get()); combo_box_year_->set_listener(this); field_text = temporary_info_.credit_card.GetFieldText( - AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); + AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); combo_box_year_->SetSelectedItem(combo_box_model_year_->GetIndex(field_text)); layout->StartRow(0, double_column_ccexpiration_); @@ -1193,13 +1193,13 @@ bool AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews( string16 number, city, country; PhoneNumber::ParsePhoneNumber(new_contents, &number, &city, &country); temporary_info_.address.SetInfo( - AutoFillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_COUNTRY_CODE : + AutofillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_COUNTRY_CODE : PHONE_FAX_COUNTRY_CODE), country); temporary_info_.address.SetInfo( - AutoFillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_CITY_CODE : + AutofillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_CITY_CODE : PHONE_FAX_CITY_CODE), city); temporary_info_.address.SetInfo( - AutoFillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_NUMBER : + AutofillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_NUMBER : PHONE_FAX_NUMBER), number); return true; } diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc index 69665a3..5672e12 100644 --- a/chrome/browser/ui/webui/options/autofill_options_handler.cc +++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc @@ -268,29 +268,29 @@ void AutoFillOptionsHandler::LoadAddressEditor(const ListValue* args) { DictionaryValue address; address.SetString("guid", profile->guid()); address.SetString("fullName", - profile->GetFieldText(AutoFillType(NAME_FULL))); + profile->GetFieldText(AutofillType(NAME_FULL))); address.SetString("companyName", - profile->GetFieldText(AutoFillType(COMPANY_NAME))); + profile->GetFieldText(AutofillType(COMPANY_NAME))); address.SetString("addrLine1", - profile->GetFieldText(AutoFillType(ADDRESS_HOME_LINE1))); + profile->GetFieldText(AutofillType(ADDRESS_HOME_LINE1))); address.SetString("addrLine2", - profile->GetFieldText(AutoFillType(ADDRESS_HOME_LINE2))); + profile->GetFieldText(AutofillType(ADDRESS_HOME_LINE2))); address.SetString("city", - profile->GetFieldText(AutoFillType(ADDRESS_HOME_CITY))); + profile->GetFieldText(AutofillType(ADDRESS_HOME_CITY))); address.SetString("state", - profile->GetFieldText(AutoFillType(ADDRESS_HOME_STATE))); + profile->GetFieldText(AutofillType(ADDRESS_HOME_STATE))); address.SetString("postalCode", - profile->GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))); + profile->GetFieldText(AutofillType(ADDRESS_HOME_ZIP))); address.SetString("country", profile->CountryCode()); address.SetString( "phone", - profile->GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER))); + profile->GetFieldText(AutofillType(PHONE_HOME_WHOLE_NUMBER))); address.SetString( "fax", - profile->GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER))); + profile->GetFieldText(AutofillType(PHONE_FAX_WHOLE_NUMBER))); address.SetString("email", - profile->GetFieldText(AutoFillType(EMAIL_ADDRESS))); + profile->GetFieldText(AutofillType(EMAIL_ADDRESS))); web_ui_->CallJavascriptFunction(L"AutoFillOptions.editAddress", address); } @@ -318,18 +318,18 @@ void AutoFillOptionsHandler::LoadCreditCardEditor(const ListValue* args) { credit_card_data.SetString("guid", credit_card->guid()); credit_card_data.SetString( "nameOnCard", - credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NAME))); + credit_card->GetFieldText(AutofillType(CREDIT_CARD_NAME))); credit_card_data.SetString( "creditCardNumber", - credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NUMBER))); + credit_card->GetFieldText(AutofillType(CREDIT_CARD_NUMBER))); credit_card_data.SetString("obfuscatedCardNumber", credit_card->ObfuscatedNumber()); credit_card_data.SetString( "expirationMonth", - credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH))); + credit_card->GetFieldText(AutofillType(CREDIT_CARD_EXP_MONTH))); credit_card_data.SetString( "expirationYear", - credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); + credit_card->GetFieldText(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); web_ui_->CallJavascriptFunction(L"AutoFillOptions.editCreditCard", credit_card_data); @@ -350,27 +350,27 @@ void AutoFillOptionsHandler::SetAddress(const ListValue* args) { std::string country_code; string16 value; if (args->GetString(1, &value)) - profile.SetInfo(AutoFillType(NAME_FULL), value); + profile.SetInfo(AutofillType(NAME_FULL), value); if (args->GetString(2, &value)) - profile.SetInfo(AutoFillType(COMPANY_NAME), value); + profile.SetInfo(AutofillType(COMPANY_NAME), value); if (args->GetString(3, &value)) - profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE1), value); + profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), value); if (args->GetString(4, &value)) - profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE2), value); + profile.SetInfo(AutofillType(ADDRESS_HOME_LINE2), value); if (args->GetString(5, &value)) - profile.SetInfo(AutoFillType(ADDRESS_HOME_CITY), value); + profile.SetInfo(AutofillType(ADDRESS_HOME_CITY), value); if (args->GetString(6, &value)) - profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), value); + profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), value); if (args->GetString(7, &value)) - profile.SetInfo(AutoFillType(ADDRESS_HOME_ZIP), value); + profile.SetInfo(AutofillType(ADDRESS_HOME_ZIP), value); if (args->GetString(8, &country_code)) profile.SetCountryCode(country_code); if (args->GetString(9, &value)) - profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), value); + profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), value); if (args->GetString(10, &value)) - profile.SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), value); + profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), value); if (args->GetString(11, &value)) - profile.SetInfo(AutoFillType(EMAIL_ADDRESS), value); + profile.SetInfo(AutofillType(EMAIL_ADDRESS), value); if (!guid::IsValidGUID(profile.guid())) { profile.set_guid(guid::GenerateGUID()); @@ -394,13 +394,13 @@ void AutoFillOptionsHandler::SetCreditCard(const ListValue* args) { string16 value; if (args->GetString(1, &value)) - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), value); + credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), value); if (args->GetString(2, &value)) - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), value); + credit_card.SetInfo(AutofillType(CREDIT_CARD_NUMBER), value); if (args->GetString(3, &value)) - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), value); + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), value); if (args->GetString(4, &value)) - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), value); + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), value); if (!guid::IsValidGUID(credit_card.guid())) { credit_card.set_guid(guid::GenerateGUID()); diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index fd4e5ed..3cbf844 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -15,9 +15,9 @@ #include "base/stl_util-inl.h" #include "base/string16.h" #include "base/string_util.h" +#include "base/synchronization/waitable_event.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "base/synchronization/waitable_event.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/webdata/autofill_change.h" @@ -322,9 +322,9 @@ TEST_F(WebDataServiceAutofillTest, ProfileRemove) { TEST_F(WebDataServiceAutofillTest, ProfileUpdate) { AutoFillProfile profile1; - profile1.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Abe")); + profile1.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Abe")); AutoFillProfile profile2; - profile2.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Alice")); + profile2.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Alice")); EXPECT_CALL(*observer_helper_->observer(), Observe(_, _, _)). WillOnce(DoDefault()). @@ -344,7 +344,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) { STLDeleteElements(&consumer.result()); AutoFillProfile profile1_changed(profile1); - profile1_changed.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Bill")); + profile1_changed.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Bill")); const AutofillProfileChange expected_change( AutofillProfileChange::UPDATE, profile1.guid(), &profile1_changed); @@ -441,9 +441,9 @@ TEST_F(WebDataServiceAutofillTest, CreditCardRemove) { TEST_F(WebDataServiceAutofillTest, CreditUpdate) { CreditCard card1; - card1.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Abe")); + card1.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Abe")); CreditCard card2; - card2.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Alice")); + card2.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Alice")); EXPECT_CALL(*observer_helper_->observer(), Observe(_, _, _)). Times(2). @@ -464,7 +464,7 @@ TEST_F(WebDataServiceAutofillTest, CreditUpdate) { STLDeleteElements(&consumer.result()); CreditCard card1_changed(card1); - card1_changed.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Bill")); + card1_changed.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Bill")); const AutofillCreditCardChange expected_change( AutofillCreditCardChange::UPDATE, card1.guid(), &card1_changed); diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index e38b7ca..5ec1cb0 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -285,19 +285,19 @@ void BindAutoFillProfileToStatement(const AutoFillProfile& profile, DCHECK(guid::IsValidGUID(profile.guid())); s->BindString(0, profile.guid()); - string16 text = profile.GetFieldText(AutoFillType(COMPANY_NAME)); + string16 text = profile.GetFieldText(AutofillType(COMPANY_NAME)); s->BindString16(1, LimitDataSize(text)); - text = profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)); + text = profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1)); s->BindString16(2, LimitDataSize(text)); - text = profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)); + text = profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2)); s->BindString16(3, LimitDataSize(text)); - text = profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY)); + text = profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY)); s->BindString16(4, LimitDataSize(text)); - text = profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE)); + text = profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE)); s->BindString16(5, LimitDataSize(text)); - text = profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)); + text = profile.GetFieldText(AutofillType(ADDRESS_HOME_ZIP)); s->BindString16(6, LimitDataSize(text)); - text = profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)); + text = profile.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)); s->BindString16(7, LimitDataSize(text)); std::string country_code = profile.CountryCode(); s->BindString(8, country_code); @@ -309,12 +309,12 @@ AutoFillProfile* AutoFillProfileFromStatement(const sql::Statement& s) { profile->set_guid(s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); - profile->SetInfo(AutoFillType(COMPANY_NAME), s.ColumnString16(1)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE1), s.ColumnString16(2)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE2), s.ColumnString16(3)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_CITY), s.ColumnString16(4)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_STATE), s.ColumnString16(5)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_ZIP), s.ColumnString16(6)); + profile->SetInfo(AutofillType(COMPANY_NAME), s.ColumnString16(1)); + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1), s.ColumnString16(2)); + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE2), s.ColumnString16(3)); + profile->SetInfo(AutofillType(ADDRESS_HOME_CITY), s.ColumnString16(4)); + profile->SetInfo(AutofillType(ADDRESS_HOME_STATE), s.ColumnString16(5)); + profile->SetInfo(AutofillType(ADDRESS_HOME_ZIP), s.ColumnString16(6)); // Intentionally skip column 7, which stores the localized country name. profile->SetCountryCode(s.ColumnString(8)); // Intentionally skip column 9, which stores the profile's modification date. @@ -327,9 +327,9 @@ void AddAutoFillProfileNameFromStatement(const sql::Statement& s, DCHECK_EQ(profile->guid(), s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); - profile->SetInfo(AutoFillType(NAME_FIRST), s.ColumnString16(1)); - profile->SetInfo(AutoFillType(NAME_MIDDLE), s.ColumnString16(2)); - profile->SetInfo(AutoFillType(NAME_LAST), s.ColumnString16(3)); + profile->SetInfo(AutofillType(NAME_FIRST), s.ColumnString16(1)); + profile->SetInfo(AutofillType(NAME_MIDDLE), s.ColumnString16(2)); + profile->SetInfo(AutofillType(NAME_LAST), s.ColumnString16(3)); } void AddAutoFillProfileEmailFromStatement(const sql::Statement& s, @@ -337,7 +337,7 @@ void AddAutoFillProfileEmailFromStatement(const sql::Statement& s, DCHECK_EQ(profile->guid(), s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); - profile->SetInfo(AutoFillType(EMAIL_ADDRESS), s.ColumnString16(1)); + profile->SetInfo(AutofillType(EMAIL_ADDRESS), s.ColumnString16(1)); } void AddAutoFillProfilePhoneFromStatement(const sql::Statement& s, @@ -345,7 +345,7 @@ void AddAutoFillProfilePhoneFromStatement(const sql::Statement& s, DCHECK_EQ(profile->guid(), s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); DCHECK_EQ(kAutoFillPhoneNumber, s.ColumnInt(1)); - profile->SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), s.ColumnString16(2)); + profile->SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), s.ColumnString16(2)); } void AddAutoFillProfileFaxFromStatement(const sql::Statement& s, @@ -353,7 +353,7 @@ void AddAutoFillProfileFaxFromStatement(const sql::Statement& s, DCHECK_EQ(profile->guid(), s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile->guid())); DCHECK_EQ(kAutoFillFaxNumber, s.ColumnInt(1)); - profile->SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), s.ColumnString16(2)); + profile->SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), s.ColumnString16(2)); } void BindCreditCardToStatement(const CreditCard& credit_card, @@ -361,13 +361,13 @@ void BindCreditCardToStatement(const CreditCard& credit_card, DCHECK(guid::IsValidGUID(credit_card.guid())); s->BindString(0, credit_card.guid()); - string16 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NAME)); + string16 text = credit_card.GetFieldText(AutofillType(CREDIT_CARD_NAME)); s->BindString16(1, LimitDataSize(text)); - text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)); + text = credit_card.GetFieldText(AutofillType(CREDIT_CARD_EXP_MONTH)); s->BindString16(2, LimitDataSize(text)); - text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); + text = credit_card.GetFieldText(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); s->BindString16(3, LimitDataSize(text)); - text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER)); + text = credit_card.GetFieldText(AutofillType(CREDIT_CARD_NUMBER)); std::string encrypted_data; Encryptor::EncryptString16(text, &encrypted_data); s->BindBlob(4, encrypted_data.data(), @@ -381,10 +381,10 @@ CreditCard* CreditCardFromStatement(const sql::Statement& s) { credit_card->set_guid(s.ColumnString(0)); DCHECK(guid::IsValidGUID(credit_card->guid())); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_NAME), s.ColumnString16(1)); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), + credit_card->SetInfo(AutofillType(CREDIT_CARD_NAME), s.ColumnString16(1)); + credit_card->SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), s.ColumnString16(2)); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + credit_card->SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), s.ColumnString16(3)); int encrypted_number_len = s.ColumnByteLength(4); string16 credit_card_number; @@ -394,16 +394,16 @@ CreditCard* CreditCardFromStatement(const sql::Statement& s) { memcpy(&encrypted_number[0], s.ColumnBlob(4), encrypted_number_len); Encryptor::DecryptString16(encrypted_number, &credit_card_number); } - credit_card->SetInfo(AutoFillType(CREDIT_CARD_NUMBER), credit_card_number); + credit_card->SetInfo(AutofillType(CREDIT_CARD_NUMBER), credit_card_number); // Intentionally skip column 5, which stores the modification date. return credit_card; } bool AutoFillProfileHasName(const AutoFillProfile& profile) { - return !profile.GetFieldText(AutoFillType(NAME_FIRST)).empty() || - !profile.GetFieldText(AutoFillType(NAME_MIDDLE)).empty() || - !profile.GetFieldText(AutoFillType(NAME_MIDDLE)).empty(); + return !profile.GetFieldText(AutofillType(NAME_FIRST)).empty() || + !profile.GetFieldText(AutofillType(NAME_MIDDLE)).empty() || + !profile.GetFieldText(AutofillType(NAME_MIDDLE)).empty(); } bool AddAutoFillProfileName(const std::string& guid, @@ -422,9 +422,9 @@ bool AddAutoFillProfileName(const std::string& guid, return false; } s_find.BindString(0, guid); - s_find.BindString16(1, profile.GetFieldText(AutoFillType(NAME_FIRST))); - s_find.BindString16(2, profile.GetFieldText(AutoFillType(NAME_MIDDLE))); - s_find.BindString16(3, profile.GetFieldText(AutoFillType(NAME_LAST))); + s_find.BindString16(1, profile.GetFieldText(AutofillType(NAME_FIRST))); + s_find.BindString16(2, profile.GetFieldText(AutofillType(NAME_MIDDLE))); + s_find.BindString16(3, profile.GetFieldText(AutofillType(NAME_LAST))); if (!s_find.Step()) { // Add the new name. @@ -437,9 +437,9 @@ bool AddAutoFillProfileName(const std::string& guid, return false; } s.BindString(0, guid); - s.BindString16(1, profile.GetFieldText(AutoFillType(NAME_FIRST))); - s.BindString16(2, profile.GetFieldText(AutoFillType(NAME_MIDDLE))); - s.BindString16(3, profile.GetFieldText(AutoFillType(NAME_LAST))); + s.BindString16(1, profile.GetFieldText(AutofillType(NAME_FIRST))); + s.BindString16(2, profile.GetFieldText(AutofillType(NAME_MIDDLE))); + s.BindString16(3, profile.GetFieldText(AutofillType(NAME_LAST))); if (!s.Run()) { NOTREACHED(); @@ -452,7 +452,7 @@ bool AddAutoFillProfileName(const std::string& guid, bool AddAutoFillProfileEmail(const std::string& guid, const AutoFillProfile& profile, sql::Connection* db) { - if (profile.GetFieldText(AutoFillType(EMAIL_ADDRESS)).empty()) + if (profile.GetFieldText(AutofillType(EMAIL_ADDRESS)).empty()) return true; // Check for duplicate. @@ -465,7 +465,7 @@ bool AddAutoFillProfileEmail(const std::string& guid, return false; } s_find.BindString(0, guid); - s_find.BindString16(1, profile.GetFieldText(AutoFillType(EMAIL_ADDRESS))); + s_find.BindString16(1, profile.GetFieldText(AutofillType(EMAIL_ADDRESS))); if (!s_find.Step()) { sql::Statement s(db->GetUniqueStatement( @@ -477,7 +477,7 @@ bool AddAutoFillProfileEmail(const std::string& guid, return false; } s.BindString(0, guid); - s.BindString16(1, profile.GetFieldText(AutoFillType(EMAIL_ADDRESS))); + s.BindString16(1, profile.GetFieldText(AutofillType(EMAIL_ADDRESS))); if (!s.Run()) { NOTREACHED(); @@ -501,7 +501,7 @@ bool AddAutoFillProfilePhone(const std::string& guid, return false; } - if (profile.GetFieldText(AutoFillType(field_type)).empty()) + if (profile.GetFieldText(AutofillType(field_type)).empty()) return true; // Check for duplicate. @@ -516,7 +516,7 @@ bool AddAutoFillProfilePhone(const std::string& guid, s_find.BindString(0, guid); s_find.BindInt(1, phone_type); s_find.BindString16( - 2, profile.GetFieldText(AutoFillType(field_type))); + 2, profile.GetFieldText(AutofillType(field_type))); if (!s_find.Step()) { sql::Statement s(db->GetUniqueStatement( @@ -530,7 +530,7 @@ bool AddAutoFillProfilePhone(const std::string& guid, s.BindString(0, guid); s.BindInt(1, phone_type); s.BindString16( - 2, profile.GetFieldText(AutoFillType(field_type))); + 2, profile.GetFieldText(AutofillType(field_type))); if (!s.Run()) { NOTREACHED(); @@ -2895,26 +2895,26 @@ sql::InitStatus WebDatabase::MigrateOldVersionsAsNeeded(){ profile.set_guid(s.ColumnString(0)); DCHECK(guid::IsValidGUID(profile.guid())); - profile.SetInfo(AutoFillType(NAME_FIRST), s.ColumnString16(1)); - profile.SetInfo(AutoFillType(NAME_MIDDLE), s.ColumnString16(2)); - profile.SetInfo(AutoFillType(NAME_LAST), s.ColumnString16(3)); - profile.SetInfo(AutoFillType(EMAIL_ADDRESS), s.ColumnString16(4)); - profile.SetInfo(AutoFillType(COMPANY_NAME), s.ColumnString16(5)); - profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + profile.SetInfo(AutofillType(NAME_FIRST), s.ColumnString16(1)); + profile.SetInfo(AutofillType(NAME_MIDDLE), s.ColumnString16(2)); + profile.SetInfo(AutofillType(NAME_LAST), s.ColumnString16(3)); + profile.SetInfo(AutofillType(EMAIL_ADDRESS), s.ColumnString16(4)); + profile.SetInfo(AutofillType(COMPANY_NAME), s.ColumnString16(5)); + profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), s.ColumnString16(6)); - profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE2), + profile.SetInfo(AutofillType(ADDRESS_HOME_LINE2), s.ColumnString16(7)); - profile.SetInfo(AutoFillType(ADDRESS_HOME_CITY), + profile.SetInfo(AutofillType(ADDRESS_HOME_CITY), s.ColumnString16(8)); - profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), + profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), s.ColumnString16(9)); - profile.SetInfo(AutoFillType(ADDRESS_HOME_ZIP), + profile.SetInfo(AutofillType(ADDRESS_HOME_ZIP), s.ColumnString16(10)); - profile.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), + profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), s.ColumnString16(11)); - profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), + profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), s.ColumnString16(12)); - profile.SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), + profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), s.ColumnString16(13)); int64 date_modified = s.ColumnInt64(14); @@ -2930,19 +2930,19 @@ sql::InitStatus WebDatabase::MigrateOldVersionsAsNeeded(){ } s_insert.BindString(0, profile.guid()); s_insert.BindString16( - 1, profile.GetFieldText(AutoFillType(COMPANY_NAME))); + 1, profile.GetFieldText(AutofillType(COMPANY_NAME))); s_insert.BindString16( - 2, profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1))); + 2, profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1))); s_insert.BindString16( - 3, profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2))); + 3, profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2))); s_insert.BindString16( - 4, profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY))); + 4, profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY))); s_insert.BindString16( - 5, profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE))); + 5, profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE))); s_insert.BindString16( - 6, profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))); + 6, profile.GetFieldText(AutofillType(ADDRESS_HOME_ZIP))); s_insert.BindString16( - 7, profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))); + 7, profile.GetFieldText(AutofillType(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 0e7827b..559f70b 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -14,24 +14,24 @@ #include "base/path_service.h" #include "base/scoped_temp_dir.h" #include "base/stl_util-inl.h" -#include "base/string_number_conversions.h" #include "base/string16.h" +#include "base/string_number_conversions.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/credit_card.h" -#include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/password_manager/encryptor.h" +#include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/webdata/autofill_change.h" #include "chrome/browser/webdata/autofill_entry.h" #include "chrome/browser/webdata/web_database.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/guid.h" #include "chrome/test/ui_test_utils.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "webkit/glue/form_field.h" #include "webkit/glue/password_form.h" @@ -105,19 +105,19 @@ void AutoFillProfile31FromStatement(const sql::Statement& s, DCHECK(date_modified); *label = s.ColumnString16(0); *unique_id = s.ColumnInt(1); - profile->SetInfo(AutoFillType(NAME_FIRST), s.ColumnString16(2)); - profile->SetInfo(AutoFillType(NAME_MIDDLE), s.ColumnString16(3)); - profile->SetInfo(AutoFillType(NAME_LAST),s.ColumnString16(4)); - profile->SetInfo(AutoFillType(EMAIL_ADDRESS), s.ColumnString16(5)); - profile->SetInfo(AutoFillType(COMPANY_NAME), s.ColumnString16(6)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE1), s.ColumnString16(7)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE2), s.ColumnString16(8)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_CITY), s.ColumnString16(9)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_STATE), s.ColumnString16(10)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_ZIP), s.ColumnString16(11)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), s.ColumnString16(12)); - profile->SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), s.ColumnString16(13)); - profile->SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), s.ColumnString16(14)); + profile->SetInfo(AutofillType(NAME_FIRST), s.ColumnString16(2)); + profile->SetInfo(AutofillType(NAME_MIDDLE), s.ColumnString16(3)); + profile->SetInfo(AutofillType(NAME_LAST),s.ColumnString16(4)); + profile->SetInfo(AutofillType(EMAIL_ADDRESS), s.ColumnString16(5)); + profile->SetInfo(AutofillType(COMPANY_NAME), s.ColumnString16(6)); + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1), s.ColumnString16(7)); + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE2), s.ColumnString16(8)); + profile->SetInfo(AutofillType(ADDRESS_HOME_CITY), s.ColumnString16(9)); + profile->SetInfo(AutofillType(ADDRESS_HOME_STATE), s.ColumnString16(10)); + profile->SetInfo(AutofillType(ADDRESS_HOME_ZIP), s.ColumnString16(11)); + profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), s.ColumnString16(12)); + profile->SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), s.ColumnString16(13)); + profile->SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), s.ColumnString16(14)); *date_modified = s.ColumnInt64(15); profile->set_guid(s.ColumnString(16)); EXPECT_TRUE(guid::IsValidGUID(profile->guid())); @@ -133,19 +133,19 @@ void AutoFillProfile32FromStatement(const sql::Statement& s, profile->set_guid(s.ColumnString(0)); EXPECT_TRUE(guid::IsValidGUID(profile->guid())); *label = s.ColumnString16(1); - profile->SetInfo(AutoFillType(NAME_FIRST), s.ColumnString16(2)); - profile->SetInfo(AutoFillType(NAME_MIDDLE), s.ColumnString16(3)); - profile->SetInfo(AutoFillType(NAME_LAST),s.ColumnString16(4)); - profile->SetInfo(AutoFillType(EMAIL_ADDRESS), s.ColumnString16(5)); - profile->SetInfo(AutoFillType(COMPANY_NAME), s.ColumnString16(6)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE1), s.ColumnString16(7)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE2), s.ColumnString16(8)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_CITY), s.ColumnString16(9)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_STATE), s.ColumnString16(10)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_ZIP), s.ColumnString16(11)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), s.ColumnString16(12)); - profile->SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), s.ColumnString16(13)); - profile->SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), s.ColumnString16(14)); + profile->SetInfo(AutofillType(NAME_FIRST), s.ColumnString16(2)); + profile->SetInfo(AutofillType(NAME_MIDDLE), s.ColumnString16(3)); + profile->SetInfo(AutofillType(NAME_LAST),s.ColumnString16(4)); + profile->SetInfo(AutofillType(EMAIL_ADDRESS), s.ColumnString16(5)); + profile->SetInfo(AutofillType(COMPANY_NAME), s.ColumnString16(6)); + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1), s.ColumnString16(7)); + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE2), s.ColumnString16(8)); + profile->SetInfo(AutofillType(ADDRESS_HOME_CITY), s.ColumnString16(9)); + profile->SetInfo(AutofillType(ADDRESS_HOME_STATE), s.ColumnString16(10)); + profile->SetInfo(AutofillType(ADDRESS_HOME_ZIP), s.ColumnString16(11)); + profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), s.ColumnString16(12)); + profile->SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), s.ColumnString16(13)); + profile->SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), s.ColumnString16(14)); *date_modified = s.ColumnInt64(15); } @@ -156,13 +156,13 @@ void AutoFillProfile33FromStatement(const sql::Statement& s, DCHECK(date_modified); profile->set_guid(s.ColumnString(0)); EXPECT_TRUE(guid::IsValidGUID(profile->guid())); - profile->SetInfo(AutoFillType(COMPANY_NAME), s.ColumnString16(1)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE1), s.ColumnString16(2)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_LINE2), s.ColumnString16(3)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_CITY), s.ColumnString16(4)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_STATE), s.ColumnString16(5)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_ZIP), s.ColumnString16(6)); - profile->SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), s.ColumnString16(7)); + profile->SetInfo(AutofillType(COMPANY_NAME), s.ColumnString16(1)); + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE1), s.ColumnString16(2)); + profile->SetInfo(AutofillType(ADDRESS_HOME_LINE2), s.ColumnString16(3)); + profile->SetInfo(AutofillType(ADDRESS_HOME_CITY), s.ColumnString16(4)); + profile->SetInfo(AutofillType(ADDRESS_HOME_STATE), s.ColumnString16(5)); + profile->SetInfo(AutofillType(ADDRESS_HOME_ZIP), s.ColumnString16(6)); + profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), s.ColumnString16(7)); *date_modified = s.ColumnInt64(8); } @@ -179,11 +179,11 @@ void CreditCard31FromStatement(const sql::Statement& s, DCHECK(date_modified); *label = s.ColumnString16(0); *unique_id = s.ColumnInt(1); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_NAME), s.ColumnString16(2)); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_TYPE), s.ColumnString16(3)); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), + credit_card->SetInfo(AutofillType(CREDIT_CARD_NAME), s.ColumnString16(2)); + credit_card->SetInfo(AutofillType(CREDIT_CARD_TYPE), s.ColumnString16(3)); + credit_card->SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), s.ColumnString16(5)); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + credit_card->SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), s.ColumnString16(6)); int encrypted_number_len = s.ColumnByteLength(10); if (encrypted_number_len) { @@ -204,10 +204,10 @@ void CreditCard32FromStatement(const sql::Statement& s, DCHECK(date_modified); credit_card->set_guid(s.ColumnString(0)); EXPECT_TRUE(guid::IsValidGUID(credit_card->guid())); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_NAME), s.ColumnString16(1)); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), + credit_card->SetInfo(AutofillType(CREDIT_CARD_NAME), s.ColumnString16(1)); + credit_card->SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), s.ColumnString16(2)); - credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + credit_card->SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), s.ColumnString16(3)); int encrypted_number_len = s.ColumnByteLength(4); if (encrypted_number_len) { @@ -1408,24 +1408,24 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { // Add a 'Home' profile. AutoFillProfile home_profile; - home_profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("John")); - home_profile.SetInfo(AutoFillType(NAME_MIDDLE), ASCIIToUTF16("Q.")); - home_profile.SetInfo(AutoFillType(NAME_LAST), ASCIIToUTF16("Smith")); - home_profile.SetInfo(AutoFillType(EMAIL_ADDRESS), + home_profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("John")); + home_profile.SetInfo(AutofillType(NAME_MIDDLE), ASCIIToUTF16("Q.")); + home_profile.SetInfo(AutofillType(NAME_LAST), ASCIIToUTF16("Smith")); + home_profile.SetInfo(AutofillType(EMAIL_ADDRESS), ASCIIToUTF16("js@smith.xyz")); - home_profile.SetInfo(AutoFillType(COMPANY_NAME), ASCIIToUTF16("Google")); - home_profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + home_profile.SetInfo(AutofillType(COMPANY_NAME), ASCIIToUTF16("Google")); + home_profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("1234 Apple Way")); - home_profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE2), + home_profile.SetInfo(AutofillType(ADDRESS_HOME_LINE2), ASCIIToUTF16("unit 5")); - home_profile.SetInfo(AutoFillType(ADDRESS_HOME_CITY), + home_profile.SetInfo(AutofillType(ADDRESS_HOME_CITY), ASCIIToUTF16("Los Angeles")); - home_profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); - home_profile.SetInfo(AutoFillType(ADDRESS_HOME_ZIP), ASCIIToUTF16("90025")); - home_profile.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("US")); - home_profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), + home_profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); + home_profile.SetInfo(AutofillType(ADDRESS_HOME_ZIP), ASCIIToUTF16("90025")); + home_profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("US")); + home_profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), ASCIIToUTF16("18181234567")); - home_profile.SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), + home_profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16("1915243678")); Time pre_creation_time = Time::Now(); @@ -1450,9 +1450,9 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { // Add a 'Billing' profile. AutoFillProfile billing_profile = home_profile; billing_profile.set_guid(guid::GenerateGUID()); - billing_profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + billing_profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("5678 Bottom Street")); - billing_profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE2), + billing_profile.SetInfo(AutofillType(ADDRESS_HOME_LINE2), ASCIIToUTF16("suite 3")); pre_creation_time = Time::Now(); @@ -1473,7 +1473,7 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { delete db_profile; // Update the 'Billing' profile, name only. - billing_profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Jane")); + billing_profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Jane")); Time pre_modification_time = Time::Now(); EXPECT_TRUE(db.UpdateAutoFillProfile(billing_profile)); Time post_modification_time = Time::Now(); @@ -1492,26 +1492,26 @@ TEST_F(WebDatabaseTest, AutoFillProfile) { delete db_profile; // Update the 'Billing' profile. - billing_profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Janice")); - billing_profile.SetInfo(AutoFillType(NAME_MIDDLE), ASCIIToUTF16("C.")); - billing_profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joplin")); - billing_profile.SetInfo(AutoFillType(EMAIL_ADDRESS), + billing_profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Janice")); + billing_profile.SetInfo(AutofillType(NAME_MIDDLE), ASCIIToUTF16("C.")); + billing_profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("Joplin")); + billing_profile.SetInfo(AutofillType(EMAIL_ADDRESS), ASCIIToUTF16("jane@singer.com")); - billing_profile.SetInfo(AutoFillType(COMPANY_NAME), ASCIIToUTF16("Indy")); - billing_profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + billing_profile.SetInfo(AutofillType(COMPANY_NAME), ASCIIToUTF16("Indy")); + billing_profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("Open Road")); - billing_profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE2), + billing_profile.SetInfo(AutofillType(ADDRESS_HOME_LINE2), ASCIIToUTF16("Route 66")); - billing_profile.SetInfo(AutoFillType(ADDRESS_HOME_CITY), + billing_profile.SetInfo(AutofillType(ADDRESS_HOME_CITY), ASCIIToUTF16("NFA")); - billing_profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), ASCIIToUTF16("NY")); - billing_profile.SetInfo(AutoFillType(ADDRESS_HOME_ZIP), + billing_profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("NY")); + billing_profile.SetInfo(AutofillType(ADDRESS_HOME_ZIP), ASCIIToUTF16("10011")); - billing_profile.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), + billing_profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("United States")); - billing_profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), + billing_profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), ASCIIToUTF16("18181230000")); - billing_profile.SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), + billing_profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16("1915240000")); Time pre_modification_time_2 = Time::Now(); EXPECT_TRUE(db.UpdateAutoFillProfile(billing_profile)); @@ -1542,13 +1542,13 @@ TEST_F(WebDatabaseTest, CreditCard) { // Add a 'Work' credit card. CreditCard work_creditcard; - work_creditcard.SetInfo(AutoFillType(CREDIT_CARD_NAME), + work_creditcard.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Jack Torrance")); - work_creditcard.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), + work_creditcard.SetInfo(AutofillType(CREDIT_CARD_NUMBER), ASCIIToUTF16("1234567890123456")); - work_creditcard.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), + work_creditcard.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("04")); - work_creditcard.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + work_creditcard.SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), ASCIIToUTF16("2013")); Time pre_creation_time = Time::Now(); @@ -1573,13 +1573,13 @@ TEST_F(WebDatabaseTest, CreditCard) { // Add a 'Target' credit card. CreditCard target_creditcard; - target_creditcard.SetInfo(AutoFillType(CREDIT_CARD_NAME), + target_creditcard.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Jack Torrance")); - target_creditcard.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), + target_creditcard.SetInfo(AutofillType(CREDIT_CARD_NUMBER), ASCIIToUTF16("1111222233334444")); - target_creditcard.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), + target_creditcard.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("06")); - target_creditcard.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + target_creditcard.SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), ASCIIToUTF16("2012")); pre_creation_time = Time::Now(); @@ -1600,7 +1600,7 @@ TEST_F(WebDatabaseTest, CreditCard) { delete db_creditcard; // Update the 'Target' credit card. - target_creditcard.SetInfo(AutoFillType(CREDIT_CARD_NAME), + target_creditcard.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Charles Grady")); Time pre_modification_time = Time::Now(); EXPECT_TRUE(db.UpdateCreditCard(target_creditcard)); @@ -1630,21 +1630,21 @@ TEST_F(WebDatabaseTest, UpdateAutoFillProfile) { // Add a profile to the db. AutoFillProfile profile; - profile.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("John")); - profile.SetInfo(AutoFillType(NAME_MIDDLE), ASCIIToUTF16("Q.")); - profile.SetInfo(AutoFillType(NAME_LAST), ASCIIToUTF16("Smith")); - profile.SetInfo(AutoFillType(EMAIL_ADDRESS), ASCIIToUTF16("js@example.com")); - profile.SetInfo(AutoFillType(COMPANY_NAME), ASCIIToUTF16("Google")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE1), + profile.SetInfo(AutofillType(NAME_FIRST), ASCIIToUTF16("John")); + profile.SetInfo(AutofillType(NAME_MIDDLE), ASCIIToUTF16("Q.")); + profile.SetInfo(AutofillType(NAME_LAST), ASCIIToUTF16("Smith")); + profile.SetInfo(AutofillType(EMAIL_ADDRESS), ASCIIToUTF16("js@example.com")); + profile.SetInfo(AutofillType(COMPANY_NAME), ASCIIToUTF16("Google")); + profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), ASCIIToUTF16("1234 Apple Way")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_LINE2), ASCIIToUTF16("unit 5")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_CITY), ASCIIToUTF16("Los Angeles")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_ZIP), ASCIIToUTF16("90025")); - profile.SetInfo(AutoFillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("US")); - profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER), + profile.SetInfo(AutofillType(ADDRESS_HOME_LINE2), ASCIIToUTF16("unit 5")); + profile.SetInfo(AutofillType(ADDRESS_HOME_CITY), ASCIIToUTF16("Los Angeles")); + profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); + profile.SetInfo(AutofillType(ADDRESS_HOME_ZIP), ASCIIToUTF16("90025")); + profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("US")); + profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), ASCIIToUTF16("18181234567")); - profile.SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), + profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16("1915243678")); db.AddAutoFillProfile(profile); @@ -1670,7 +1670,7 @@ TEST_F(WebDatabaseTest, UpdateAutoFillProfile) { // Now, update the profile and save the update to the database. // The modification date should change to reflect the update. - profile.SetInfo(AutoFillType(EMAIL_ADDRESS), ASCIIToUTF16("js@smith.xyz")); + profile.SetInfo(AutofillType(EMAIL_ADDRESS), ASCIIToUTF16("js@smith.xyz")); db.UpdateAutoFillProfile(profile); // Get the profile. @@ -1714,13 +1714,13 @@ TEST_F(WebDatabaseTest, UpdateCreditCard) { // Add a credit card to the db. CreditCard credit_card; - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), + credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), ASCIIToUTF16("Jack Torrance")); - credit_card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), + credit_card.SetInfo(AutofillType(CREDIT_CARD_NUMBER), ASCIIToUTF16("1234567890123456")); - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("04")); - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), ASCIIToUTF16("2013")); db.AddCreditCard(credit_card); @@ -1746,7 +1746,7 @@ TEST_F(WebDatabaseTest, UpdateCreditCard) { // Now, update the credit card and save the update to the database. // The modification date should change to reflect the update. - credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); + credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); db.UpdateCreditCard(credit_card); // Get the credit card. @@ -2788,20 +2788,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(AutoFillType(COMPANY_NAME)), - profile_a.GetFieldText(AutoFillType(COMPANY_NAME))); - EXPECT_EQ(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)), - profile_a.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1))); - EXPECT_EQ(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)), - profile_a.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2))); - EXPECT_EQ(profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY)), - profile_a.GetFieldText(AutoFillType(ADDRESS_HOME_CITY))); - EXPECT_EQ(profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE)), - profile_a.GetFieldText(AutoFillType(ADDRESS_HOME_STATE))); - EXPECT_EQ(profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)), - profile_a.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))); - EXPECT_EQ(profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)), - profile_a.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))); + EXPECT_EQ(profile.GetFieldText(AutofillType(COMPANY_NAME)), + profile_a.GetFieldText(AutofillType(COMPANY_NAME))); + EXPECT_EQ(profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1)), + profile_a.GetFieldText(AutofillType(ADDRESS_HOME_LINE1))); + EXPECT_EQ(profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2)), + profile_a.GetFieldText(AutofillType(ADDRESS_HOME_LINE2))); + EXPECT_EQ(profile.GetFieldText(AutofillType(ADDRESS_HOME_CITY)), + profile_a.GetFieldText(AutofillType(ADDRESS_HOME_CITY))); + EXPECT_EQ(profile.GetFieldText(AutofillType(ADDRESS_HOME_STATE)), + profile_a.GetFieldText(AutofillType(ADDRESS_HOME_STATE))); + EXPECT_EQ(profile.GetFieldText(AutofillType(ADDRESS_HOME_ZIP)), + profile_a.GetFieldText(AutofillType(ADDRESS_HOME_ZIP))); + EXPECT_EQ(profile.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY)), + profile_a.GetFieldText(AutofillType(ADDRESS_HOME_COUNTRY))); EXPECT_EQ(profile_date_modified, profile_date_modified_a); sql::Statement s2( diff --git a/chrome/test/live_sync/live_autofill_sync_test.cc b/chrome/test/live_sync/live_autofill_sync_test.cc index 3050a28..5a19755 100644 --- a/chrome/test/live_sync/live_autofill_sync_test.cc +++ b/chrome/test/live_sync/live_autofill_sync_test.cc @@ -5,8 +5,8 @@ #include "chrome/test/live_sync/live_autofill_sync_test.h" #include "chrome/browser/autofill/autofill_common_test.h" -#include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/autofill_profile.h" +#include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_test_util.h" @@ -214,7 +214,7 @@ void LiveAutofillSyncTest::RemoveProfile(int profile, const std::string& guid) { void LiveAutofillSyncTest::UpdateProfile(int profile, const std::string& guid, - const AutoFillType& type, + const AutofillType& type, const string16& value) { const std::vector<AutoFillProfile*>& all_profiles = GetAllProfiles(profile); std::vector<AutoFillProfile> profiles; diff --git a/chrome/test/live_sync/live_autofill_sync_test.h b/chrome/test/live_sync/live_autofill_sync_test.h index 0492429..33d8fb5 100644 --- a/chrome/test/live_sync/live_autofill_sync_test.h +++ b/chrome/test/live_sync/live_autofill_sync_test.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -66,7 +66,7 @@ class LiveAutofillSyncTest : public LiveSyncTest { // to |type| and |value|. void UpdateProfile(int profile, const std::string& guid, - const AutoFillType& type, + const AutofillType& type, const string16& value); // Gets all the Autofill profiles in the PersonalDataManager of sync profile diff --git a/chrome/test/live_sync/two_client_live_autofill_sync_test.cc b/chrome/test/live_sync/two_client_live_autofill_sync_test.cc index 0f1f998..b462699 100644 --- a/chrome/test/live_sync/two_client_live_autofill_sync_test.cc +++ b/chrome/test/live_sync/two_client_live_autofill_sync_test.cc @@ -126,7 +126,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ASSERT_EQ(1U, GetAllProfiles(0).size()); // Client0 updates a profile. - UpdateProfile(0, GetAllProfiles(0)[0]->guid(), AutoFillType(NAME_FIRST), + UpdateProfile(0, GetAllProfiles(0)[0]->guid(), AutofillType(NAME_FIRST), ASCIIToUTF16("Bart")); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(ProfilesMatch(0,1)); @@ -158,7 +158,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, SameProfileWithConflict) { CreateAutofillProfile(LiveAutofillSyncTest::PROFILE_HOMER); AutoFillProfile profile1 = CreateAutofillProfile(LiveAutofillSyncTest::PROFILE_HOMER); - profile1.SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), + profile1.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), ASCIIToUTF16("1234567890")); AddProfile(0, profile0); @@ -238,9 +238,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, UpdateFields) { ASSERT_TRUE(ProfilesMatch(0,1)); ASSERT_EQ(1U, GetAllProfiles(0).size()); - UpdateProfile(0, GetAllProfiles(0)[0]->guid(), AutoFillType(NAME_FIRST), + UpdateProfile(0, GetAllProfiles(0)[0]->guid(), AutofillType(NAME_FIRST), ASCIIToUTF16("Lisa")); - UpdateProfile(0, GetAllProfiles(0)[0]->guid(), AutoFillType(EMAIL_ADDRESS), + UpdateProfile(0, GetAllProfiles(0)[0]->guid(), AutofillType(EMAIL_ADDRESS), ASCIIToUTF16("grrrl@TV.com")); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(ProfilesMatch(0,1)); @@ -255,9 +255,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ConflictingFields) { ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(ProfilesMatch(0,1)); ASSERT_EQ(1U, GetAllProfiles(0).size()); - UpdateProfile(0, GetAllProfiles(0)[0]->guid(), AutoFillType(NAME_FIRST), + UpdateProfile(0, GetAllProfiles(0)[0]->guid(), AutofillType(NAME_FIRST), ASCIIToUTF16("Lisa")); - UpdateProfile(1, GetAllProfiles(1)[0]->guid(), AutoFillType(NAME_FIRST), + UpdateProfile(1, GetAllProfiles(1)[0]->guid(), AutofillType(NAME_FIRST), ASCIIToUTF16("Bart")); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(ProfilesMatch(0,1)); |