diff options
121 files changed, 1623 insertions, 1553 deletions
diff --git a/components/autofill/browser/address.cc b/components/autofill/browser/address.cc index 71dbf32..871eacb 100644 --- a/components/autofill/browser/address.cc +++ b/components/autofill/browser/address.cc @@ -51,7 +51,7 @@ void Address::GetSupportedTypes(FieldTypeSet* supported_types) const { supported_types->insert(ADDRESS_HOME_COUNTRY); } -string16 Address::GetRawInfo(AutofillFieldType type) const { +base::string16 Address::GetRawInfo(AutofillFieldType type) const { type = AutofillType::GetEquivalentFieldType(type); if (type == ADDRESS_HOME_LINE1) return line1_; @@ -71,10 +71,10 @@ string16 Address::GetRawInfo(AutofillFieldType type) const { if (type == ADDRESS_HOME_COUNTRY) return country_code_; - return string16(); + return base::string16(); } -void Address::SetRawInfo(AutofillFieldType type, const string16& value) { +void Address::SetRawInfo(AutofillFieldType type, const base::string16& value) { type = AutofillType::GetEquivalentFieldType(type); if (type == ADDRESS_HOME_LINE1) { line1_ = value; @@ -94,8 +94,8 @@ void Address::SetRawInfo(AutofillFieldType type, const string16& value) { } } -string16 Address::GetInfo(AutofillFieldType type, - const std::string& app_locale) const { +base::string16 Address::GetInfo(AutofillFieldType type, + const std::string& app_locale) const { type = AutofillType::GetEquivalentFieldType(type); if (type == ADDRESS_HOME_COUNTRY && !country_code_.empty()) return AutofillCountry(UTF16ToASCII(country_code_), app_locale).name(); @@ -104,7 +104,7 @@ string16 Address::GetInfo(AutofillFieldType type, } bool Address::SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) { type = AutofillType::GetEquivalentFieldType(type); if (type == ADDRESS_HOME_COUNTRY && !value.empty()) { @@ -117,7 +117,7 @@ bool Address::SetInfo(AutofillFieldType type, return true; } -void Address::GetMatchingTypes(const string16& text, +void Address::GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const { FormGroup::GetMatchingTypes(text, app_locale, matching_types); diff --git a/components/autofill/browser/address.h b/components/autofill/browser/address.h index 40896ab0..4f22952 100644 --- a/components/autofill/browser/address.h +++ b/components/autofill/browser/address.h @@ -23,15 +23,15 @@ class Address : public FormGroup { Address& operator=(const Address& address); // FormGroup: - virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; + virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; virtual void SetRawInfo(AutofillFieldType type, - const string16& value) OVERRIDE; - virtual string16 GetInfo(AutofillFieldType type, + const base::string16& value) OVERRIDE; + virtual base::string16 GetInfo(AutofillFieldType type, const std::string& app_locale) const OVERRIDE; virtual bool SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) OVERRIDE; - virtual void GetMatchingTypes(const string16& text, + virtual void GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const OVERRIDE; @@ -40,12 +40,12 @@ class Address : public FormGroup { virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; // The address. - string16 line1_; - string16 line2_; - string16 city_; - string16 state_; - string16 country_code_; - string16 zip_code_; + base::string16 line1_; + base::string16 line2_; + base::string16 city_; + base::string16 state_; + base::string16 country_code_; + base::string16 zip_code_; }; #endif // COMPONENTS_AUTOFILL_BROWSER_ADDRESS_H_ diff --git a/components/autofill/browser/address_field.cc b/components/autofill/browser/address_field.cc index a8f614d..8632e0e 100644 --- a/components/autofill/browser/address_field.cc +++ b/components/autofill/browser/address_field.cc @@ -25,8 +25,8 @@ FormField* AddressField::Parse(AutofillScanner* scanner) { const AutofillField* const initial_field = scanner->Cursor(); size_t saved_cursor = scanner->SaveCursor(); - string16 attention_ignored = UTF8ToUTF16(autofill::kAttentionIgnoredRe); - string16 region_ignored = UTF8ToUTF16(autofill::kRegionIgnoredRe); + base::string16 attention_ignored = UTF8ToUTF16(autofill::kAttentionIgnoredRe); + base::string16 region_ignored = UTF8ToUTF16(autofill::kRegionIgnoredRe); // Allow address fields to appear in any order. size_t begin_trailing_non_labeled_fields = 0; @@ -91,31 +91,31 @@ AddressField::AddressType AddressField::FindType() const { // First look at the field name, which itself will sometimes contain // "bill" or "ship". if (company_) { - string16 name = StringToLowerASCII(company_->name); + base::string16 name = StringToLowerASCII(company_->name); return AddressTypeFromText(name); } if (address1_) { - string16 name = StringToLowerASCII(address1_->name); + base::string16 name = StringToLowerASCII(address1_->name); return AddressTypeFromText(name); } if (address2_) { - string16 name = StringToLowerASCII(address2_->name); + base::string16 name = StringToLowerASCII(address2_->name); return AddressTypeFromText(name); } if (city_) { - string16 name = StringToLowerASCII(city_->name); + base::string16 name = StringToLowerASCII(city_->name); return AddressTypeFromText(name); } if (zip_) { - string16 name = StringToLowerASCII(zip_->name); + base::string16 name = StringToLowerASCII(zip_->name); return AddressTypeFromText(name); } if (state_) { - string16 name = StringToLowerASCII(state_->name); + base::string16 name = StringToLowerASCII(state_->name); return AddressTypeFromText(name); } if (country_) { - string16 name = StringToLowerASCII(country_->name); + base::string16 name = StringToLowerASCII(country_->name); return AddressTypeFromText(name); } @@ -205,8 +205,8 @@ bool AddressField::ParseAddressLines(AutofillScanner* scanner, if (address_field->address1_) return false; - string16 pattern = UTF8ToUTF16(autofill::kAddressLine1Re); - string16 label_pattern = UTF8ToUTF16(autofill::kAddressLine1LabelRe); + base::string16 pattern = UTF8ToUTF16(autofill::kAddressLine1Re); + base::string16 label_pattern = UTF8ToUTF16(autofill::kAddressLine1LabelRe); if (!ParseField(scanner, pattern, &address_field->address1_) && !ParseFieldSpecifics(scanner, label_pattern, MATCH_LABEL | MATCH_TEXT, @@ -261,7 +261,7 @@ bool AddressField::ParseZipCode(AutofillScanner* scanner, if (address_field->zip_) return false; - string16 pattern = UTF8ToUTF16(autofill::kZipCodeRe); + base::string16 pattern = UTF8ToUTF16(autofill::kZipCodeRe); if (!ParseField(scanner, pattern, &address_field->zip_)) return false; @@ -303,10 +303,10 @@ bool AddressField::ParseState(AutofillScanner* scanner, } AddressField::AddressType AddressField::AddressTypeFromText( - const string16 &text) { + const base::string16 &text) { size_t same_as = text.find(UTF8ToUTF16(autofill::kAddressTypeSameAsRe)); size_t use_shipping = text.find(UTF8ToUTF16(autofill::kAddressTypeUseMyRe)); - if (same_as != string16::npos || use_shipping != string16::npos) + if (same_as != base::string16::npos || use_shipping != base::string16::npos) // This text could be a checkbox label such as "same as my billing // address" or "use my shipping address". // ++ It would help if we generally skipped all text that appears @@ -319,13 +319,13 @@ AddressField::AddressType AddressField::AddressTypeFromText( size_t bill = text.rfind(UTF8ToUTF16(autofill::kBillingDesignatorRe)); size_t ship = text.rfind(UTF8ToUTF16(autofill::kShippingDesignatorRe)); - if (bill == string16::npos && ship == string16::npos) + if (bill == base::string16::npos && ship == base::string16::npos) return kGenericAddress; - if (bill != string16::npos && ship == string16::npos) + if (bill != base::string16::npos && ship == base::string16::npos) return kBillingAddress; - if (bill == string16::npos && ship != string16::npos) + if (bill == base::string16::npos && ship != base::string16::npos) return kShippingAddress; if (bill > ship) diff --git a/components/autofill/browser/address_field.h b/components/autofill/browser/address_field.h index debdf53..e2621ff 100644 --- a/components/autofill/browser/address_field.h +++ b/components/autofill/browser/address_field.h @@ -62,7 +62,7 @@ class AddressField : public FormField { // Looks for an address type in the given text, which the caller must // convert to lowercase. - static AddressType AddressTypeFromText(const string16& text); + static AddressType AddressTypeFromText(const base::string16& text); // Tries to determine the billing/shipping type of this address. AddressType FindType() const; diff --git a/components/autofill/browser/address_field_unittest.cc b/components/autofill/browser/address_field_unittest.cc index 2798f28..3ef26fc 100644 --- a/components/autofill/browser/address_field_unittest.cc +++ b/components/autofill/browser/address_field_unittest.cc @@ -105,8 +105,8 @@ TEST_F(AddressFieldTest, ParseTwoLineAddress) { field.name = ASCIIToUTF16("address"); list_.push_back(new AutofillField(field, ASCIIToUTF16("addr1"))); - field.label = string16(); - field.name = string16(); + field.label = base::string16(); + field.name = base::string16(); list_.push_back(new AutofillField(field, ASCIIToUTF16("addr2"))); AutofillScanner scanner(list_.get()); @@ -258,7 +258,7 @@ TEST_F(AddressFieldTest, ParseTwoLineAddressMissingLabel) { field.name = ASCIIToUTF16("address"); list_.push_back(new AutofillField(field, ASCIIToUTF16("addr1"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("bogus"); list_.push_back(new AutofillField(field, ASCIIToUTF16("addr2"))); diff --git a/components/autofill/browser/address_unittest.cc b/components/autofill/browser/address_unittest.cc index d4446ce7f..5315a9e 100644 --- a/components/autofill/browser/address_unittest.cc +++ b/components/autofill/browser/address_unittest.cc @@ -30,11 +30,11 @@ class AddressTest : public testing::Test { // Test that country codes are properly decoded as country names. TEST_F(AddressTest, GetCountry) { Address address; - EXPECT_EQ(string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(base::string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); // Make sure that nothing breaks when the country code is missing. - string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US"); - EXPECT_EQ(string16(), country); + base::string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US"); + EXPECT_EQ(base::string16(), country); address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"), "en-US"); country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US"); @@ -48,11 +48,11 @@ TEST_F(AddressTest, GetCountry) { // Test that we properly detect country codes appropriate for each country. TEST_F(AddressTest, SetCountry) { Address address; - EXPECT_EQ(string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(base::string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); // Test basic conversion. address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States"), "en-US"); - string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US"); + base::string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US"); EXPECT_EQ(ASCIIToUTF16("US"), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); EXPECT_EQ(ASCIIToUTF16("United States"), country); @@ -77,8 +77,8 @@ TEST_F(AddressTest, SetCountry) { // Test that we ignore unknown countries. address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Unknown"), "en-US"); country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US"); - EXPECT_EQ(string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); - EXPECT_EQ(string16(), country); + EXPECT_EQ(base::string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(base::string16(), country); } // Test that we properly match typed values to stored country data. @@ -114,8 +114,8 @@ TEST_F(AddressTest, IsCountry) { } // Make sure that garbage values don't match when the country code is empty. - address.SetRawInfo(ADDRESS_HOME_COUNTRY, string16()); - EXPECT_EQ(string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); + address.SetRawInfo(ADDRESS_HOME_COUNTRY, base::string16()); + EXPECT_EQ(base::string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); FieldTypeSet matching_types; address.GetMatchingTypes(ASCIIToUTF16("Garbage"), "US", &matching_types); EXPECT_EQ(0U, matching_types.size()); diff --git a/components/autofill/browser/android/auxiliary_profile_loader_android.cc b/components/autofill/browser/android/auxiliary_profile_loader_android.cc index 0fa1234..5d8ff09 100644 --- a/components/autofill/browser/android/auxiliary_profile_loader_android.cc +++ b/components/autofill/browser/android/auxiliary_profile_loader_android.cc @@ -17,9 +17,10 @@ namespace { -string16 SafeJavaStringToUTF16(const ScopedJavaLocalRef<jstring>& jstring) { +base::string16 SafeJavaStringToUTF16( + const ScopedJavaLocalRef<jstring>& jstring) { if (jstring.is_null()) - return string16(); + return base::string16(); return ConvertJavaStringToUTF16(jstring); } @@ -27,7 +28,7 @@ string16 SafeJavaStringToUTF16(const ScopedJavaLocalRef<jstring>& jstring) { void SafeJavaStringArrayToStringVector( const ScopedJavaLocalRef<jobjectArray>& jarray, JNIEnv* env, - std::vector<string16>* string_vector) { + std::vector<base::string16>* string_vector) { if (!jarray.is_null()) { base::android::AppendJavaStringArrayToStringVector(env, jarray.obj(), @@ -57,54 +58,54 @@ bool AuxiliaryProfileLoaderAndroid::GetHasPermissions() const { } // Address info -string16 AuxiliaryProfileLoaderAndroid::GetStreet() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetStreet() const { return SafeJavaStringToUTF16(JAVA_METHOD(getStreet)); } -string16 AuxiliaryProfileLoaderAndroid::GetPostOfficeBox() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetPostOfficeBox() const { return SafeJavaStringToUTF16(JAVA_METHOD(getPobox)); } -string16 AuxiliaryProfileLoaderAndroid::GetNeighborhood() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetNeighborhood() const { return SafeJavaStringToUTF16(JAVA_METHOD(getNeighborhood)); } -string16 AuxiliaryProfileLoaderAndroid::GetRegion() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetRegion() const { return SafeJavaStringToUTF16(JAVA_METHOD(getRegion)); } -string16 AuxiliaryProfileLoaderAndroid::GetCity() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetCity() const { return SafeJavaStringToUTF16(JAVA_METHOD(getCity)); } -string16 AuxiliaryProfileLoaderAndroid::GetPostalCode() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetPostalCode() const { return SafeJavaStringToUTF16(JAVA_METHOD(getPostalCode)); } -string16 AuxiliaryProfileLoaderAndroid::GetCountry() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetCountry() const { return SafeJavaStringToUTF16(JAVA_METHOD(getCountry)); } // Name info -string16 AuxiliaryProfileLoaderAndroid::GetFirstName() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetFirstName() const { return SafeJavaStringToUTF16(JAVA_METHOD(getFirstName)); } -string16 AuxiliaryProfileLoaderAndroid::GetMiddleName() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetMiddleName() const { return SafeJavaStringToUTF16(JAVA_METHOD(getMiddleName)); } -string16 AuxiliaryProfileLoaderAndroid::GetLastName() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetLastName() const { return SafeJavaStringToUTF16(JAVA_METHOD(getLastName)); } -string16 AuxiliaryProfileLoaderAndroid::GetSuffix() const { +base::string16 AuxiliaryProfileLoaderAndroid::GetSuffix() const { return SafeJavaStringToUTF16(JAVA_METHOD(getSuffix)); } // Email info void AuxiliaryProfileLoaderAndroid::GetEmailAddresses( - std::vector<string16>* email_addresses) const { + std::vector<base::string16>* email_addresses) const { SafeJavaStringArrayToStringVector(JAVA_METHOD(getEmailAddresses), env_, email_addresses); @@ -112,7 +113,7 @@ void AuxiliaryProfileLoaderAndroid::GetEmailAddresses( // Phone info void AuxiliaryProfileLoaderAndroid::GetPhoneNumbers( - std::vector<string16>* phone_numbers) const { + std::vector<base::string16>* phone_numbers) const { SafeJavaStringArrayToStringVector(JAVA_METHOD(getPhoneNumbers), env_, phone_numbers); diff --git a/components/autofill/browser/android/auxiliary_profile_loader_android.h b/components/autofill/browser/android/auxiliary_profile_loader_android.h index 0e9b110..27746c4 100644 --- a/components/autofill/browser/android/auxiliary_profile_loader_android.h +++ b/components/autofill/browser/android/auxiliary_profile_loader_android.h @@ -30,35 +30,37 @@ class AuxiliaryProfileLoaderAndroid { // contact information. virtual bool GetHasPermissions() const; // Returns address street. - virtual string16 GetStreet() const; + virtual base::string16 GetStreet() const; // Returns address post office box. - virtual string16 GetPostOfficeBox() const; + virtual base::string16 GetPostOfficeBox() const; // Returns address neighborhood (e.g. Noe Valley, Nob Hill, Twin Peaks, ...). - virtual string16 GetNeighborhood() const; + virtual base::string16 GetNeighborhood() const; // Returns address region such as state or province information // (e.g. Ontario, California, Hubei). - virtual string16 GetRegion() const; + virtual base::string16 GetRegion() const; // Returns address city. - virtual string16 GetCity() const; + virtual base::string16 GetCity() const; // Returns address postal code or zip code. - virtual string16 GetPostalCode() const; + virtual base::string16 GetPostalCode() const; // Returns address country. - virtual string16 GetCountry() const; + virtual base::string16 GetCountry() const; // Returns contact's first name. - virtual string16 GetFirstName() const; + virtual base::string16 GetFirstName() const; // Returns contact's middle name. - virtual string16 GetMiddleName() const; + virtual base::string16 GetMiddleName() const; // Returns contact's last name. - virtual string16 GetLastName() const; + virtual base::string16 GetLastName() const; // Returns contact's suffix (e.g. Ph.D, M.D., ...). - virtual string16 GetSuffix() const; + virtual base::string16 GetSuffix() const; // Populates string vector parameter with contact's email addresses. - virtual void GetEmailAddresses(std::vector<string16>* email_addresses) const; + virtual void GetEmailAddresses( + std::vector<base::string16>* email_addresses) const; // Populates string vector parameter with contact's phones numbers. - virtual void GetPhoneNumbers(std::vector<string16>* phone_numbers) const; + virtual void GetPhoneNumbers( + std::vector<base::string16>* phone_numbers) const; private: JNIEnv* env_; diff --git a/components/autofill/browser/android/auxiliary_profile_unittest_android.cc b/components/autofill/browser/android/auxiliary_profile_unittest_android.cc index ca96eb2b..2372102 100644 --- a/components/autofill/browser/android/auxiliary_profile_unittest_android.cc +++ b/components/autofill/browser/android/auxiliary_profile_unittest_android.cc @@ -31,9 +31,9 @@ class AuxiliaryProfileAndroidTest : public testing::Test { }; TEST_F(AuxiliaryProfileAndroidTest, SetNameInfo) { - string16 first_name = ASCIIToUTF16("John"); - string16 middle_name = ASCIIToUTF16("H."); - string16 last_name = ASCIIToUTF16("Waston"); + base::string16 first_name = ASCIIToUTF16("John"); + base::string16 middle_name = ASCIIToUTF16("H."); + base::string16 last_name = ASCIIToUTF16("Waston"); profile_loader().SetFirstName(first_name); profile_loader().SetMiddleName(middle_name); @@ -49,48 +49,48 @@ TEST_F(AuxiliaryProfileAndroidTest, SetNameInfo) { TEST_F(AuxiliaryProfileAndroidTest, SetNameInfoEmpty) { AutofillProfile* profile = GetAndLoadProfile(); - EXPECT_EQ(profile->GetRawInfo(NAME_FIRST), string16()); - EXPECT_EQ(profile->GetRawInfo(NAME_MIDDLE), string16()); - EXPECT_EQ(profile->GetRawInfo(NAME_LAST), string16()); + EXPECT_EQ(profile->GetRawInfo(NAME_FIRST), base::string16()); + EXPECT_EQ(profile->GetRawInfo(NAME_MIDDLE), base::string16()); + EXPECT_EQ(profile->GetRawInfo(NAME_LAST), base::string16()); } TEST_F(AuxiliaryProfileAndroidTest, SetEmailInfo) { - std::vector<string16> email_addresses; + std::vector<base::string16> email_addresses; email_addresses.push_back(ASCIIToUTF16("sherlock@holmes.com")); email_addresses.push_back(ASCIIToUTF16("watson@holmes.com")); profile_loader().SetEmailAddresses(email_addresses); AutofillProfile* profile = GetAndLoadProfile(); - std::vector<string16> loaded_email_addresses; + std::vector<base::string16> loaded_email_addresses; profile->GetRawMultiInfo(EMAIL_ADDRESS, &loaded_email_addresses); EXPECT_EQ(loaded_email_addresses, email_addresses); } TEST_F(AuxiliaryProfileAndroidTest, SetEmailInfoEmpty) { - std::vector<string16> expected_email_addresses; - expected_email_addresses.push_back(string16()); - std::vector<string16> loaded_email_addresses; + std::vector<base::string16> expected_email_addresses; + expected_email_addresses.push_back(base::string16()); + std::vector<base::string16> loaded_email_addresses; AutofillProfile* profile = GetAndLoadProfile(); profile->GetRawMultiInfo(EMAIL_ADDRESS, &loaded_email_addresses); EXPECT_EQ(loaded_email_addresses, expected_email_addresses); } TEST_F(AuxiliaryProfileAndroidTest, SetPhoneInfo) { - std::vector<string16> phone_numbers; + std::vector<base::string16> phone_numbers; phone_numbers.push_back(ASCIIToUTF16("6502530000")); profile_loader().SetPhoneNumbers(phone_numbers); - std::vector<string16> loaded_phone_numbers; + std::vector<base::string16> loaded_phone_numbers; AutofillProfile* profile = GetAndLoadProfile(); profile->GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &loaded_phone_numbers); EXPECT_EQ(loaded_phone_numbers, phone_numbers); } TEST_F(AuxiliaryProfileAndroidTest, SetPhoneInfoEmpty) { - std::vector<string16> expected_phone_numbers; - expected_phone_numbers.push_back(string16()); + std::vector<base::string16> expected_phone_numbers; + expected_phone_numbers.push_back(base::string16()); - std::vector<string16> loaded_phone_numbers; + std::vector<base::string16> loaded_phone_numbers; AutofillProfile* profile = GetAndLoadProfile(); profile->GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &loaded_phone_numbers); EXPECT_EQ(loaded_phone_numbers, expected_phone_numbers); @@ -105,11 +105,11 @@ TEST_F(AuxiliaryProfileAndroidTest, SetPhoneInfoEmpty) { #if 0 TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfo) { - string16 street = ASCIIToUTF16("221 B Baker Street"); - string16 city = ASCIIToUTF16("London"); - string16 postal_code = ASCIIToUTF16("123456"); - string16 region = ASCIIToUTF16("Georgian Terrace"); - string16 country = ASCIIToUTF16("England"); + base::string16 street = ASCIIToUTF16("221 B Baker Street"); + base::string16 city = ASCIIToUTF16("London"); + base::string16 postal_code = ASCIIToUTF16("123456"); + base::string16 region = ASCIIToUTF16("Georgian Terrace"); + base::string16 country = ASCIIToUTF16("England"); profile_loader().SetStreet(street); profile_loader().SetCity(city); @@ -125,12 +125,12 @@ TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfo) { EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_COUNTRY), country); } -string16 post_office_box= ASCIIToUTF16("222"); -string16 neighborhood = ASCIIToUTF16("Doyle"); +base::string16 post_office_box= ASCIIToUTF16("222"); +base::string16 neighborhood = ASCIIToUTF16("Doyle"); TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfoCompoundFields1) { profile_loader().SetPostOfficeBox(post_office_box); profile_loader().SetNeighborhood(neighborhood); - string16 expectedLine2= ASCIIToUTF16("222, Doyle"); + base::string16 expectedLine2= ASCIIToUTF16("222, Doyle"); AutofillProfile* profile = GetAndLoadProfile(); EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE2), expectedLine2); } @@ -149,11 +149,11 @@ TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfoCompoundFields3) { TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfoEmpty) { AutofillProfile* profile = GetAndLoadProfile(); - EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE1), string16()); - EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE2), string16()); - EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_CITY), string16()); - EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_ZIP), string16()); - EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_STATE), string16()); - EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_COUNTRY), string16()); + EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE1), base::string16()); + EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE2), base::string16()); + EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_CITY), base::string16()); + EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_ZIP), base::string16()); + EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_STATE), base::string16()); + EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_COUNTRY), base::string16()); } #endif diff --git a/components/autofill/browser/android/auxiliary_profiles_android.cc b/components/autofill/browser/android/auxiliary_profiles_android.cc index 4ee7682..c2e0c61 100644 --- a/components/autofill/browser/android/auxiliary_profiles_android.cc +++ b/components/autofill/browser/android/auxiliary_profiles_android.cc @@ -33,9 +33,9 @@ namespace { // Takes misc. address information strings from Android API and collapses // into single string for "address line 2" -string16 CollapseAddress(const string16& post_office_box, - const string16& neighborhood) { - std::vector<string16> accumulator; +base::string16 CollapseAddress(const base::string16& post_office_box, + const base::string16& neighborhood) { + std::vector<base::string16> accumulator; if (!post_office_box.empty()) accumulator.push_back(post_office_box); if (!neighborhood.empty()) @@ -74,15 +74,15 @@ scoped_ptr<AutofillProfile> AuxiliaryProfilesAndroid::LoadContactsProfile() { } void AuxiliaryProfilesAndroid::LoadAddress(AutofillProfile* profile) { - string16 street = profile_loader_.GetStreet(); - string16 post_office_box = profile_loader_.GetPostOfficeBox(); - string16 neighborhood = profile_loader_.GetNeighborhood(); - string16 city = profile_loader_.GetCity(); - string16 postal_code = profile_loader_.GetPostalCode(); - string16 region = profile_loader_.GetRegion(); - string16 country = profile_loader_.GetCountry(); + base::string16 street = profile_loader_.GetStreet(); + base::string16 post_office_box = profile_loader_.GetPostOfficeBox(); + base::string16 neighborhood = profile_loader_.GetNeighborhood(); + base::string16 city = profile_loader_.GetCity(); + base::string16 postal_code = profile_loader_.GetPostalCode(); + base::string16 region = profile_loader_.GetRegion(); + base::string16 country = profile_loader_.GetCountry(); - string16 street2 = CollapseAddress(post_office_box, neighborhood); + base::string16 street2 = CollapseAddress(post_office_box, neighborhood); profile->SetRawInfo(ADDRESS_HOME_LINE1, street); profile->SetRawInfo(ADDRESS_HOME_LINE2, street2); @@ -93,9 +93,9 @@ void AuxiliaryProfilesAndroid::LoadAddress(AutofillProfile* profile) { } void AuxiliaryProfilesAndroid::LoadName(AutofillProfile* profile) { - string16 first_name = profile_loader_.GetFirstName(); - string16 middle_name = profile_loader_.GetMiddleName(); - string16 last_name = profile_loader_.GetLastName(); + base::string16 first_name = profile_loader_.GetFirstName(); + base::string16 middle_name = profile_loader_.GetMiddleName(); + base::string16 last_name = profile_loader_.GetLastName(); profile->SetRawInfo(NAME_FIRST, first_name); profile->SetRawInfo(NAME_MIDDLE, middle_name); @@ -103,13 +103,13 @@ void AuxiliaryProfilesAndroid::LoadName(AutofillProfile* profile) { } void AuxiliaryProfilesAndroid::LoadEmailAddress(AutofillProfile* profile) { - std::vector<string16> emails; + std::vector<base::string16> emails; profile_loader_.GetEmailAddresses(&emails); profile->SetRawMultiInfo(EMAIL_ADDRESS, emails); } void AuxiliaryProfilesAndroid::LoadPhoneNumbers(AutofillProfile* profile) { - std::vector<string16> phone_numbers; + std::vector<base::string16> phone_numbers; profile_loader_.GetPhoneNumbers(&phone_numbers); profile->SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, phone_numbers); } diff --git a/components/autofill/browser/android/test_auxiliary_profile_loader_android.cc b/components/autofill/browser/android/test_auxiliary_profile_loader_android.cc index bf67d91..1ec9cc9 100644 --- a/components/autofill/browser/android/test_auxiliary_profile_loader_android.cc +++ b/components/autofill/browser/android/test_auxiliary_profile_loader_android.cc @@ -14,112 +14,115 @@ bool TestAuxiliaryProfileLoader::GetHasPermissions() const { return true; } -string16 TestAuxiliaryProfileLoader::GetFirstName() const { +base::string16 TestAuxiliaryProfileLoader::GetFirstName() const { return first_name_; } -string16 TestAuxiliaryProfileLoader::GetMiddleName() const { +base::string16 TestAuxiliaryProfileLoader::GetMiddleName() const { return middle_name_; } -string16 TestAuxiliaryProfileLoader::GetLastName() const { +base::string16 TestAuxiliaryProfileLoader::GetLastName() const { return last_name_; } -string16 TestAuxiliaryProfileLoader::GetSuffix() const { +base::string16 TestAuxiliaryProfileLoader::GetSuffix() const { return suffix_; } -string16 TestAuxiliaryProfileLoader::GetStreet() const { +base::string16 TestAuxiliaryProfileLoader::GetStreet() const { return street_; } -string16 TestAuxiliaryProfileLoader::GetPostOfficeBox() const { +base::string16 TestAuxiliaryProfileLoader::GetPostOfficeBox() const { return post_office_box_; } -string16 TestAuxiliaryProfileLoader::GetCity() const { +base::string16 TestAuxiliaryProfileLoader::GetCity() const { return city_; } -string16 TestAuxiliaryProfileLoader::GetNeighborhood() const { +base::string16 TestAuxiliaryProfileLoader::GetNeighborhood() const { return neighborhood_; } -string16 TestAuxiliaryProfileLoader::GetRegion() const { +base::string16 TestAuxiliaryProfileLoader::GetRegion() const { return region_; } -string16 TestAuxiliaryProfileLoader::GetPostalCode() const { +base::string16 TestAuxiliaryProfileLoader::GetPostalCode() const { return postal_code_; } -string16 TestAuxiliaryProfileLoader::GetCountry() const { +base::string16 TestAuxiliaryProfileLoader::GetCountry() const { return country_; } void TestAuxiliaryProfileLoader::GetEmailAddresses( - std::vector<string16>* email_addresses) const { + std::vector<base::string16>* email_addresses) const { *email_addresses = email_addresses_; } void TestAuxiliaryProfileLoader::GetPhoneNumbers( - std::vector<string16>* phone_numbers) const { + std::vector<base::string16>* phone_numbers) const { *phone_numbers = phone_numbers_; } -void TestAuxiliaryProfileLoader::SetFirstName(const string16& first_name) { +void TestAuxiliaryProfileLoader::SetFirstName( + const base::string16& first_name) { first_name_ = first_name; } -void TestAuxiliaryProfileLoader::SetMiddleName(const string16& middle_name) { +void TestAuxiliaryProfileLoader::SetMiddleName( + const base::string16& middle_name) { middle_name_ = middle_name; } -void TestAuxiliaryProfileLoader::SetLastName(const string16& last_name) { +void TestAuxiliaryProfileLoader::SetLastName(const base::string16& last_name) { last_name_ = last_name; } -void TestAuxiliaryProfileLoader::SetSuffix(const string16& suffix) { +void TestAuxiliaryProfileLoader::SetSuffix(const base::string16& suffix) { suffix_ = suffix; } -void TestAuxiliaryProfileLoader::SetStreet(const string16& street) { +void TestAuxiliaryProfileLoader::SetStreet(const base::string16& street) { street_ = street; } void TestAuxiliaryProfileLoader::SetPostOfficeBox( - const string16& post_office_box) { + const base::string16& post_office_box) { post_office_box_ = post_office_box; } void TestAuxiliaryProfileLoader::SetNeighborhood( - const string16& neighborhood) { + const base::string16& neighborhood) { neighborhood_ = neighborhood; } -void TestAuxiliaryProfileLoader::SetRegion(const string16& region) { +void TestAuxiliaryProfileLoader::SetRegion(const base::string16& region) { region_ = region; } -void TestAuxiliaryProfileLoader::SetCity(const string16& city) { +void TestAuxiliaryProfileLoader::SetCity(const base::string16& city) { city_ = city; } -void TestAuxiliaryProfileLoader::SetPostalCode(const string16& postal_code) { +void TestAuxiliaryProfileLoader::SetPostalCode( + const base::string16& postal_code) { postal_code_ = postal_code; } -void TestAuxiliaryProfileLoader::SetCountry(const string16& country) { +void TestAuxiliaryProfileLoader::SetCountry(const base::string16& country) { country_ = country; } void TestAuxiliaryProfileLoader::SetEmailAddresses( - const std::vector<string16>& addresses) { + const std::vector<base::string16>& addresses) { email_addresses_ = addresses; } void TestAuxiliaryProfileLoader::SetPhoneNumbers( - const std::vector<string16>& phone_numbers) { + const std::vector<base::string16>& phone_numbers) { phone_numbers_ = phone_numbers; } diff --git a/components/autofill/browser/android/test_auxiliary_profile_loader_android.h b/components/autofill/browser/android/test_auxiliary_profile_loader_android.h index 795af4f..f76100b 100644 --- a/components/autofill/browser/android/test_auxiliary_profile_loader_android.h +++ b/components/autofill/browser/android/test_auxiliary_profile_loader_android.h @@ -17,54 +17,54 @@ class TestAuxiliaryProfileLoader virtual bool GetHasPermissions() const OVERRIDE; - virtual string16 GetFirstName() const OVERRIDE; - virtual string16 GetMiddleName() const OVERRIDE; - virtual string16 GetLastName() const OVERRIDE; - virtual string16 GetSuffix() const OVERRIDE; + virtual base::string16 GetFirstName() const OVERRIDE; + virtual base::string16 GetMiddleName() const OVERRIDE; + virtual base::string16 GetLastName() const OVERRIDE; + virtual base::string16 GetSuffix() const OVERRIDE; - virtual string16 GetStreet() const OVERRIDE; - virtual string16 GetCity() const OVERRIDE; - virtual string16 GetNeighborhood() const OVERRIDE; - virtual string16 GetPostalCode() const OVERRIDE; - virtual string16 GetRegion() const OVERRIDE; - virtual string16 GetPostOfficeBox() const OVERRIDE; - virtual string16 GetCountry() const OVERRIDE; + virtual base::string16 GetStreet() const OVERRIDE; + virtual base::string16 GetCity() const OVERRIDE; + virtual base::string16 GetNeighborhood() const OVERRIDE; + virtual base::string16 GetPostalCode() const OVERRIDE; + virtual base::string16 GetRegion() const OVERRIDE; + virtual base::string16 GetPostOfficeBox() const OVERRIDE; + virtual base::string16 GetCountry() const OVERRIDE; virtual void GetEmailAddresses( - std::vector<string16>* email_addresses) const OVERRIDE; + std::vector<base::string16>* email_addresses) const OVERRIDE; virtual void GetPhoneNumbers( - std::vector<string16>* phone_numbers) const OVERRIDE; + std::vector<base::string16>* phone_numbers) const OVERRIDE; - void SetFirstName(const string16& first_name); - void SetMiddleName(const string16& middle_name); - void SetLastName(const string16& last_name); - void SetSuffix(const string16& suffix); + void SetFirstName(const base::string16& first_name); + void SetMiddleName(const base::string16& middle_name); + void SetLastName(const base::string16& last_name); + void SetSuffix(const base::string16& suffix); - void SetStreet(const string16& street); - void SetPostOfficeBox(const string16& post_office_box); - void SetNeighborhood(const string16& neighborhood); - void SetRegion(const string16& region); - void SetCity(const string16& city); - void SetPostalCode(const string16& postal_code); - void SetCountry(const string16& country); + void SetStreet(const base::string16& street); + void SetPostOfficeBox(const base::string16& post_office_box); + void SetNeighborhood(const base::string16& neighborhood); + void SetRegion(const base::string16& region); + void SetCity(const base::string16& city); + void SetPostalCode(const base::string16& postal_code); + void SetCountry(const base::string16& country); - void SetEmailAddresses(const std::vector<string16>& email_addresses); - void SetPhoneNumbers(const std::vector<string16>& phone_numbers); + void SetEmailAddresses(const std::vector<base::string16>& email_addresses); + void SetPhoneNumbers(const std::vector<base::string16>& phone_numbers); private: - string16 street_; - string16 post_office_box_; - string16 neighborhood_; - string16 region_; - string16 city_; - string16 postal_code_; - string16 country_; - string16 first_name_; - string16 middle_name_; - string16 last_name_; - string16 suffix_; - std::vector<string16> email_addresses_; - std::vector<string16> phone_numbers_; + base::string16 street_; + base::string16 post_office_box_; + base::string16 neighborhood_; + base::string16 region_; + base::string16 city_; + base::string16 postal_code_; + base::string16 country_; + base::string16 first_name_; + base::string16 middle_name_; + base::string16 last_name_; + base::string16 suffix_; + std::vector<base::string16> email_addresses_; + std::vector<base::string16> phone_numbers_; }; #endif // COMPONENTS_AUTOFILL_BROWSER_ANDROID_TEST_AUXILIARY_PROFILE_LOADER_ANDROID_H_ diff --git a/components/autofill/browser/autocheckout_manager.cc b/components/autofill/browser/autocheckout_manager.cc index b1998a6..6969ea4 100644 --- a/components/autofill/browser/autocheckout_manager.cc +++ b/components/autofill/browser/autocheckout_manager.cc @@ -38,8 +38,8 @@ namespace { // fill rest of properties with default values. FormFieldData BuildField(const std::string& autocomplete_attribute) { FormFieldData field; - field.name = string16(); - field.value = string16(); + field.name = base::string16(); + field.value = base::string16(); field.autocomplete_attribute = autocomplete_attribute; field.form_control_type = "text"; return field; @@ -280,7 +280,7 @@ void AutocheckoutManager::ReturnAutocheckoutData( for (size_t i = 0; i < result->field_count(); ++i) { AutofillFieldType type = result->field(i)->type(); - const string16& value = result->field(i)->value; + const base::string16& value = result->field(i)->value; if (type == CREDIT_CARD_VERIFICATION_CODE) { cvv_ = result->field(i)->value; continue; @@ -333,7 +333,7 @@ void AutocheckoutManager::SetValue(const AutofillField& field, // (fieldtype: FIELD_WITH_DEFAULT_VALUE, value: "female") // Note that, the field mapping is repeated twice to respond to both the // input elements with the same name/signature in the form. - string16 default_value = UTF8ToUTF16(field.default_value()); + base::string16 default_value = UTF8ToUTF16(field.default_value()); // Mark the field checked if server says the default value of the field // to be this field's value. field_to_fill->is_checked = (field.value == default_value); diff --git a/components/autofill/browser/autocheckout_manager.h b/components/autofill/browser/autocheckout_manager.h index 5eb3f86..8207c21 100644 --- a/components/autofill/browser/autocheckout_manager.h +++ b/components/autofill/browser/autocheckout_manager.h @@ -104,7 +104,7 @@ class AutocheckoutManager { AutofillManager* autofill_manager_; // WEAK; owns us // Credit card verification code. - string16 cvv_; + base::string16 cvv_; // Profile built using the data supplied by requestAutocomplete dialog. scoped_ptr<AutofillProfile> profile_; diff --git a/components/autofill/browser/autocomplete_history_manager.cc b/components/autofill/browser/autocomplete_history_manager.cc index a38b0d6..1b03cee 100644 --- a/components/autofill/browser/autocomplete_history_manager.cc +++ b/components/autofill/browser/autocomplete_history_manager.cc @@ -33,8 +33,8 @@ const int kMaxAutocompleteMenuItems = 6; // The separator characters for SSNs. const char16 kSSNSeparators[] = {' ', '-', 0}; -bool IsSSN(const string16& text) { - string16 number_string; +bool IsSSN(const base::string16& text) { + base::string16 number_string; RemoveChars(text, kSSNSeparators, &number_string); // A SSN is of the form AAA-GG-SSSS (A = area number, G = group number, S = @@ -157,18 +157,18 @@ void AutocompleteHistoryManager::OnWebDataServiceRequestDone( } DCHECK_EQ(AUTOFILL_VALUE_RESULT, result->GetType()); - const WDResult<std::vector<string16> >* autofill_result = - static_cast<const WDResult<std::vector<string16> >*>(result); - std::vector<string16> suggestions = autofill_result->GetValue(); + const WDResult<std::vector<base::string16> >* autofill_result = + static_cast<const WDResult<std::vector<base::string16> >*>(result); + std::vector<base::string16> suggestions = autofill_result->GetValue(); SendSuggestions(&suggestions); } void AutocompleteHistoryManager::OnGetAutocompleteSuggestions( int query_id, - const string16& name, - const string16& prefix, - const std::vector<string16>& autofill_values, - const std::vector<string16>& autofill_labels, + const base::string16& name, + const base::string16& prefix, + const std::vector<base::string16>& autofill_values, + const std::vector<base::string16>& autofill_labels, const std::vector<string16>& autofill_icons, const std::vector<int>& autofill_unique_ids) { CancelPendingQuery(); @@ -224,7 +224,7 @@ void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) { } void AutocompleteHistoryManager::OnRemoveAutocompleteEntry( - const string16& name, const string16& value) { + const base::string16& name, const base::string16& value) { if (autofill_data_.get()) autofill_data_->RemoveFormValueForElementName(name, value); } @@ -243,7 +243,7 @@ void AutocompleteHistoryManager::CancelPendingQuery() { } void AutocompleteHistoryManager::SendSuggestions( - const std::vector<string16>* suggestions) { + const std::vector<base::string16>* suggestions) { if (suggestions) { // Combine Autofill and Autocomplete values into values and labels. for (size_t i = 0; i < suggestions->size(); ++i) { @@ -258,8 +258,8 @@ void AutocompleteHistoryManager::SendSuggestions( if (unique) { autofill_values_.push_back((*suggestions)[i]); - autofill_labels_.push_back(string16()); - autofill_icons_.push_back(string16()); + autofill_labels_.push_back(base::string16()); + autofill_icons_.push_back(base::string16()); autofill_unique_ids_.push_back(0); // 0 means no profile. } } diff --git a/components/autofill/browser/autocomplete_history_manager.h b/components/autofill/browser/autocomplete_history_manager.h index 7cf00db..be391a8 100644 --- a/components/autofill/browser/autocomplete_history_manager.h +++ b/components/autofill/browser/autocomplete_history_manager.h @@ -42,16 +42,17 @@ class AutocompleteHistoryManager : public content::WebContentsObserver, // dispatched a message. void OnGetAutocompleteSuggestions( int query_id, - const string16& name, - const string16& prefix, - const std::vector<string16>& autofill_values, - const std::vector<string16>& autofill_labels, - const std::vector<string16>& autofill_icons, + const base::string16& name, + const base::string16& prefix, + const std::vector<base::string16>& autofill_values, + const std::vector<base::string16>& autofill_labels, + const std::vector<base::string16>& autofill_icons, const std::vector<int>& autofill_unique_ids); void OnFormSubmitted(const FormData& form); // Must be public for the external delegate to use. - void OnRemoveAutocompleteEntry(const string16& name, const string16& value); + void OnRemoveAutocompleteEntry(const base::string16& name, + const base::string16& value); // Sets our external delegate. void SetExternalDelegate(AutofillExternalDelegate* delegate); @@ -60,7 +61,7 @@ class AutocompleteHistoryManager : public content::WebContentsObserver, friend class AutofillManagerTest; // Sends the given |suggestions| for display in the Autofill popup. - void SendSuggestions(const std::vector<string16>* suggestions); + void SendSuggestions(const std::vector<base::string16>* suggestions); private: // Cancels the currently pending WebDataService query, if there is one. @@ -76,9 +77,9 @@ class AutocompleteHistoryManager : public content::WebContentsObserver, // back. We also store the autofill results so we can send them together. WebDataServiceBase::Handle pending_query_handle_; int query_id_; - std::vector<string16> autofill_values_; - std::vector<string16> autofill_labels_; - std::vector<string16> autofill_icons_; + std::vector<base::string16> autofill_values_; + std::vector<base::string16> autofill_labels_; + std::vector<base::string16> autofill_icons_; std::vector<int> autofill_unique_ids_; // Delegate to perform external processing (display, selection) on diff --git a/components/autofill/browser/autocomplete_history_manager_unittest.cc b/components/autofill/browser/autocomplete_history_manager_unittest.cc index 08bc9e1..14c626c 100644 --- a/components/autofill/browser/autocomplete_history_manager_unittest.cc +++ b/components/autofill/browser/autocomplete_history_manager_unittest.cc @@ -215,9 +215,9 @@ class MockAutofillExternalDelegate : public AutofillExternalDelegate { MOCK_METHOD5(OnSuggestionsReturned, void(int query_id, - const std::vector<string16>& autofill_values, - const std::vector<string16>& autofill_labels, - const std::vector<string16>& autofill_icons, + const std::vector<base::string16>& autofill_values, + const std::vector<base::string16>& autofill_labels, + const std::vector<base::string16>& autofill_icons, const std::vector<int>& autofill_unique_ids)); private: @@ -230,7 +230,7 @@ class AutocompleteHistoryManagerStubSend : public AutocompleteHistoryManager { : AutocompleteHistoryManager(web_contents) {} // Increase visibility for testing. - void SendSuggestions(const std::vector<string16>* suggestions) { + void SendSuggestions(const std::vector<base::string16>* suggestions) { AutocompleteHistoryManager::SendSuggestions(suggestions); } diff --git a/components/autofill/browser/autofill_country.cc b/components/autofill/browser/autofill_country.cc index 71d9244..5aad7a5 100644 --- a/components/autofill/browser/autofill_country.cc +++ b/components/autofill/browser/autofill_country.cc @@ -843,7 +843,7 @@ class CountryNames { // Returns the country code corresponding to |country|, which should be a // country code or country name localized to |locale|. - const std::string GetCountryCode(const string16& country, + const std::string GetCountryCode(const base::string16& country, const std::string& locale); private: @@ -858,8 +858,9 @@ class CountryNames { // Interprets |country_name| as a full country name localized to the given // |locale| and returns the corresponding country code stored in // |locales_to_localized_names_|, or an empty string if there is none. - const std::string GetCountryCodeForLocalizedName(const string16& country_name, - const std::string& locale); + const std::string GetCountryCodeForLocalizedName( + const base::string16& country_name, + const std::string& locale); // Returns an ICU collator -- i.e. string comparator -- appropriate for the // given |locale|. @@ -870,7 +871,7 @@ class CountryNames { // effect. |buffer_size| should specify the |buffer|'s size, and is updated if // the |buffer| is resized. const std::string GetSortKey(const icu::Collator& collator, - const string16& str, + const base::string16& str, scoped_ptr<uint8_t[]>* buffer, int32_t* buffer_size) const; @@ -927,7 +928,7 @@ CountryNames::~CountryNames() { collators_.end()); } -const std::string CountryNames::GetCountryCode(const string16& country, +const std::string CountryNames::GetCountryCode(const base::string16& country, const std::string& locale) { // First, check common country names, including 2- and 3-letter country codes. std::string country_utf8 = UTF16ToUTF8(StringToUpperASCII(country)); @@ -960,8 +961,8 @@ void CountryNames::AddLocalizedNamesForLocale(const std::string& locale) { it != CountryDataMap::End(); ++it) { const std::string& country_code = it->first; - string16 country_name = l10n_util::GetDisplayNameForCountry(country_code, - locale); + base::string16 country_name = l10n_util::GetDisplayNameForCountry( + country_code, locale); std::string sort_key = GetSortKey(*collator, country_name, &buffer, @@ -974,7 +975,7 @@ void CountryNames::AddLocalizedNamesForLocale(const std::string& locale) { } const std::string CountryNames::GetCountryCodeForLocalizedName( - const string16& country_name, + const base::string16& country_name, const std::string& locale) { AddLocalizedNamesForLocale(locale); @@ -1020,7 +1021,7 @@ icu::Collator* CountryNames::GetCollatorForLocale(const std::string& locale) { } const std::string CountryNames::GetSortKey(const icu::Collator& collator, - const string16& str, + const base::string16& str, scoped_ptr<uint8_t[]>* buffer, int32_t* buffer_size) const { DCHECK(buffer); @@ -1095,15 +1096,15 @@ const std::string AutofillCountry::CountryCodeForLocale( } // static -const std::string AutofillCountry::GetCountryCode(const string16& country, +const std::string AutofillCountry::GetCountryCode(const base::string16& country, const std::string& locale) { return CountryNames::GetInstance()->GetCountryCode(country, locale); } AutofillCountry::AutofillCountry(const std::string& country_code, - const string16& name, - const string16& postal_code_label, - const string16& state_label) + const base::string16& name, + const base::string16& postal_code_label, + const base::string16& state_label) : country_code_(country_code), name_(name), postal_code_label_(postal_code_label), diff --git a/components/autofill/browser/autofill_country.h b/components/autofill/browser/autofill_country.h index 4c5ed38..a93ea86 100644 --- a/components/autofill/browser/autofill_country.h +++ b/components/autofill/browser/autofill_country.h @@ -56,13 +56,13 @@ class AutofillCountry { // Returns the country code corresponding to |country|, which should be a // country code or country name localized to |locale|. This function can // be expensive so use judiciously. - static const std::string GetCountryCode(const string16& country, + static const std::string GetCountryCode(const base::string16& country, const std::string& locale); const std::string country_code() const { return country_code_; } - const string16 name() const { return name_; } - const string16 postal_code_label() const { return postal_code_label_; } - const string16 state_label() const { return state_label_; } + const base::string16 name() const { return name_; } + const base::string16 postal_code_label() const { return postal_code_label_; } + const base::string16 state_label() const { return state_label_; } // City is expected in a complete address for this country. bool requires_city() const { @@ -81,21 +81,21 @@ class AutofillCountry { private: AutofillCountry(const std::string& country_code, - const string16& name, - const string16& postal_code_label, - const string16& state_label); + const base::string16& name, + const base::string16& postal_code_label, + const base::string16& state_label); // The two-letter ISO-3166 country code. std::string country_code_; // The country's name, localized to the app locale. - string16 name_; + base::string16 name_; // The localized label for the postal code (or zip code) field. - string16 postal_code_label_; + base::string16 postal_code_label_; // The localized label for the state (or province, district, etc.) field. - string16 state_label_; + base::string16 state_label_; // Address requirement field codes for the country. AddressRequiredFields address_required_fields_; diff --git a/components/autofill/browser/autofill_download_unittest.cc b/components/autofill/browser/autofill_download_unittest.cc index 3218bcc..c773dc69 100644 --- a/components/autofill/browser/autofill_download_unittest.cc +++ b/components/autofill/browser/autofill_download_unittest.cc @@ -174,7 +174,7 @@ TEST_F(AutofillDownloadTest, QueryAndUploadTest) { field.form_control_type = "password"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -200,7 +200,7 @@ TEST_F(AutofillDownloadTest, QueryAndUploadTest) { field.form_control_type = "text"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); diff --git a/components/autofill/browser/autofill_external_delegate.cc b/components/autofill/browser/autofill_external_delegate.cc index a4a897f..0af6717 100644 --- a/components/autofill/browser/autofill_external_delegate.cc +++ b/components/autofill/browser/autofill_external_delegate.cc @@ -77,22 +77,22 @@ void AutofillExternalDelegate::OnQuery(int query_id, void AutofillExternalDelegate::OnSuggestionsReturned( int query_id, - const std::vector<string16>& autofill_values, - const std::vector<string16>& autofill_labels, - const std::vector<string16>& autofill_icons, + const std::vector<base::string16>& autofill_values, + const std::vector<base::string16>& autofill_labels, + const std::vector<base::string16>& autofill_icons, const std::vector<int>& autofill_unique_ids) { if (query_id != autofill_query_id_) return; - std::vector<string16> values(autofill_values); - std::vector<string16> labels(autofill_labels); - std::vector<string16> icons(autofill_icons); + std::vector<base::string16> values(autofill_values); + std::vector<base::string16> labels(autofill_labels); + std::vector<base::string16> icons(autofill_icons); std::vector<int> ids(autofill_unique_ids); // Add a separator to go between the values and menu items. - values.push_back(string16()); - labels.push_back(string16()); - icons.push_back(string16()); + values.push_back(base::string16()); + labels.push_back(base::string16()); + icons.push_back(base::string16()); ids.push_back(WebAutofillClient::MenuItemIDSeparator); ApplyAutofillWarnings(&values, &labels, &icons, &ids); @@ -137,7 +137,7 @@ void AutofillExternalDelegate::OnSuggestionsReturned( } void AutofillExternalDelegate::OnShowPasswordSuggestions( - const std::vector<string16>& suggestions, + const std::vector<base::string16>& suggestions, const FormFieldData& field, const gfx::RectF& element_bounds) { autofill_query_field_ = field; @@ -148,7 +148,7 @@ void AutofillExternalDelegate::OnShowPasswordSuggestions( return; } - std::vector<string16> empty(suggestions.size()); + std::vector<base::string16> empty(suggestions.size()); std::vector<int> password_ids(suggestions.size(), WebAutofillClient::MenuItemIDPasswordEntry); autofill_manager_->delegate()->ShowAutofillPopup( @@ -156,9 +156,9 @@ void AutofillExternalDelegate::OnShowPasswordSuggestions( } void AutofillExternalDelegate::SetCurrentDataListValues( - const std::vector<string16>& data_list_values, - const std::vector<string16>& data_list_labels, - const std::vector<string16>& data_list_icons, + const std::vector<base::string16>& data_list_values, + const std::vector<base::string16>& data_list_labels, + const std::vector<base::string16>& data_list_icons, const std::vector<int>& data_list_unique_ids) { data_list_values_ = data_list_values; data_list_labels_ = data_list_labels; @@ -194,7 +194,7 @@ void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { FillAutofillFormData(identifier, true); } -void AutofillExternalDelegate::DidAcceptSuggestion(const string16& value, +void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, int identifier) { RenderViewHost* host = web_contents_->GetRenderViewHost(); @@ -222,7 +222,7 @@ void AutofillExternalDelegate::DidAcceptSuggestion(const string16& value, autofill_manager_->delegate()->HideAutofillPopup(); } -void AutofillExternalDelegate::RemoveSuggestion(const string16& value, +void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value, int identifier) { if (identifier > 0) { autofill_manager_->RemoveAutofillProfileOrCreditCard(identifier); @@ -280,16 +280,16 @@ void AutofillExternalDelegate::FillAutofillFormData(int unique_id, } void AutofillExternalDelegate::ApplyAutofillWarnings( - std::vector<string16>* autofill_values, - std::vector<string16>* autofill_labels, - std::vector<string16>* autofill_icons, + std::vector<base::string16>* autofill_values, + std::vector<base::string16>* autofill_labels, + std::vector<base::string16>* autofill_icons, std::vector<int>* autofill_unique_ids) { if (!autofill_query_field_.should_autocomplete) { // If autofill is disabled and we had suggestions, show a warning instead. autofill_values->assign( 1, l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED)); - autofill_labels->assign(1, string16()); - autofill_icons->assign(1, string16()); + autofill_labels->assign(1, base::string16()); + autofill_icons->assign(1, base::string16()); autofill_unique_ids->assign(1, WebAutofillClient::MenuItemIDWarningMessage); } else if (autofill_unique_ids->size() > 1 && (*autofill_unique_ids)[0] == @@ -315,32 +315,32 @@ void AutofillExternalDelegate::ApplyAutofillWarnings( } void AutofillExternalDelegate::ApplyAutofillOptions( - std::vector<string16>* autofill_values, - std::vector<string16>* autofill_labels, - std::vector<string16>* autofill_icons, + std::vector<base::string16>* autofill_values, + std::vector<base::string16>* autofill_labels, + std::vector<base::string16>* autofill_icons, std::vector<int>* autofill_unique_ids) { // The form has been auto-filled, so give the user the chance to clear the // form. Append the 'Clear form' menu item. if (autofill_query_field_.is_autofilled) { autofill_values->push_back( l10n_util::GetStringUTF16(IDS_AUTOFILL_CLEAR_FORM_MENU_ITEM)); - autofill_labels->push_back(string16()); - autofill_icons->push_back(string16()); + autofill_labels->push_back(base::string16()); + autofill_icons->push_back(base::string16()); autofill_unique_ids->push_back(WebAutofillClient::MenuItemIDClearForm); } // Append the 'Chrome Autofill options' menu item; autofill_values->push_back( l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS_POPUP)); - autofill_labels->push_back(string16()); - autofill_icons->push_back(string16()); + autofill_labels->push_back(base::string16()); + autofill_icons->push_back(base::string16()); autofill_unique_ids->push_back(WebAutofillClient::MenuItemIDAutofillOptions); } void AutofillExternalDelegate::InsertDataListValues( - std::vector<string16>* autofill_values, - std::vector<string16>* autofill_labels, - std::vector<string16>* autofill_icons, + std::vector<base::string16>* autofill_values, + std::vector<base::string16>* autofill_labels, + std::vector<base::string16>* autofill_icons, std::vector<int>* autofill_unique_ids) { if (data_list_values_.empty()) return; @@ -348,9 +348,9 @@ void AutofillExternalDelegate::InsertDataListValues( // Insert the separator between the datalist and Autofill values (if there // are any). if (!autofill_values->empty()) { - autofill_values->insert(autofill_values->begin(), string16()); - autofill_labels->insert(autofill_labels->begin(), string16()); - autofill_icons->insert(autofill_icons->begin(), string16()); + autofill_values->insert(autofill_values->begin(), base::string16()); + autofill_labels->insert(autofill_labels->begin(), base::string16()); + autofill_icons->insert(autofill_icons->begin(), base::string16()); autofill_unique_ids->insert(autofill_unique_ids->begin(), WebAutofillClient::MenuItemIDSeparator); } diff --git a/components/autofill/browser/autofill_external_delegate.h b/components/autofill/browser/autofill_external_delegate.h index 48a5236..9340ca3 100644 --- a/components/autofill/browser/autofill_external_delegate.h +++ b/components/autofill/browser/autofill_external_delegate.h @@ -50,9 +50,10 @@ class AutofillExternalDelegate virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE; virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE; virtual void DidSelectSuggestion(int identifier) OVERRIDE; - virtual void DidAcceptSuggestion(const string16& value, + virtual void DidAcceptSuggestion(const base::string16& value, int identifier) OVERRIDE; - virtual void RemoveSuggestion(const string16& value, int identifier) OVERRIDE; + virtual void RemoveSuggestion(const base::string16& value, + int identifier) OVERRIDE; virtual void ClearPreviewedForm() OVERRIDE; // Records and associates a query_id with web form data. Called @@ -72,21 +73,22 @@ class AutofillExternalDelegate // to be displayed. Called when an Autofill query result is available. virtual void OnSuggestionsReturned( int query_id, - const std::vector<string16>& autofill_values, - const std::vector<string16>& autofill_labels, - const std::vector<string16>& autofill_icons, + const std::vector<base::string16>& autofill_values, + const std::vector<base::string16>& autofill_labels, + const std::vector<base::string16>& autofill_icons, const std::vector<int>& autofill_unique_ids); // Show password suggestions in the popup. - void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, + void OnShowPasswordSuggestions(const std::vector<base::string16>& suggestions, const FormFieldData& field, const gfx::RectF& bounds); // Set the data list value associated with the current field. - void SetCurrentDataListValues(const std::vector<string16>& autofill_values, - const std::vector<string16>& autofill_labels, - const std::vector<string16>& autofill_icons, - const std::vector<int>& autofill_unique_ids); + void SetCurrentDataListValues( + const std::vector<base::string16>& autofill_values, + const std::vector<base::string16>& autofill_labels, + const std::vector<base::string16>& autofill_icons, + const std::vector<int>& autofill_unique_ids); // Inform the delegate that the text field editing has ended. This is // used to help record the metrics of when a new popup is shown. @@ -117,24 +119,24 @@ class AutofillExternalDelegate void FillAutofillFormData(int unique_id, bool is_preview); // Handle applying any Autofill warnings to the Autofill popup. - void ApplyAutofillWarnings(std::vector<string16>* autofill_values, - std::vector<string16>* autofill_labels, - std::vector<string16>* autofill_icons, + void ApplyAutofillWarnings(std::vector<base::string16>* autofill_values, + std::vector<base::string16>* autofill_labels, + std::vector<base::string16>* autofill_icons, std::vector<int>* autofill_unique_ids); // Handle applying any Autofill option listings to the Autofill popup. // This function should only get called when there is at least one // multi-field suggestion in the list of suggestions. - void ApplyAutofillOptions(std::vector<string16>* autofill_values, - std::vector<string16>* autofill_labels, - std::vector<string16>* autofill_icons, + void ApplyAutofillOptions(std::vector<base::string16>* autofill_values, + std::vector<base::string16>* autofill_labels, + std::vector<base::string16>* autofill_icons, std::vector<int>* autofill_unique_ids); // Insert the data list values at the start of the given list, including // any required separators. - void InsertDataListValues(std::vector<string16>* autofill_values, - std::vector<string16>* autofill_labels, - std::vector<string16>* autofill_icons, + void InsertDataListValues(std::vector<base::string16>* autofill_values, + std::vector<base::string16>* autofill_labels, + std::vector<base::string16>* autofill_icons, std::vector<int>* autofill_unique_ids); // content::NotificationObserver method override. @@ -178,9 +180,9 @@ class AutofillExternalDelegate content::RenderViewHost* registered_keyboard_listener_with_; // The current data list values. - std::vector<string16> data_list_values_; - std::vector<string16> data_list_labels_; - std::vector<string16> data_list_icons_; + std::vector<base::string16> data_list_values_; + std::vector<base::string16> data_list_labels_; + std::vector<base::string16> data_list_icons_; std::vector<int> data_list_unique_ids_; DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); diff --git a/components/autofill/browser/autofill_external_delegate_unittest.cc b/components/autofill/browser/autofill_external_delegate_unittest.cc index 92b1bf6..a63ae29 100644 --- a/components/autofill/browser/autofill_external_delegate_unittest.cc +++ b/components/autofill/browser/autofill_external_delegate_unittest.cc @@ -52,9 +52,9 @@ class MockAutofillManagerDelegate MOCK_METHOD6(ShowAutofillPopup, void(const gfx::RectF& element_bounds, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& identifiers, AutofillPopupDelegate* delegate)); @@ -152,8 +152,8 @@ TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { external_delegate_.get())); // This should call ShowAutofillPopup. - std::vector<string16> autofill_item; - autofill_item.push_back(string16()); + std::vector<base::string16> autofill_item; + autofill_item.push_back(base::string16()); std::vector<int> autofill_ids; autofill_ids.push_back(kAutofillProfileId); external_delegate_->OnSuggestionsReturned(kQueryId, @@ -176,8 +176,8 @@ TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) { IssueOnQuery(kQueryId); - std::vector<string16> data_list_items; - data_list_items.push_back(string16()); + std::vector<base::string16> data_list_items; + data_list_items.push_back(base::string16()); std::vector<int> data_list_ids; data_list_ids.push_back(WebAutofillClient::MenuItemIDDataListEntry); @@ -201,8 +201,8 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) { external_delegate_.get())); // This should call ShowAutofillPopup. - std::vector<string16> autofill_item; - autofill_item.push_back(string16()); + std::vector<base::string16> autofill_item; + autofill_item.push_back(base::string16()); std::vector<int> autofill_ids; autofill_ids.push_back(kAutofillProfileId); external_delegate_->OnSuggestionsReturned(kQueryId, @@ -222,7 +222,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) { WebAutofillClient::MenuItemIDDataListEntry)), external_delegate_.get())); - autofill_item = std::vector<string16>(); + autofill_item = std::vector<base::string16>(); autofill_ids = std::vector<int>(); external_delegate_->OnSuggestionsReturned(kQueryId, autofill_item, @@ -242,7 +242,7 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateInvalidUniqueId) { // Ensure it doesn't try to fill the form in with the negative id. EXPECT_CALL(manager_delegate_, HideAutofillPopup()); EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)).Times(0); - external_delegate_->DidAcceptSuggestion(string16(), -1); + external_delegate_->DidAcceptSuggestion(base::string16(), -1); } // Test that the ClearPreview IPC is only sent the form was being previewed @@ -274,8 +274,8 @@ TEST_F(AutofillExternalDelegateUnitTest, // Test that the popup is marked as visible after recieving password // suggestions. TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegatePasswordSuggestions) { - std::vector<string16> suggestions; - suggestions.push_back(string16()); + std::vector<base::string16> suggestions; + suggestions.push_back(base::string16()); FormFieldData field; field.is_focusable = true; @@ -317,8 +317,8 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateHideWarning) { external_delegate_->OnQuery(kQueryId, form, field, element_bounds, false); - std::vector<string16> autofill_items; - autofill_items.push_back(string16()); + std::vector<base::string16> autofill_items; + autofill_items.push_back(base::string16()); std::vector<int> autofill_ids; autofill_ids.push_back(WebAutofillClient::MenuItemIDAutocompleteEntry); diff --git a/components/autofill/browser/autofill_field.cc b/components/autofill/browser/autofill_field.cc index ba3817e..1f164b5 100644 --- a/components/autofill/browser/autofill_field.cc +++ b/components/autofill/browser/autofill_field.cc @@ -32,7 +32,7 @@ AutofillField::AutofillField() } AutofillField::AutofillField(const FormFieldData& field, - const string16& unique_name) + const base::string16& unique_name) : FormFieldData(field), unique_name_(unique_name), server_type_(NO_SERVER_DATA), diff --git a/components/autofill/browser/autofill_field.h b/components/autofill/browser/autofill_field.h index aa43091..e961919 100644 --- a/components/autofill/browser/autofill_field.h +++ b/components/autofill/browser/autofill_field.h @@ -21,10 +21,10 @@ class AutofillField : public FormFieldData { }; AutofillField(); - AutofillField(const FormFieldData& field, const string16& unique_name); + AutofillField(const FormFieldData& field, const base::string16& unique_name); virtual ~AutofillField(); - const string16& unique_name() const { return unique_name_; } + const base::string16& unique_name() const { return unique_name_; } const std::string& section() const { return section_; } AutofillFieldType heuristic_type() const { return heuristic_type_; } @@ -61,7 +61,7 @@ class AutofillField : public FormFieldData { private: // The unique name of this field, generated by Autofill. - string16 unique_name_; + base::string16 unique_name_; // The unique identifier for the section (e.g. billing vs. shipping address) // that this field belongs to. diff --git a/components/autofill/browser/autofill_field_unittest.cc b/components/autofill/browser/autofill_field_unittest.cc index 745f6fc..66d6322 100644 --- a/components/autofill/browser/autofill_field_unittest.cc +++ b/components/autofill/browser/autofill_field_unittest.cc @@ -33,7 +33,7 @@ TEST(AutofillFieldTest, Type) { TEST(AutofillFieldTest, IsEmpty) { AutofillField field; - ASSERT_EQ(string16(), field.value); + ASSERT_EQ(base::string16(), field.value); // Field value is empty. EXPECT_TRUE(field.IsEmpty()); @@ -45,7 +45,7 @@ TEST(AutofillFieldTest, IsEmpty) { TEST(AutofillFieldTest, FieldSignature) { AutofillField field; - ASSERT_EQ(string16(), field.name); + ASSERT_EQ(base::string16(), field.name); ASSERT_EQ(std::string(), field.form_control_type); // Signature is empty. diff --git a/components/autofill/browser/autofill_ie_toolbar_import_win.cc b/components/autofill/browser/autofill_ie_toolbar_import_win.cc index 6a30103..19a9f07 100644 --- a/components/autofill/browser/autofill_ie_toolbar_import_win.cc +++ b/components/autofill/browser/autofill_ie_toolbar_import_win.cc @@ -67,12 +67,13 @@ bool IsEmptySalt(std::wstring const& salt) { return true; } -string16 ReadAndDecryptValue(const RegKey& key, const wchar_t* value_name) { +base::string16 ReadAndDecryptValue(const RegKey& key, + const wchar_t* value_name) { DWORD data_type = REG_BINARY; DWORD data_size = 0; LONG result = key.ReadValue(value_name, NULL, &data_size, &data_type); if ((result != ERROR_SUCCESS) || !data_size || data_type != REG_BINARY) - return string16(); + return base::string16(); std::vector<uint8> data; data.resize(data_size); result = key.ReadValue(value_name, &(data[0]), &data_size, &data_type); @@ -82,12 +83,12 @@ string16 ReadAndDecryptValue(const RegKey& key, const wchar_t* value_name) { // The actual data is in UTF16 already. if (!(out_data.size() & 1) && (out_data.size() > 2) && !out_data[out_data.size() - 1] && !out_data[out_data.size() - 2]) { - return string16( + return base::string16( reinterpret_cast<const wchar_t *>(out_data.c_str())); } } } - return string16(); + return base::string16(); } struct { @@ -148,7 +149,7 @@ bool ImportSingleFormGroup(const RegKey& key, if (it == reg_to_field.end()) continue; // This field is not imported. - string16 field_value = ReadAndDecryptValue(key, value_name.c_str()); + base::string16 field_value = ReadAndDecryptValue(key, value_name.c_str()); if (!field_value.empty()) { if (it->second == CREDIT_CARD_NUMBER) field_value = DecryptCCNumber(field_value); @@ -177,7 +178,7 @@ bool ImportSingleProfile(const std::string& app_locale, ImportSingleFormGroup(key, reg_to_field, app_locale, profile, &phone); // Now re-construct the phones if needed. - string16 constructed_number; + base::string16 constructed_number; if (phone.ParseNumber(*profile, app_locale, &constructed_number)) { has_non_empty_fields = true; profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number); @@ -261,8 +262,8 @@ bool ImportCurrentUserProfiles(const std::string& app_locale, profiles->push_back(profile); } } - string16 password_hash; - string16 salt; + base::string16 password_hash; + base::string16 salt; RegKey cc_key(HKEY_CURRENT_USER, kCreditCardKey, KEY_READ); if (cc_key.Valid()) { password_hash = ReadAndDecryptValue(cc_key, kPasswordHashValue); @@ -281,7 +282,7 @@ bool ImportCurrentUserProfiles(const std::string& app_locale, CreditCard credit_card; if (ImportSingleFormGroup( key, reg_to_field, app_locale, &credit_card, NULL)) { - string16 cc_number = credit_card.GetRawInfo(CREDIT_CARD_NUMBER); + base::string16 cc_number = credit_card.GetRawInfo(CREDIT_CARD_NUMBER); if (!cc_number.empty()) credit_cards->push_back(credit_card); } diff --git a/components/autofill/browser/autofill_manager.cc b/components/autofill/browser/autofill_manager.cc index 89dcc42..e766054 100644 --- a/components/autofill/browser/autofill_manager.cc +++ b/components/autofill/browser/autofill_manager.cc @@ -80,22 +80,23 @@ const size_t kMaxRecentFormSignaturesToRemember = 3; const size_t kMaxFormCacheSize = 100; // Removes duplicate suggestions whilst preserving their original order. -void RemoveDuplicateSuggestions(std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, +void RemoveDuplicateSuggestions(std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<int>* unique_ids) { DCHECK_EQ(values->size(), labels->size()); DCHECK_EQ(values->size(), icons->size()); DCHECK_EQ(values->size(), unique_ids->size()); - std::set<std::pair<string16, string16> > seen_suggestions; - std::vector<string16> values_copy; - std::vector<string16> labels_copy; - std::vector<string16> icons_copy; + std::set<std::pair<base::string16, base::string16> > seen_suggestions; + std::vector<base::string16> values_copy; + std::vector<base::string16> labels_copy; + std::vector<base::string16> icons_copy; std::vector<int> unique_ids_copy; for (size_t i = 0; i < values->size(); ++i) { - const std::pair<string16, string16> suggestion((*values)[i], (*labels)[i]); + const std::pair<base::string16, base::string16> suggestion( + (*values)[i], (*labels)[i]); if (seen_suggestions.insert(suggestion).second) { values_copy.push_back((*values)[i]); labels_copy.push_back((*labels)[i]); @@ -147,7 +148,7 @@ void DeterminePossibleFieldTypesForUpload( // profile or credit card, identify any stored types that match the value. for (size_t i = 0; i < submitted_form->field_count(); ++i) { AutofillField* field = submitted_form->field(i); - string16 value = CollapseWhitespace(field->value, false); + base::string16 value = CollapseWhitespace(field->value, false); FieldTypeSet matching_types; for (std::vector<AutofillProfile>::const_iterator it = profiles.begin(); @@ -517,9 +518,9 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id, if (autocheckout_manager_.is_autocheckout_bubble_showing()) return; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; if (external_delegate_) { @@ -563,8 +564,8 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id, warning = IDS_AUTOFILL_WARNING_INSECURE_CONNECTION; if (warning) { values.assign(1, l10n_util::GetStringUTF16(warning)); - labels.assign(1, string16()); - icons.assign(1, string16()); + labels.assign(1, base::string16()); + icons.assign(1, base::string16()); unique_ids.assign(1, WebKit::WebAutofillClient::MenuItemIDWarningMessage); } else { @@ -576,8 +577,8 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id, // for suggestions, then the user is editing the value of a field. // In this case, mimic autocomplete: don't display labels or icons, // as that information is redundant. - labels.assign(labels.size(), string16()); - icons.assign(icons.size(), string16()); + labels.assign(labels.size(), base::string16()); + icons.assign(icons.size(), base::string16()); } // When filling credit card suggestions, the values and labels are @@ -761,8 +762,8 @@ void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { personal_data_->RemoveByGUID(form_group->GetGUID()); } -void AutofillManager::RemoveAutocompleteEntry(const string16& name, - const string16& value) { +void AutofillManager::RemoveAutocompleteEntry(const base::string16& name, + const base::string16& value) { autocomplete_history_manager_.OnRemoveAutocompleteEntry(name, value); } @@ -799,14 +800,14 @@ void AutofillManager::OnAddPasswordFormMapping( void AutofillManager::OnShowPasswordSuggestions( const FormFieldData& field, const gfx::RectF& bounds, - const std::vector<string16>& suggestions) { + const std::vector<base::string16>& suggestions) { if (external_delegate_) external_delegate_->OnShowPasswordSuggestions(suggestions, field, bounds); } -void AutofillManager::OnSetDataList(const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, +void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& unique_ids) { if (labels.size() != values.size() || icons.size() != values.size() || @@ -1173,7 +1174,7 @@ bool AutofillManager::UpdateCachedForm(const FormData& live_form, // If we have cached data, propagate it to the updated form. if (cached_form) { - std::map<string16, const AutofillField*> cached_fields; + std::map<base::string16, const AutofillField*> cached_fields; for (size_t i = 0; i < cached_form->field_count(); ++i) { const AutofillField* field = cached_form->field(i); cached_fields[field->unique_name()] = field; @@ -1181,7 +1182,7 @@ bool AutofillManager::UpdateCachedForm(const FormData& live_form, for (size_t i = 0; i < (*updated_form)->field_count(); ++i) { AutofillField* field = (*updated_form)->field(i); - std::map<string16, const AutofillField*>::iterator cached_field = + std::map<base::string16, const AutofillField*>::iterator cached_field = cached_fields.find(field->unique_name()); if (cached_field != cached_fields.end()) { field->set_server_type(cached_field->second->server_type()); @@ -1205,9 +1206,9 @@ void AutofillManager::GetProfileSuggestions( FormStructure* form, const FormFieldData& field, AutofillFieldType type, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<int>* unique_ids) const { std::vector<AutofillFieldType> field_types(form->field_count()); for (size_t i = 0; i < form->field_count(); ++i) { @@ -1228,9 +1229,9 @@ void AutofillManager::GetProfileSuggestions( void AutofillManager::GetCreditCardSuggestions( const FormFieldData& field, AutofillFieldType type, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<int>* unique_ids) const { std::vector<GUIDPair> guid_pairs; personal_data_->GetCreditCardSuggestions( diff --git a/components/autofill/browser/autofill_manager.h b/components/autofill/browser/autofill_manager.h index ae16413..7a7e386 100644 --- a/components/autofill/browser/autofill_manager.h +++ b/components/autofill/browser/autofill_manager.h @@ -111,7 +111,8 @@ class AutofillManager : public content::WebContentsObserver, void RemoveAutofillProfileOrCreditCard(int unique_id); // Remove the specified Autocomplete entry. - void RemoveAutocompleteEntry(const string16& name, const string16& value); + void RemoveAutocompleteEntry(const base::string16& name, + const base::string16& value); // Returns the present web_contents state. content::WebContents* GetWebContents() const; @@ -260,12 +261,13 @@ class AutofillManager : public content::WebContentsObserver, void OnAddPasswordFormMapping( const FormFieldData& form, const PasswordFormFillData& fill_data); - void OnShowPasswordSuggestions(const FormFieldData& field, - const gfx::RectF& bounds, - const std::vector<string16>& suggestions); - void OnSetDataList(const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + void OnShowPasswordSuggestions( + const FormFieldData& field, + const gfx::RectF& bounds, + const std::vector<base::string16>& suggestions); + void OnSetDataList(const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& unique_ids); // Requests an interactive autocomplete UI be shown. @@ -330,18 +332,18 @@ class AutofillManager : public content::WebContentsObserver, void GetProfileSuggestions(FormStructure* form, const FormFieldData& field, AutofillFieldType type, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<int>* unique_ids) const; // Returns a list of values from the stored credit cards that match |type| and // the value of |field| and returns the labels of the matching credit cards. void GetCreditCardSuggestions(const FormFieldData& field, AutofillFieldType type, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<int>* unique_ids) const; // Parses the forms using heuristic matching and querying the Autofill server. diff --git a/components/autofill/browser/autofill_manager_delegate.h b/components/autofill/browser/autofill_manager_delegate.h index 2056aa6..dcfacd7f 100644 --- a/components/autofill/browser/autofill_manager_delegate.h +++ b/components/autofill/browser/autofill_manager_delegate.h @@ -132,9 +132,9 @@ class AutofillManagerDelegate { // |identifiers| for the element at |element_bounds|. |delegate| will be // notified of popup events. virtual void ShowAutofillPopup(const gfx::RectF& element_bounds, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& identifiers, AutofillPopupDelegate* delegate) = 0; diff --git a/components/autofill/browser/autofill_manager_unittest.cc b/components/autofill/browser/autofill_manager_unittest.cc index 5747e25..38ede8e 100644 --- a/components/autofill/browser/autofill_manager_unittest.cc +++ b/components/autofill/browser/autofill_manager_unittest.cc @@ -64,9 +64,9 @@ namespace { const int kDefaultPageID = 137; typedef Tuple5<int, - std::vector<string16>, - std::vector<string16>, - std::vector<string16>, + std::vector<base::string16>, + std::vector<base::string16>, + std::vector<base::string16>, std::vector<int> > AutofillParam; class TestPersonalDataManager : public PersonalDataManager { @@ -329,15 +329,15 @@ void CreateTestCreditCardFormData(FormData* form, } void ExpectSuggestions(int page_id, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& unique_ids, int expected_page_id, size_t expected_num_suggestions, - const string16 expected_values[], - const string16 expected_labels[], - const string16 expected_icons[], + const base::string16 expected_values[], + const base::string16 expected_labels[], + const base::string16 expected_icons[], const int expected_unique_ids[]) { EXPECT_EQ(expected_page_id, page_id); ASSERT_EQ(expected_num_suggestions, values.size()); @@ -735,7 +735,8 @@ class AutofillManagerTest : public ChromeRenderViewHostTestHarness { GetAutofillSuggestions(kDefaultPageID, form, field); } - void AutocompleteSuggestionsReturned(const std::vector<string16>& result) { + void AutocompleteSuggestionsReturned( + const std::vector<base::string16>& result) { autofill_manager_->autocomplete_history_manager_.SendSuggestions(&result); } @@ -764,9 +765,9 @@ class AutofillManagerTest : public ChromeRenderViewHostTestHarness { } bool GetAutofillSuggestionsMessage(int* page_id, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<int>* unique_ids) { const uint32 kMsgID = AutofillMsg_SuggestionsReturned::ID; const IPC::Message* message = @@ -898,28 +899,28 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsEmptyValue) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; GetAutofillSuggestionsMessage( &page_id, &values, &labels, &icons, &unique_ids); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Elvis"), ASCIIToUTF16("Charles") }; // Inferred labels include full first relevant field, which in this case is // the address line 1. - string16 expected_labels[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("3734 Elvis Presley Blvd."), ASCIIToUTF16("123 Apple St.") }; - string16 expected_icons[] = {string16(), string16()}; + base::string16 expected_icons[] = {base::string16(), base::string16()}; int expected_unique_ids[] = {1, 2}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -979,20 +980,20 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsMatchCharacter) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = {ASCIIToUTF16("Elvis")}; - string16 expected_labels[] = {ASCIIToUTF16("3734 Elvis Presley Blvd.")}; - string16 expected_icons[] = {string16()}; + base::string16 expected_values[] = {ASCIIToUTF16("Elvis")}; + base::string16 expected_labels[] = {ASCIIToUTF16("3734 Elvis Presley Blvd.")}; + base::string16 expected_icons[] = {base::string16()}; int expected_unique_ids[] = {1}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1048,26 +1049,26 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsWithDuplicates) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Elvis"), ASCIIToUTF16("Charles") }; - string16 expected_labels[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("3734 Elvis Presley Blvd."), ASCIIToUTF16("123 Apple St.") }; - string16 expected_icons[] = {string16(), string16()}; + base::string16 expected_icons[] = {base::string16(), base::string16()}; int expected_unique_ids[] = {1, 2}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1105,22 +1106,22 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsMethodGet) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED) }; - string16 expected_labels[] = {string16()}; - string16 expected_icons[] = {string16()}; + base::string16 expected_labels[] = {base::string16()}; + base::string16 expected_icons[] = {base::string16()}; int expected_unique_ids[] = {WebKit::WebAutofillClient::MenuItemIDWarningMessage}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, @@ -1132,7 +1133,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsMethodGet) { const int kPageID2 = 2; GetAutofillSuggestions(kPageID2, form, field); - std::vector<string16> suggestions; + std::vector<base::string16> suggestions; suggestions.push_back(ASCIIToUTF16("Jay")); suggestions.push_back(ASCIIToUTF16("Jason")); AutocompleteSuggestionsReturned(suggestions); @@ -1140,13 +1141,15 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsMethodGet) { EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values2[] = { + base::string16 expected_values2[] = { l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED), ASCIIToUTF16("Jay"), ASCIIToUTF16("Jason") }; - string16 expected_labels2[] = {string16(), string16(), string16()}; - string16 expected_icons2[] = {string16(), string16(), string16()}; + base::string16 expected_labels2[] = { base::string16(), base::string16(), + base::string16()}; + base::string16 expected_icons2[] = { base::string16(), base::string16(), + base::string16()}; int expected_unique_ids2[] = {-1, 0, 0}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kPageID2, arraysize(expected_values2), expected_values2, @@ -1172,23 +1175,24 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsEmptyValue) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("************3456"), ASCIIToUTF16("************8765") }; - string16 expected_labels[] = {ASCIIToUTF16("*3456"), ASCIIToUTF16("*8765")}; - string16 expected_icons[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("*3456"), + ASCIIToUTF16("*8765")}; + base::string16 expected_icons[] = { ASCIIToUTF16("visaCC"), ASCIIToUTF16("genericCC") }; @@ -1217,20 +1221,20 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsMatchCharacter) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = {ASCIIToUTF16("************3456")}; - string16 expected_labels[] = {ASCIIToUTF16("*3456")}; - string16 expected_icons[] = {ASCIIToUTF16("visaCC")}; + base::string16 expected_values[] = {ASCIIToUTF16("************3456")}; + base::string16 expected_labels[] = {ASCIIToUTF16("*3456")}; + base::string16 expected_icons[] = {ASCIIToUTF16("visaCC")}; int expected_unique_ids[] = {autofill_manager_->GetPackedCreditCardID(4)}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1251,23 +1255,24 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsNonCCNumber) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Elvis Presley"), ASCIIToUTF16("Buddy Holly") }; - string16 expected_labels[] = {ASCIIToUTF16("*3456"), ASCIIToUTF16("*8765")}; - string16 expected_icons[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("*3456"), + ASCIIToUTF16("*8765") }; + base::string16 expected_icons[] = { ASCIIToUTF16("visaCC"), ASCIIToUTF16("genericCC") }; @@ -1294,22 +1299,22 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsNonHTTPS) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION) }; - string16 expected_labels[] = {string16()}; - string16 expected_icons[] = {string16()}; + base::string16 expected_labels[] = {base::string16()}; + base::string16 expected_icons[] = {base::string16()}; int expected_unique_ids[] = {-1}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1320,20 +1325,22 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsNonHTTPS) { const int kPageID2 = 2; GetAutofillSuggestions(kPageID2, form, field); - std::vector<string16> suggestions; + std::vector<base::string16> suggestions; suggestions.push_back(ASCIIToUTF16("Jay")); suggestions.push_back(ASCIIToUTF16("Jason")); AutocompleteSuggestionsReturned(suggestions); EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values2[] = { + base::string16 expected_values2[] = { l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION), ASCIIToUTF16("Jay"), ASCIIToUTF16("Jason") }; - string16 expected_labels2[] = {string16(), string16(), string16()}; - string16 expected_icons2[] = {string16(), string16(), string16()}; + base::string16 expected_labels2[] = { base::string16(), base::string16(), + base::string16() }; + base::string16 expected_icons2[] = { base::string16(), base::string16(), + base::string16() }; int expected_unique_ids2[] = {-1, 0, 0}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kPageID2, arraysize(expected_values2), expected_values2, @@ -1368,28 +1375,28 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsRepeatedObfuscatedNumber) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("************3456"), ASCIIToUTF16("************8765"), ASCIIToUTF16("************3456") }; - string16 expected_labels[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("*3456"), ASCIIToUTF16("*8765"), ASCIIToUTF16("*3456"), }; - string16 expected_icons[] = { + base::string16 expected_icons[] = { ASCIIToUTF16("visaCC"), ASCIIToUTF16("genericCC"), ASCIIToUTF16("masterCardCC") @@ -1418,26 +1425,26 @@ TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestions) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right address suggestions to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Elvis"), ASCIIToUTF16("Charles") }; - string16 expected_labels[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("3734 Elvis Presley Blvd."), ASCIIToUTF16("123 Apple St.") }; - string16 expected_icons[] = {string16(), string16()}; + base::string16 expected_icons[] = {base::string16(), base::string16()}; int expected_unique_ids[] = {1, 2}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1450,19 +1457,20 @@ TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestions) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the credit card suggestions to the renderer. page_id = 0; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values2[] = { + base::string16 expected_values2[] = { ASCIIToUTF16("************3456"), ASCIIToUTF16("************8765") }; - string16 expected_labels2[] = {ASCIIToUTF16("*3456"), ASCIIToUTF16("*8765")}; - string16 expected_icons2[] = { + base::string16 expected_labels2[] = { ASCIIToUTF16("*3456"), + ASCIIToUTF16("*8765")}; + base::string16 expected_icons2[] = { ASCIIToUTF16("visaCC"), ASCIIToUTF16("genericCC") }; @@ -1492,26 +1500,26 @@ TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestionsNonHttps) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right address suggestions to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Elvis"), ASCIIToUTF16("Charles") }; - string16 expected_labels[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("3734 Elvis Presley Blvd."), ASCIIToUTF16("123 Apple St.") }; - string16 expected_icons[] = {string16(), string16()}; + base::string16 expected_icons[] = {base::string16(), base::string16()}; int expected_unique_ids[] = {1, 2}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1524,17 +1532,17 @@ TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestionsNonHttps) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values2[] = { + base::string16 expected_values2[] = { l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION) }; - string16 expected_labels2[] = {string16()}; - string16 expected_icons2[] = {string16()}; + base::string16 expected_labels2[] = {base::string16()}; + base::string16 expected_icons2[] = {base::string16()}; int expected_unique_ids2[] = {-1}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kPageID2, arraysize(expected_values2), expected_values2, @@ -1559,7 +1567,7 @@ TEST_F(AutofillManagerTest, GetCombinedAutofillAndAutocompleteSuggestions) { // Add some Autocomplete suggestions. // This triggers the combined message send. - std::vector<string16> suggestions; + std::vector<base::string16> suggestions; suggestions.push_back(ASCIIToUTF16("Jay")); // This suggestion is a duplicate, and should be trimmed. suggestions.push_back(ASCIIToUTF16("Elvis")); @@ -1568,26 +1576,27 @@ TEST_F(AutofillManagerTest, GetCombinedAutofillAndAutocompleteSuggestions) { // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Elvis"), ASCIIToUTF16("Charles"), ASCIIToUTF16("Jay"), ASCIIToUTF16("Jason") }; - string16 expected_labels[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("3734 Elvis Presley Blvd."), ASCIIToUTF16("123 Apple St."), - string16(), - string16() + base::string16(), + base::string16() }; - string16 expected_icons[] = {string16(), string16(), string16(), string16()}; + base::string16 expected_icons[] = { base::string16(), base::string16(), + base::string16(), base::string16()}; int expected_unique_ids[] = {1, 2, 0, 0}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1610,22 +1619,22 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsWhenFormIsAutofilled) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Elvis"), ASCIIToUTF16("Charles") }; - string16 expected_labels[] = {string16(), string16()}; - string16 expected_icons[] = {string16(), string16()}; + base::string16 expected_labels[] = {base::string16(), base::string16()}; + base::string16 expected_icons[] = {base::string16(), base::string16()}; int expected_unique_ids[] = {1, 2}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1649,26 +1658,26 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForAutocompleteOnly) { // Add some Autocomplete suggestions. // This triggers the combined message send. - std::vector<string16> suggestions; + std::vector<base::string16> suggestions; suggestions.push_back(ASCIIToUTF16("one")); suggestions.push_back(ASCIIToUTF16("two")); AutocompleteSuggestionsReturned(suggestions); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("one"), ASCIIToUTF16("two") }; - string16 expected_labels[] = {string16(), string16()}; - string16 expected_icons[] = {string16(), string16()}; + base::string16 expected_labels[] = {base::string16(), base::string16()}; + base::string16 expected_icons[] = {base::string16(), base::string16()}; int expected_unique_ids[] = {0, 0}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1698,20 +1707,20 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsWithDuplicateValues) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { ASCIIToUTF16("Elvis") }; - string16 expected_labels[] = { string16() }; - string16 expected_icons[] = { string16() }; + base::string16 expected_values[] = { ASCIIToUTF16("Elvis") }; + base::string16 expected_labels[] = { base::string16() }; + base::string16 expected_icons[] = { base::string16() }; int expected_unique_ids[] = { 1 }; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1732,7 +1741,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileUnfilled) { autofill_test::SetProfileInfo(profile, "Elvis", "", "Presley", "me@x.com", "", "", "", "", "", "", "", ""); profile->set_guid("00000000-0000-0000-0000-000000000101"); - std::vector<string16> multi_values(2); + std::vector<base::string16> multi_values(2); multi_values[0] = ASCIIToUTF16("Elvis Presley"); multi_values[1] = ASCIIToUTF16("Elena Love"); profile->SetRawMultiInfo(NAME_FULL, multi_values); @@ -1748,25 +1757,25 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileUnfilled) { GetAutofillSuggestions(form, field); // Trigger the |Send|. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Elvis"), ASCIIToUTF16("Elena") }; - string16 expected_labels[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("me@x.com"), ASCIIToUTF16("me@x.com") }; - string16 expected_icons[] = { string16(), string16() }; + base::string16 expected_icons[] = { base::string16(), base::string16() }; int expected_unique_ids[] = { 1, 2 }; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), @@ -1783,20 +1792,20 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileUnfilled) { GetAutofillSuggestions(form, field); // Trigger the |Send|. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { ASCIIToUTF16("Elena") }; - string16 expected_labels[] = { ASCIIToUTF16("me@x.com") }; - string16 expected_icons[] = { string16() }; + base::string16 expected_values[] = { ASCIIToUTF16("Elena") }; + base::string16 expected_labels[] = { ASCIIToUTF16("me@x.com") }; + base::string16 expected_icons[] = { base::string16() }; int expected_unique_ids[] = { 2 }; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), @@ -1817,7 +1826,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileFilled) { // |profile| will be owned by the mock PersonalDataManager. AutofillProfile* profile = new AutofillProfile; profile->set_guid("00000000-0000-0000-0000-000000000102"); - std::vector<string16> multi_values(3); + std::vector<base::string16> multi_values(3); multi_values[0] = ASCIIToUTF16("Travis Smith"); multi_values[1] = ASCIIToUTF16("Cynthia Love"); multi_values[2] = ASCIIToUTF16("Zac Mango"); @@ -1832,24 +1841,26 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileFilled) { GetAutofillSuggestions(form, field); // Trigger the |Send|. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; EXPECT_TRUE(GetAutofillSuggestionsMessage(&page_id, &values, &labels, &icons, &unique_ids)); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("Travis"), ASCIIToUTF16("Cynthia"), ASCIIToUTF16("Zac") }; - string16 expected_labels[] = { string16(), string16(), string16() }; - string16 expected_icons[] = { string16(), string16(), string16() }; + base::string16 expected_labels[] = { base::string16(), base::string16(), + base::string16() }; + base::string16 expected_icons[] = { base::string16(), base::string16(), + base::string16() }; int expected_unique_ids[] = { 1, 2, 3 }; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -1865,7 +1876,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsFancyPhone) { AutofillProfile* profile = new AutofillProfile; profile->set_guid("00000000-0000-0000-0000-000000000103"); - std::vector<string16> multi_values(1); + std::vector<base::string16> multi_values(1); multi_values[0] = ASCIIToUTF16("Natty Bumppo"); profile->SetRawMultiInfo(NAME_FULL, multi_values); multi_values[0] = ASCIIToUTF16("1800PRAIRIE"); @@ -1877,30 +1888,31 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsFancyPhone) { // No suggestions provided, so send an empty vector as the results. // This triggers the combined message send. - AutocompleteSuggestionsReturned(std::vector<string16>()); + AutocompleteSuggestionsReturned(std::vector<base::string16>()); // Test that we sent the right message to the renderer. int page_id = 0; - std::vector<string16> values; - std::vector<string16> labels; - std::vector<string16> icons; + std::vector<base::string16> values; + std::vector<base::string16> labels; + std::vector<base::string16> icons; std::vector<int> unique_ids; GetAutofillSuggestionsMessage( &page_id, &values, &labels, &icons, &unique_ids); - string16 expected_values[] = { + base::string16 expected_values[] = { ASCIIToUTF16("12345678901"), ASCIIToUTF16("23456789012"), ASCIIToUTF16("18007724743"), // 1800PRAIRIE }; // Inferred labels include full first relevant field, which in this case is // the address line 1. - string16 expected_labels[] = { + base::string16 expected_labels[] = { ASCIIToUTF16("Elvis Aaron Presley"), ASCIIToUTF16("Charles Hardin Holley"), ASCIIToUTF16("Natty Bumppo"), }; - string16 expected_icons[] = {string16(), string16(), string16()}; + base::string16 expected_icons[] = { base::string16(), base::string16(), + base::string16()}; int expected_unique_ids[] = {1, 2, 3}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, @@ -2134,7 +2146,7 @@ TEST_F(AutofillManagerTest, FillFormWithMultipleSections) { // The second address section should be empty. ASSERT_EQ(results.fields.size(), 2*kAddressFormSize); for (size_t i = kAddressFormSize; i < form.fields.size(); ++i) { - EXPECT_EQ(string16(), results.fields[i].value); + EXPECT_EQ(base::string16(), results.fields[i].value); } // The first address section should be filled with Elvis's data. @@ -2159,7 +2171,7 @@ TEST_F(AutofillManagerTest, FillFormWithMultipleSections) { // The first address section should be empty. ASSERT_EQ(results.fields.size(), 2*kAddressFormSize); for (size_t i = 0; i < kAddressFormSize; ++i) { - EXPECT_EQ(string16(), results.fields[i].value); + EXPECT_EQ(base::string16(), results.fields[i].value); } // The second address section should be filled with Elvis's data. @@ -2168,8 +2180,8 @@ TEST_F(AutofillManagerTest, FillFormWithMultipleSections) { secondSection.fields.begin() + kAddressFormSize); for (size_t i = 0; i < kAddressFormSize; ++i) { // Restore the expected field names. - string16 name = secondSection.fields[i].name; - string16 original_name = name.substr(0, name.size() - 1); + base::string16 name = secondSection.fields[i].name; + base::string16 original_name = name.substr(0, name.size() - 1); secondSection.fields[i].name = original_name; } ExpectFilledAddressFormElvis(page_id, secondSection, kPageID2, false); @@ -2442,9 +2454,9 @@ TEST_F(AutofillManagerTest, FillAddressFormWithVariantType) { // Add a name variant to the Elvis profile. AutofillProfile* profile = autofill_manager_->GetProfileWithGUID( "00000000-0000-0000-0000-000000000001"); - const string16 elvis_name = profile->GetRawInfo(NAME_FULL); + const base::string16 elvis_name = profile->GetRawInfo(NAME_FULL); - std::vector<string16> name_variants; + std::vector<base::string16> name_variants; name_variants.push_back(ASCIIToUTF16("Some Other Guy")); name_variants.push_back(elvis_name); profile->SetRawMultiInfo(NAME_FULL, name_variants); @@ -2550,7 +2562,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { EXPECT_EQ(ASCIIToUTF16("650"), results1.fields[1].value); EXPECT_EQ(ASCIIToUTF16("555"), results1.fields[2].value); EXPECT_EQ(ASCIIToUTF16("4567"), results1.fields[3].value); - EXPECT_EQ(string16(), results1.fields[4].value); + EXPECT_EQ(base::string16(), results1.fields[4].value); page_id = 2; FillAutofillFormData(page_id, form_with_autocompletetype, @@ -2566,7 +2578,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { EXPECT_EQ(ASCIIToUTF16("650"), results2.fields[1].value); EXPECT_EQ(ASCIIToUTF16("555"), results2.fields[2].value); EXPECT_EQ(ASCIIToUTF16("4567"), results2.fields[3].value); - EXPECT_EQ(string16(), results2.fields[4].value); + EXPECT_EQ(base::string16(), results2.fields[4].value); // We should not be able to fill prefix and suffix fields for international // numbers. @@ -2587,7 +2599,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { EXPECT_EQ(ASCIIToUTF16("7700"), results3.fields[1].value); EXPECT_EQ(ASCIIToUTF16("954321"), results3.fields[2].value); EXPECT_EQ(ASCIIToUTF16("954321"), results3.fields[3].value); - EXPECT_EQ(string16(), results3.fields[4].value); + EXPECT_EQ(base::string16(), results3.fields[4].value); page_id = 4; FillAutofillFormData(page_id, form_with_autocompletetype, @@ -2603,10 +2615,10 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { EXPECT_EQ(ASCIIToUTF16("7700"), results4.fields[1].value); EXPECT_EQ(ASCIIToUTF16("954321"), results4.fields[2].value); EXPECT_EQ(ASCIIToUTF16("954321"), results4.fields[3].value); - EXPECT_EQ(string16(), results4.fields[4].value); + EXPECT_EQ(base::string16(), results4.fields[4].value); // We should fill all phone fields with the same phone number variant. - std::vector<string16> phone_variants; + std::vector<base::string16> phone_variants; phone_variants.push_back(ASCIIToUTF16("16505554567")); phone_variants.push_back(ASCIIToUTF16("18887771234")); work_profile->SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); @@ -2627,7 +2639,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { EXPECT_EQ(ASCIIToUTF16("888"), results5.fields[1].value); EXPECT_EQ(ASCIIToUTF16("777"), results5.fields[2].value); EXPECT_EQ(ASCIIToUTF16("1234"), results5.fields[3].value); - EXPECT_EQ(string16(), results5.fields[4].value); + EXPECT_EQ(base::string16(), results5.fields[4].value); } // Test that we can still fill a form when a field has been removed from it. diff --git a/components/autofill/browser/autofill_merge_unittest.cc b/components/autofill/browser/autofill_merge_unittest.cc index 5a85b5e..e3f6bc8 100644 --- a/components/autofill/browser/autofill_merge_unittest.cc +++ b/components/autofill/browser/autofill_merge_unittest.cc @@ -50,7 +50,7 @@ std::string SerializeProfiles(const std::vector<AutofillProfile*>& profiles) { result += "\n"; for (size_t j = 0; j < arraysize(kProfileFieldTypes); ++j) { AutofillFieldType type = kProfileFieldTypes[j]; - std::vector<string16> values; + std::vector<base::string16> values; profiles[i]->GetRawMultiInfo(type, &values); for (size_t k = 0; k < values.size(); ++k) { result += AutofillType::FieldTypeToString(type); @@ -173,8 +173,9 @@ void AutofillMergeTest::MergeProfiles(const std::string& profiles, // Add a field to the current profile. size_t separator_pos = line.find(kFieldSeparator); ASSERT_NE(std::string::npos, separator_pos); - string16 field_type = UTF8ToUTF16(line.substr(0, separator_pos)); - string16 value = UTF8ToUTF16(line.substr(separator_pos + kFieldOffset)); + base::string16 field_type = UTF8ToUTF16(line.substr(0, separator_pos)); + base::string16 value = + UTF8ToUTF16(line.substr(separator_pos + kFieldOffset)); FormFieldData field; field.label = field_type; diff --git a/components/autofill/browser/autofill_metrics_unittest.cc b/components/autofill/browser/autofill_metrics_unittest.cc index a03d5b7..1c20057 100644 --- a/components/autofill/browser/autofill_metrics_unittest.cc +++ b/components/autofill/browser/autofill_metrics_unittest.cc @@ -213,7 +213,7 @@ class TestAutofillManager : public AutofillManager { const std::string& experiment_id) { FormData empty_form = form; for (size_t i = 0; i < empty_form.fields.size(); ++i) { - empty_form.fields[i].value = string16(); + empty_form.fields[i].value = base::string16(); } // |form_structure| will be owned by |form_structures()|. @@ -1345,7 +1345,7 @@ TEST_F(AutofillMetricsTest, UserHappinessFormLoadAndSubmission) { } // Clear out the third field's value. - form.fields[2].value = string16(); + form.fields[2].value = base::string16(); forms.front() = form; // Expect notifications when the form is submitted. diff --git a/components/autofill/browser/autofill_popup_delegate.h b/components/autofill/browser/autofill_popup_delegate.h index ad1c990..595a0e0 100644 --- a/components/autofill/browser/autofill_popup_delegate.h +++ b/components/autofill/browser/autofill_popup_delegate.h @@ -28,10 +28,12 @@ class AutofillPopupDelegate { virtual void DidSelectSuggestion(int identifier) = 0; // Inform the delegate that a row in the popup has been chosen. - virtual void DidAcceptSuggestion(const string16& value, int identifier) = 0; + virtual void DidAcceptSuggestion(const base::string16& value, + int identifier) = 0; // Delete the described suggestion. - virtual void RemoveSuggestion(const string16& value, int identifier) = 0; + virtual void RemoveSuggestion(const base::string16& value, + int identifier) = 0; // Informs the delegate that the Autofill previewed form should be cleared. virtual void ClearPreviewedForm() = 0; diff --git a/components/autofill/browser/autofill_profile.cc b/components/autofill/browser/autofill_profile.cc index 98fd901..6faeeb2 100644 --- a/components/autofill/browser/autofill_profile.cc +++ b/components/autofill/browser/autofill_profile.cc @@ -107,10 +107,11 @@ void GetFieldsForDistinguishingProfiles( // A helper function for string streaming. Concatenates multi-valued entries // stored for a given |type| into a single string. This string is returned. -const string16 MultiString(const AutofillProfile& p, AutofillFieldType type) { - std::vector<string16> values; +const base::string16 MultiString(const AutofillProfile& p, + AutofillFieldType type) { + std::vector<base::string16> values; p.GetRawMultiInfo(type, &values); - string16 accumulate; + base::string16 accumulate; for (size_t i = 0; i < values.size(); ++i) { if (i > 0) accumulate += ASCIIToUTF16(" "); @@ -119,9 +120,9 @@ const string16 MultiString(const AutofillProfile& p, AutofillFieldType type) { return accumulate; } -string16 GetFormGroupInfo(const FormGroup& form_group, - AutofillFieldType type, - const std::string& app_locale) { +base::string16 GetFormGroupInfo(const FormGroup& form_group, + AutofillFieldType type, + const std::string& app_locale) { return app_locale.empty() ? form_group.GetRawInfo(type) : form_group.GetInfo(type, app_locale); @@ -129,7 +130,7 @@ string16 GetFormGroupInfo(const FormGroup& form_group, template <class T> void CopyValuesToItems(AutofillFieldType type, - const std::vector<string16>& values, + const std::vector<base::string16>& values, std::vector<T>* form_group_items, const T& prototype) { form_group_items->resize(values.size(), prototype); @@ -146,7 +147,7 @@ template <class T> void CopyItemsToValues(AutofillFieldType type, const std::vector<T>& form_group_items, const std::string& app_locale, - std::vector<string16>* values) { + std::vector<base::string16>* values) { values->resize(form_group_items.size()); for (size_t i = 0; i < values->size(); ++i) { (*values)[i] = GetFormGroupInfo(form_group_items[i], type, app_locale); @@ -186,7 +187,7 @@ void CollapseCompoundFieldTypes(FieldTypeSet* type_set) { class FindByPhone { public: - FindByPhone(const string16& phone, + FindByPhone(const base::string16& phone, const std::string& country_code, const std::string& app_locale) : phone_(phone), @@ -194,27 +195,27 @@ class FindByPhone { app_locale_(app_locale) { } - bool operator()(const string16& phone) { + bool operator()(const base::string16& phone) { return autofill_i18n::PhoneNumbersMatch( phone, phone_, country_code_, app_locale_); } - bool operator()(const string16* phone) { + bool operator()(const base::string16* phone) { return autofill_i18n::PhoneNumbersMatch( *phone, phone_, country_code_, app_locale_); } private: - string16 phone_; + base::string16 phone_; std::string country_code_; std::string app_locale_; }; // Functor used to check for case-insensitive equality of two strings. struct CaseInsensitiveStringEquals - : public std::binary_function<string16, string16, bool> + : public std::binary_function<base::string16, base::string16, bool> { - bool operator()(const string16& x, const string16& y) const { + bool operator()(const base::string16& x, const base::string16& y) const { return x.size() == y.size() && StringToLowerASCII(x) == StringToLowerASCII(y); } @@ -268,7 +269,7 @@ std::string AutofillProfile::GetGUID() const { return guid(); } -void AutofillProfile::GetMatchingTypes(const string16& text, +void AutofillProfile::GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const { FormGroupList info = FormGroups(); @@ -276,34 +277,34 @@ void AutofillProfile::GetMatchingTypes(const string16& text, (*it)->GetMatchingTypes(text, app_locale, matching_types); } -string16 AutofillProfile::GetRawInfo(AutofillFieldType type) const { +base::string16 AutofillProfile::GetRawInfo(AutofillFieldType type) const { AutofillFieldType return_type = AutofillType::GetEquivalentFieldType(type); const FormGroup* form_group = FormGroupForType(return_type); if (!form_group) - return string16(); + return base::string16(); return form_group->GetRawInfo(return_type); } void AutofillProfile::SetRawInfo(AutofillFieldType type, - const string16& value) { + const base::string16& value) { FormGroup* form_group = MutableFormGroupForType(type); if (form_group) form_group->SetRawInfo(type, CollapseWhitespace(value, false)); } -string16 AutofillProfile::GetInfo(AutofillFieldType type, +base::string16 AutofillProfile::GetInfo(AutofillFieldType type, const std::string& app_locale) const { AutofillFieldType return_type = AutofillType::GetEquivalentFieldType(type); const FormGroup* form_group = FormGroupForType(return_type); if (!form_group) - return string16(); + return base::string16(); return form_group->GetInfo(return_type, app_locale); } bool AutofillProfile::SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) { FormGroup* form_group = MutableFormGroupForType(type); if (!form_group) @@ -313,8 +314,9 @@ bool AutofillProfile::SetInfo(AutofillFieldType type, form_group->SetInfo(type, CollapseWhitespace(value, false), app_locale); } -void AutofillProfile::SetRawMultiInfo(AutofillFieldType type, - const std::vector<string16>& values) { +void AutofillProfile::SetRawMultiInfo( + AutofillFieldType type, + const std::vector<base::string16>& values) { switch (AutofillType(type).group()) { case AutofillType::NAME: CopyValuesToItems(type, values, &name_, NameInfo()); @@ -332,7 +334,7 @@ void AutofillProfile::SetRawMultiInfo(AutofillFieldType type, if (values.size() == 1) { SetRawInfo(type, values[0]); } else if (values.size() == 0) { - SetRawInfo(type, string16()); + SetRawInfo(type, base::string16()); } else { // Shouldn't attempt to set multiple values on single-valued field. NOTREACHED(); @@ -341,14 +343,15 @@ void AutofillProfile::SetRawMultiInfo(AutofillFieldType type, } } -void AutofillProfile::GetRawMultiInfo(AutofillFieldType type, - std::vector<string16>* values) const { +void AutofillProfile::GetRawMultiInfo( + AutofillFieldType type, + std::vector<base::string16>* values) const { GetMultiInfoImpl(type, std::string(), values); } void AutofillProfile::GetMultiInfo(AutofillFieldType type, const std::string& app_locale, - std::vector<string16>* values) const { + std::vector<base::string16>* values) const { GetMultiInfoImpl(type, app_locale, values); } @@ -365,7 +368,7 @@ void AutofillProfile::FillFormField(const AutofillField& field, } else if (field_data->form_control_type == "select-one") { FillSelectControl(type, app_locale, field_data); } else { - std::vector<string16> values; + std::vector<base::string16> values; GetMultiInfo(type, app_locale, &values); if (variant >= values.size()) { // If the variant is unavailable, bail. This case is reachable, for @@ -381,13 +384,13 @@ void AutofillProfile::FillPhoneNumberField(const AutofillField& field, size_t variant, const std::string& app_locale, FormFieldData* field_data) const { - std::vector<string16> values; + std::vector<base::string16> values; GetMultiInfo(field.type(), app_locale, &values); DCHECK(variant < values.size()); // 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 = values[variant]; + base::string16 number = values[variant]; if (number.length() == PhoneNumber::kPrefixLength + PhoneNumber::kSuffixLength) { if (field.phone_part() == AutofillField::PHONE_PREFIX || @@ -404,7 +407,7 @@ void AutofillProfile::FillPhoneNumberField(const AutofillField& field, field_data->value = number; } -const string16 AutofillProfile::Label() const { +const base::string16 AutofillProfile::Label() const { return label_; } @@ -437,8 +440,8 @@ int AutofillProfile::Compare(const AutofillProfile& profile) const { PHONE_HOME_WHOLE_NUMBER }; for (size_t i = 0; i < arraysize(multi_value_types); ++i) { - std::vector<string16> values_a; - std::vector<string16> values_b; + std::vector<base::string16> values_a; + std::vector<base::string16> values_b; GetRawMultiInfo(multi_value_types[i], &values_a); profile.GetRawMultiInfo(multi_value_types[i], &values_b); if (values_a.size() < values_b.size()) @@ -463,7 +466,7 @@ bool AutofillProfile::operator!=(const AutofillProfile& profile) const { return !operator==(profile); } -const string16 AutofillProfile::PrimaryValue() const { +const base::string16 AutofillProfile::PrimaryValue() const { return GetRawInfo(ADDRESS_HOME_LINE1) + GetRawInfo(ADDRESS_HOME_CITY); } @@ -512,9 +515,9 @@ void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile, for (FieldTypeSet::const_iterator iter = field_types.begin(); iter != field_types.end(); ++iter) { if (AutofillProfile::SupportsMultiValue(*iter)) { - std::vector<string16> new_values; + std::vector<base::string16> new_values; profile.GetRawMultiInfo(*iter, &new_values); - std::vector<string16> existing_values; + std::vector<base::string16> existing_values; GetRawMultiInfo(*iter, &existing_values); // GetMultiInfo always returns at least one element, even if the profile @@ -523,22 +526,24 @@ void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile, existing_values.clear(); FieldTypeGroup group = AutofillType(*iter).group(); - for (std::vector<string16>::iterator value_iter = new_values.begin(); + for (std::vector<base::string16>::iterator value_iter = + new_values.begin(); value_iter != new_values.end(); ++value_iter) { // Don't add duplicates. if (group == AutofillType::PHONE) { AddPhoneIfUnique(*value_iter, app_locale, &existing_values); } else { - std::vector<string16>::const_iterator existing_iter = std::find_if( - existing_values.begin(), existing_values.end(), - std::bind1st(CaseInsensitiveStringEquals(), *value_iter)); + std::vector<base::string16>::const_iterator existing_iter = + std::find_if( + existing_values.begin(), existing_values.end(), + std::bind1st(CaseInsensitiveStringEquals(), *value_iter)); if (existing_iter == existing_values.end()) existing_values.insert(existing_values.end(), *value_iter); } } SetRawMultiInfo(*iter, existing_values); } else { - string16 new_value = profile.GetRawInfo(*iter); + base::string16 new_value = profile.GetRawInfo(*iter); if (StringToLowerASCII(GetRawInfo(*iter)) != StringToLowerASCII(new_value)) { SetRawInfo(*iter, new_value); @@ -560,7 +565,7 @@ bool AutofillProfile::AdjustInferredLabels( std::vector<AutofillProfile*>* profiles) { const size_t kMinimalFieldsShown = 2; - std::vector<string16> created_labels; + std::vector<base::string16> created_labels; CreateInferredLabels(profiles, NULL, UNKNOWN_TYPE, kMinimalFieldsShown, &created_labels); DCHECK_EQ(profiles->size(), created_labels.size()); @@ -581,7 +586,7 @@ void AutofillProfile::CreateInferredLabels( const std::vector<AutofillFieldType>* suggested_fields, AutofillFieldType excluded_field, size_t minimal_fields_shown, - std::vector<string16>* created_labels) { + std::vector<base::string16>* created_labels) { DCHECK(profiles); DCHECK(created_labels); @@ -592,21 +597,21 @@ void AutofillProfile::CreateInferredLabels( // Construct the default label for each profile. Also construct a map that // associates each label with the profiles that have this label. This map is // then used to detect which labels need further differentiating fields. - std::map<string16, std::list<size_t> > labels; + std::map<base::string16, std::list<size_t> > labels; for (size_t i = 0; i < profiles->size(); ++i) { - string16 label = + base::string16 label = (*profiles)[i]->ConstructInferredLabel(fields_to_use, minimal_fields_shown); labels[label].push_back(i); } created_labels->resize(profiles->size()); - for (std::map<string16, std::list<size_t> >::const_iterator it = + for (std::map<base::string16, std::list<size_t> >::const_iterator it = labels.begin(); it != labels.end(); ++it) { if (it->second.size() == 1) { // This label is unique, so use it without any further ado. - string16 label = it->first; + base::string16 label = it->first; size_t profile_index = it->second.front(); (*created_labels)[profile_index] = label; } else { @@ -634,8 +639,8 @@ bool AutofillProfile::FillCountrySelectControl( for (size_t i = 0; i < field_data->option_values.size(); ++i) { // Canonicalize each <option> value to a country code, and compare to the // target country code. - string16 value = field_data->option_values[i]; - string16 contents = field_data->option_contents[i]; + base::string16 value = field_data->option_values[i]; + base::string16 contents = field_data->option_contents[i]; if (country_code == AutofillCountry::GetCountryCode(value, app_locale) || country_code == AutofillCountry::GetCountryCode(contents, app_locale)) { field_data->value = value; @@ -646,9 +651,10 @@ bool AutofillProfile::FillCountrySelectControl( return false; } -void AutofillProfile::GetMultiInfoImpl(AutofillFieldType type, - const std::string& app_locale, - std::vector<string16>* values) const { +void AutofillProfile::GetMultiInfoImpl( + AutofillFieldType type, + const std::string& app_locale, + std::vector<base::string16>* values) const { switch (AutofillType(type).group()) { case AutofillType::NAME: CopyItemsToValues(type, name_, app_locale, values); @@ -665,9 +671,10 @@ void AutofillProfile::GetMultiInfoImpl(AutofillFieldType type, } } -void AutofillProfile::AddPhoneIfUnique(const string16& phone, - const std::string& app_locale, - std::vector<string16>* existing_phones) { +void AutofillProfile::AddPhoneIfUnique( + const base::string16& phone, + const std::string& app_locale, + std::vector<base::string16>* existing_phones) { DCHECK(existing_phones); // Phones allow "fuzzy" matching, so "1-800-FLOWERS", "18003569377", // "(800)356-9377" and "356-9377" are considered the same. @@ -679,19 +686,19 @@ void AutofillProfile::AddPhoneIfUnique(const string16& phone, } } -string16 AutofillProfile::ConstructInferredLabel( +base::string16 AutofillProfile::ConstructInferredLabel( const std::vector<AutofillFieldType>& included_fields, size_t num_fields_to_use) const { - const string16 separator = + const base::string16 separator = l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_SUMMARY_SEPARATOR); - string16 label; + base::string16 label; size_t num_fields_used = 0; for (std::vector<AutofillFieldType>::const_iterator it = included_fields.begin(); it != included_fields.end() && num_fields_used < num_fields_to_use; ++it) { - string16 field = GetRawInfo(*it); + base::string16 field = GetRawInfo(*it); if (field.empty()) continue; @@ -710,20 +717,20 @@ void AutofillProfile::CreateDifferentiatingLabels( const std::list<size_t>& indices, const std::vector<AutofillFieldType>& fields, size_t num_fields_to_include, - std::vector<string16>* created_labels) { + std::vector<base::string16>* created_labels) { // For efficiency, we first construct a map of fields to their text values and // each value's frequency. std::map<AutofillFieldType, - std::map<string16, size_t> > field_text_frequencies_by_field; + std::map<base::string16, size_t> > field_text_frequencies_by_field; for (std::vector<AutofillFieldType>::const_iterator field = fields.begin(); field != fields.end(); ++field) { - std::map<string16, size_t>& field_text_frequencies = + std::map<base::string16, size_t>& field_text_frequencies = field_text_frequencies_by_field[*field]; for (std::list<size_t>::const_iterator it = indices.begin(); it != indices.end(); ++it) { const AutofillProfile* profile = profiles[*it]; - string16 field_text = profile->GetRawInfo(*field); + base::string16 field_text = profile->GetRawInfo(*field); // If this label is not already in the map, add it with frequency 0. if (!field_text_frequencies.count(field_text)) @@ -750,14 +757,14 @@ void AutofillProfile::CreateDifferentiatingLabels( for (std::vector<AutofillFieldType>::const_iterator field = fields.begin(); field != fields.end(); ++field) { // Skip over empty fields. - string16 field_text = profile->GetRawInfo(*field); + base::string16 field_text = profile->GetRawInfo(*field); if (field_text.empty()) continue; - std::map<string16, size_t>& field_text_frequencies = + std::map<base::string16, size_t>& field_text_frequencies = field_text_frequencies_by_field[*field]; found_differentiating_field |= - !field_text_frequencies.count(string16()) && + !field_text_frequencies.count(base::string16()) && (field_text_frequencies[field_text] == 1); // Once we've found enough non-empty fields, skip over any remaining diff --git a/components/autofill/browser/autofill_profile.h b/components/autofill/browser/autofill_profile.h index be7367b..538a6f9 100644 --- a/components/autofill/browser/autofill_profile.h +++ b/components/autofill/browser/autofill_profile.h @@ -39,16 +39,16 @@ class AutofillProfile : public FormGroup { // FormGroup: virtual std::string GetGUID() const OVERRIDE; - virtual void GetMatchingTypes(const string16& text, + virtual void GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const OVERRIDE; - virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; + virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; virtual void SetRawInfo(AutofillFieldType type, - const string16& value) OVERRIDE; - virtual string16 GetInfo(AutofillFieldType type, + const base::string16& value) OVERRIDE; + virtual base::string16 GetInfo(AutofillFieldType type, const std::string& app_locale) const OVERRIDE; virtual bool SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) OVERRIDE; virtual void FillFormField(const AutofillField& field, size_t variant, @@ -57,12 +57,12 @@ class AutofillProfile : public FormGroup { // Multi-value equivalents to |GetInfo| and |SetInfo|. void SetRawMultiInfo(AutofillFieldType type, - const std::vector<string16>& values); + const std::vector<base::string16>& values); void GetRawMultiInfo(AutofillFieldType type, - std::vector<string16>* values) const; + std::vector<base::string16>* values) const; void GetMultiInfo(AutofillFieldType type, const std::string& app_locale, - std::vector<string16>* values) const; + std::vector<base::string16>* values) const; // Set |field_data|'s value for phone number based on contents of |this|. // The |field| specifies the type of the phone and whether this is a @@ -76,7 +76,7 @@ class AutofillProfile : public FormGroup { // The user-visible label of the profile, generated in relation to other // profiles. Shows at least 2 fields that differentiate profile from other // profiles. See AdjustInferredLabels() further down for more description. - const string16 Label() const; + const base::string16 Label() const; // This guid is the primary identifier for |AutofillProfile| objects. // TODO(estade): remove this and just use GetGUID(). |guid_| can probably @@ -102,7 +102,7 @@ class AutofillProfile : public FormGroup { // Returns concatenation of full name and address line 1. This acts as the // basis of comparison for new values that are submitted through forms to // aid with correct aggregation of new data. - const string16 PrimaryValue() const; + const base::string16 PrimaryValue() const; // Returns true if the data in this AutofillProfile is a subset of the data in // |profile|. @@ -143,7 +143,7 @@ class AutofillProfile : public FormGroup { const std::vector<AutofillFieldType>* suggested_fields, AutofillFieldType excluded_field, size_t minimal_fields_shown, - std::vector<string16>* created_labels); + std::vector<base::string16>* created_labels); private: typedef std::vector<const FormGroup*> FormGroupList; @@ -158,20 +158,20 @@ class AutofillProfile : public FormGroup { // canonicalized according to the given |app_locale|, if appropriate. void GetMultiInfoImpl(AutofillFieldType type, const std::string& app_locale, - std::vector<string16>* values) const; + std::vector<base::string16>* values) const; // Checks if the |phone| is in the |existing_phones| using fuzzy matching: // for example, "1-800-FLOWERS", "18003569377", "(800)356-9377" and "356-9377" // are considered the same. // Adds the |phone| to the |existing_phones| if not already there. - void AddPhoneIfUnique(const string16& phone, + void AddPhoneIfUnique(const base::string16& phone, const std::string& app_locale, - std::vector<string16>* existing_phones); + std::vector<base::string16>* existing_phones); // Builds inferred label from the first |num_fields_to_include| non-empty // fields in |label_fields|. Uses as many fields as possible if there are not // enough non-empty fields. - string16 ConstructInferredLabel( + base::string16 ConstructInferredLabel( const std::vector<AutofillFieldType>& label_fields, size_t num_fields_to_include) const; @@ -185,7 +185,7 @@ class AutofillProfile : public FormGroup { const std::list<size_t>& indices, const std::vector<AutofillFieldType>& fields, size_t num_fields_to_include, - std::vector<string16>* created_labels); + std::vector<base::string16>* created_labels); // Utilities for listing and lookup of the data members that constitute // user-visible profile information. @@ -194,7 +194,7 @@ class AutofillProfile : public FormGroup { FormGroup* MutableFormGroupForType(AutofillFieldType type); // The label presented to the user when selecting a profile. - string16 label_; + base::string16 label_; // The guid of this profile. std::string guid_; diff --git a/components/autofill/browser/autofill_profile_unittest.cc b/components/autofill/browser/autofill_profile_unittest.cc index 1fb38c1..71c03cc 100644 --- a/components/autofill/browser/autofill_profile_unittest.cc +++ b/components/autofill/browser/autofill_profile_unittest.cc @@ -33,8 +33,8 @@ TEST(AutofillProfileTest, PreviewSummaryString) { AutofillProfile profile0; // Empty profile - nothing to update. EXPECT_FALSE(UpdateProfileLabel(&profile0)); - string16 summary0 = profile0.Label(); - EXPECT_EQ(string16(), summary0); + base::string16 summary0 = profile0.Label(); + EXPECT_EQ(base::string16(), summary0); // Case 0a/empty name and address, so the first two fields of the rest of the // data is used: "Hollywood, CA" @@ -43,7 +43,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "johnwayne@me.xyz", "Fox", "", "", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile00)); - string16 summary00 = profile00.Label(); + base::string16 summary00 = profile00.Label(); EXPECT_EQ(ASCIIToUTF16("Hollywood, CA"), summary00); // Case 1: "<address>" without line 2. @@ -52,7 +52,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "johnwayne@me.xyz", "Fox", "123 Zoo St.", "", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile1)); - string16 summary1 = profile1.Label(); + base::string16 summary1 = profile1.Label(); EXPECT_EQ(ASCIIToUTF16("123 Zoo St., Hollywood"), summary1); // Case 1a: "<address>" with line 2. @@ -61,7 +61,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile1a)); - string16 summary1a = profile1a.Label(); + base::string16 summary1a = profile1a.Label(); EXPECT_EQ(ASCIIToUTF16("123 Zoo St., unit 5"), summary1a); // Case 2: "<lastname>" @@ -70,7 +70,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "Morrison", "johnwayne@me.xyz", "Fox", "", "", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile2)); - string16 summary2 = profile2.Label(); + base::string16 summary2 = profile2.Label(); // Summary includes full name, to the maximal extent available. EXPECT_EQ(ASCIIToUTF16("Mitchell Morrison, Hollywood"), summary2); @@ -80,7 +80,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile3)); - string16 summary3 = profile3.Label(); + base::string16 summary3 = profile3.Label(); EXPECT_EQ(ASCIIToUTF16("Mitchell Morrison, 123 Zoo St."), summary3); // Case 4: "<firstname>" @@ -89,7 +89,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "johnwayne@me.xyz", "Fox", "", "", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile4)); - string16 summary4 = profile4.Label(); + base::string16 summary4 = profile4.Label(); EXPECT_EQ(ASCIIToUTF16("Marion Mitchell, Hollywood"), summary4); // Case 5: "<firstname>, <address>" @@ -98,7 +98,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile5)); - string16 summary5 = profile5.Label(); + base::string16 summary5 = profile5.Label(); EXPECT_EQ(ASCIIToUTF16("Marion Mitchell, 123 Zoo St."), summary5); // Case 6: "<firstname> <lastname>" @@ -107,7 +107,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "Morrison", "johnwayne@me.xyz", "Fox", "", "", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile6)); - string16 summary6 = profile6.Label(); + base::string16 summary6 = profile6.Label(); EXPECT_EQ(ASCIIToUTF16("Marion Mitchell Morrison, Hollywood"), summary6); @@ -117,7 +117,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "16505678910"); EXPECT_TRUE(UpdateProfileLabel(&profile7)); - string16 summary7 = profile7.Label(); + base::string16 summary7 = profile7.Label(); EXPECT_EQ(ASCIIToUTF16("Marion Mitchell Morrison, 123 Zoo St."), summary7); @@ -132,7 +132,7 @@ TEST(AutofillProfileTest, PreviewSummaryString) { profiles.push_back(&profile7a); EXPECT_TRUE(AutofillProfile::AdjustInferredLabels(&profiles)); summary7 = profile7.Label(); - string16 summary7a = profile7a.Label(); + base::string16 summary7a = profile7a.Label(); EXPECT_EQ(ASCIIToUTF16( "Marion Mitchell Morrison, 123 Zoo St., johnwayne@me.xyz"), summary7); EXPECT_EQ(ASCIIToUTF16( @@ -324,7 +324,7 @@ TEST(AutofillProfileTest, CreateInferredLabels) { "91222", "US", "12345678910"); - std::vector<string16> labels; + std::vector<base::string16> labels; // Two fields at least - no filter. AutofillProfile::CreateInferredLabels(&profiles, NULL, UNKNOWN_TYPE, 2, &labels); @@ -376,8 +376,8 @@ TEST(AutofillProfileTest, CreateInferredLabels) { // field. AutofillProfile::CreateInferredLabels(&profiles, &suggested_fields, NAME_MIDDLE, 1, &labels); - EXPECT_EQ(string16(), labels[0]); - EXPECT_EQ(string16(), labels[1]); + EXPECT_EQ(base::string16(), labels[0]); + EXPECT_EQ(base::string16(), labels[1]); suggested_fields.clear(); // In our implementation we always display NAME_FULL for NAME_MIDDLE_INITIAL @@ -396,8 +396,8 @@ TEST(AutofillProfileTest, CreateInferredLabels) { suggested_fields.push_back(ADDRESS_HOME_LINE1); AutofillProfile::CreateInferredLabels(&profiles, &suggested_fields, NAME_FULL, 1, &labels); - EXPECT_EQ(string16(ASCIIToUTF16("666 Erebus St.")), labels[0]); - EXPECT_EQ(string16(ASCIIToUTF16("123 Letha Shore.")), labels[1]); + EXPECT_EQ(base::string16(ASCIIToUTF16("666 Erebus St.")), labels[0]); + EXPECT_EQ(base::string16(ASCIIToUTF16("123 Letha Shore.")), labels[1]); // Clean up. STLDeleteContainerPointers(profiles.begin(), profiles.end()); @@ -422,7 +422,7 @@ TEST(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) { suggested_fields.push_back(NAME_LAST); suggested_fields.push_back(ADDRESS_HOME_LINE1); suggested_fields.push_back(EMAIL_ADDRESS); - std::vector<string16> labels; + std::vector<base::string16> labels; AutofillProfile::CreateInferredLabels(&profiles.get(), &suggested_fields, NAME_LAST, 1, &labels); ASSERT_EQ(2U, labels.size()); @@ -456,7 +456,7 @@ TEST(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) { suggested_fields.push_back(ADDRESS_HOME_LINE1); suggested_fields.push_back(ADDRESS_BILLING_LINE1); suggested_fields.push_back(EMAIL_ADDRESS); - std::vector<string16> labels; + std::vector<base::string16> labels; AutofillProfile::CreateInferredLabels(&profiles.get(), &suggested_fields, UNKNOWN_TYPE, 2, &labels); ASSERT_EQ(2U, labels.size()); @@ -480,7 +480,7 @@ TEST(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) { "John", "", "Doe", "john.doe@example.com", "Goolge", "", "", "", "", "", "", ""); - std::vector<string16> labels; + std::vector<base::string16> labels; AutofillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 3, &labels); ASSERT_EQ(3U, labels.size()); @@ -591,9 +591,9 @@ TEST(AutofillProfileTest, Compare) { TEST(AutofillProfileTest, MultiValueNames) { AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("John Doe")); - const string16 kJohnPDoe(ASCIIToUTF16("John P. Doe")); - std::vector<string16> set_values; + const base::string16 kJohnDoe(ASCIIToUTF16("John Doe")); + const base::string16 kJohnPDoe(ASCIIToUTF16("John P. Doe")); + std::vector<base::string16> set_values; set_values.push_back(kJohnDoe); set_values.push_back(kJohnPDoe); p.SetRawMultiInfo(NAME_FULL, set_values); @@ -602,7 +602,7 @@ TEST(AutofillProfileTest, MultiValueNames) { EXPECT_EQ(kJohnDoe, p.GetRawInfo(NAME_FULL)); // Ensure that we get out what we put in. - std::vector<string16> get_values; + std::vector<base::string16> get_values; p.GetRawMultiInfo(NAME_FULL, &get_values); ASSERT_EQ(2UL, get_values.size()); EXPECT_EQ(kJohnDoe, get_values[0]); @@ -611,7 +611,7 @@ TEST(AutofillProfileTest, MultiValueNames) { // Update the values. AutofillProfile p2 = p; EXPECT_EQ(0, p.Compare(p2)); - const string16 kNoOne(ASCIIToUTF16("No One")); + const base::string16 kNoOne(ASCIIToUTF16("No One")); set_values[1] = kNoOne; p.SetRawMultiInfo(NAME_FULL, set_values); p.GetRawMultiInfo(NAME_FULL, &get_values); @@ -625,17 +625,17 @@ TEST(AutofillProfileTest, MultiValueNames) { p.SetRawMultiInfo(NAME_FULL, set_values); p.GetRawMultiInfo(NAME_FULL, &get_values); ASSERT_EQ(1UL, get_values.size()); - EXPECT_EQ(string16(), get_values[0]); + EXPECT_EQ(base::string16(), get_values[0]); // Expect regular |GetInfo| returns empty value. - EXPECT_EQ(string16(), p.GetRawInfo(NAME_FULL)); + EXPECT_EQ(base::string16(), p.GetRawInfo(NAME_FULL)); } TEST(AutofillProfileTest, MultiValueEmails) { AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("john@doe.com")); - const string16 kJohnPDoe(ASCIIToUTF16("john_p@doe.com")); - std::vector<string16> set_values; + const base::string16 kJohnDoe(ASCIIToUTF16("john@doe.com")); + const base::string16 kJohnPDoe(ASCIIToUTF16("john_p@doe.com")); + std::vector<base::string16> set_values; set_values.push_back(kJohnDoe); set_values.push_back(kJohnPDoe); p.SetRawMultiInfo(EMAIL_ADDRESS, set_values); @@ -644,7 +644,7 @@ TEST(AutofillProfileTest, MultiValueEmails) { EXPECT_EQ(kJohnDoe, p.GetRawInfo(EMAIL_ADDRESS)); // Ensure that we get out what we put in. - std::vector<string16> get_values; + std::vector<base::string16> get_values; p.GetRawMultiInfo(EMAIL_ADDRESS, &get_values); ASSERT_EQ(2UL, get_values.size()); EXPECT_EQ(kJohnDoe, get_values[0]); @@ -653,7 +653,7 @@ TEST(AutofillProfileTest, MultiValueEmails) { // Update the values. AutofillProfile p2 = p; EXPECT_EQ(0, p.Compare(p2)); - const string16 kNoOne(ASCIIToUTF16("no@one.com")); + const base::string16 kNoOne(ASCIIToUTF16("no@one.com")); set_values[1] = kNoOne; p.SetRawMultiInfo(EMAIL_ADDRESS, set_values); p.GetRawMultiInfo(EMAIL_ADDRESS, &get_values); @@ -667,17 +667,17 @@ TEST(AutofillProfileTest, MultiValueEmails) { p.SetRawMultiInfo(EMAIL_ADDRESS, set_values); p.GetRawMultiInfo(EMAIL_ADDRESS, &get_values); ASSERT_EQ(1UL, get_values.size()); - EXPECT_EQ(string16(), get_values[0]); + EXPECT_EQ(base::string16(), get_values[0]); // Expect regular |GetInfo| returns empty value. - EXPECT_EQ(string16(), p.GetRawInfo(EMAIL_ADDRESS)); + EXPECT_EQ(base::string16(), p.GetRawInfo(EMAIL_ADDRESS)); } TEST(AutofillProfileTest, MultiValuePhone) { AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("4151112222")); - const string16 kJohnPDoe(ASCIIToUTF16("4151113333")); - std::vector<string16> set_values; + const base::string16 kJohnDoe(ASCIIToUTF16("4151112222")); + const base::string16 kJohnPDoe(ASCIIToUTF16("4151113333")); + std::vector<base::string16> set_values; set_values.push_back(kJohnDoe); set_values.push_back(kJohnPDoe); p.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, set_values); @@ -686,7 +686,7 @@ TEST(AutofillProfileTest, MultiValuePhone) { EXPECT_EQ(kJohnDoe, p.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); // Ensure that we get out what we put in. - std::vector<string16> get_values; + std::vector<base::string16> get_values; p.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &get_values); ASSERT_EQ(2UL, get_values.size()); EXPECT_EQ(kJohnDoe, get_values[0]); @@ -695,7 +695,7 @@ TEST(AutofillProfileTest, MultiValuePhone) { // Update the values. AutofillProfile p2 = p; EXPECT_EQ(0, p.Compare(p2)); - const string16 kNoOne(ASCIIToUTF16("4152110000")); + const base::string16 kNoOne(ASCIIToUTF16("4152110000")); set_values[1] = kNoOne; p.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, set_values); p.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &get_values); @@ -709,17 +709,17 @@ TEST(AutofillProfileTest, MultiValuePhone) { p.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, set_values); p.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &get_values); ASSERT_EQ(1UL, get_values.size()); - EXPECT_EQ(string16(), get_values[0]); + EXPECT_EQ(base::string16(), get_values[0]); // Expect regular |GetInfo| returns empty value. - EXPECT_EQ(string16(), p.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); + EXPECT_EQ(base::string16(), p.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); } TEST(AutofillProfileTest, AddressCountryFull) { const char* const kCountries[] = { "Albania", "Canada" }; - std::vector<string16> options(arraysize(kCountries)); + std::vector<base::string16> options(arraysize(kCountries)); for (size_t i = 0; i < arraysize(kCountries); ++i) { options[i] = ASCIIToUTF16(kCountries[i]); } @@ -739,7 +739,7 @@ TEST(AutofillProfileTest, AddressCountryAbbrev) { const char* const kCountries[] = { "AL", "CA" }; - std::vector<string16> options(arraysize(kCountries)); + std::vector<base::string16> options(arraysize(kCountries)); for (size_t i = 0; i < arraysize(kCountries); ++i) { options[i] = ASCIIToUTF16(kCountries[i]); } @@ -759,7 +759,7 @@ TEST(AutofillProfileTest, AddressStateFull) { const char* const kStates[] = { "Alabama", "California" }; - std::vector<string16> options(arraysize(kStates)); + std::vector<base::string16> options(arraysize(kStates)); for (size_t i = 0; i < arraysize(kStates); ++i) { options[i] = ASCIIToUTF16(kStates[i]); } @@ -779,7 +779,7 @@ TEST(AutofillProfileTest, AddressStateAbbrev) { const char* const kStates[] = { "AL", "CA" }; - std::vector<string16> options(arraysize(kStates)); + std::vector<base::string16> options(arraysize(kStates)); for (size_t i = 0; i < arraysize(kStates); ++i) { options[i] = ASCIIToUTF16(kStates[i]); } @@ -799,8 +799,8 @@ TEST(AutofillProfileTest, FillByValue) { const char* const kStates[] = { "Alabama", "California" }; - std::vector<string16> values(arraysize(kStates)); - std::vector<string16> contents(arraysize(kStates)); + std::vector<base::string16> values(arraysize(kStates)); + std::vector<base::string16> contents(arraysize(kStates)); for (unsigned int i = 0; i < arraysize(kStates); ++i) { values[i] = ASCIIToUTF16(kStates[i]); contents[i] = ASCIIToUTF16(base::StringPrintf("%u", i)); @@ -821,8 +821,8 @@ TEST(AutofillProfileTest, FillByContents) { const char* const kStates[] = { "Alabama", "California" }; - std::vector<string16> values(arraysize(kStates)); - std::vector<string16> contents(arraysize(kStates)); + std::vector<base::string16> values(arraysize(kStates)); + std::vector<base::string16> contents(arraysize(kStates)); for (unsigned int i = 0; i < arraysize(kStates); ++i) { values[i] = ASCIIToUTF16(base::StringPrintf("%u", i + 1)); contents[i] = ASCIIToUTF16(kStates[i]); diff --git a/components/autofill/browser/autofill_regexes.cc b/components/autofill/browser/autofill_regexes.cc index 64df56a..18bf96b 100644 --- a/components/autofill/browser/autofill_regexes.cc +++ b/components/autofill/browser/autofill_regexes.cc @@ -22,7 +22,7 @@ class AutofillRegexes { static AutofillRegexes* GetInstance(); // Returns the compiled regex matcher corresponding to |pattern|. - icu::RegexMatcher* GetMatcher(const string16& pattern); + icu::RegexMatcher* GetMatcher(const base::string16& pattern); private: AutofillRegexes(); @@ -30,7 +30,7 @@ class AutofillRegexes { friend struct DefaultSingletonTraits<AutofillRegexes>; // Maps patterns to their corresponding regex matchers. - std::map<string16, icu::RegexMatcher*> matchers_; + std::map<base::string16, icu::RegexMatcher*> matchers_; DISALLOW_COPY_AND_ASSIGN(AutofillRegexes); }; @@ -48,7 +48,7 @@ AutofillRegexes::~AutofillRegexes() { matchers_.end()); } -icu::RegexMatcher* AutofillRegexes::GetMatcher(const string16& pattern) { +icu::RegexMatcher* AutofillRegexes::GetMatcher(const base::string16& pattern) { if (!matchers_.count(pattern)) { const icu::UnicodeString icu_pattern(pattern.data(), pattern.length()); @@ -68,7 +68,8 @@ icu::RegexMatcher* AutofillRegexes::GetMatcher(const string16& pattern) { namespace autofill { -bool MatchesPattern(const string16& input, const string16& pattern) { +bool MatchesPattern(const base::string16& input, + const base::string16& pattern) { icu::RegexMatcher* matcher = AutofillRegexes::GetInstance()->GetMatcher(pattern); icu::UnicodeString icu_input(input.data(), input.length()); diff --git a/components/autofill/browser/autofill_regexes.h b/components/autofill/browser/autofill_regexes.h index 8d5a8f97..cfd23ef 100644 --- a/components/autofill/browser/autofill_regexes.h +++ b/components/autofill/browser/autofill_regexes.h @@ -12,7 +12,8 @@ namespace autofill { // Case-insensitive regular expression matching. // Returns true if |pattern| is found in |input|. -bool MatchesPattern(const string16& input, const string16& pattern); +bool MatchesPattern(const base::string16& input, + const base::string16& pattern); } // namespace autofill diff --git a/components/autofill/browser/autofill_type.h b/components/autofill/browser/autofill_type.h index a199c24..0598c4e 100644 --- a/components/autofill/browser/autofill_type.h +++ b/components/autofill/browser/autofill_type.h @@ -49,6 +49,6 @@ class AutofillType { typedef AutofillType::FieldTypeGroup FieldTypeGroup; typedef std::set<AutofillFieldType> FieldTypeSet; -typedef std::map<string16, AutofillFieldType> FieldTypeMap; +typedef std::map<base::string16, AutofillFieldType> FieldTypeMap; #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_TYPE_H_ diff --git a/components/autofill/browser/contact_info.cc b/components/autofill/browser/contact_info.cc index 7911ea8..019d076 100644 --- a/components/autofill/browser/contact_info.cc +++ b/components/autofill/browser/contact_info.cc @@ -50,7 +50,7 @@ void NameInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { supported_types->insert(NAME_FULL); } -string16 NameInfo::GetRawInfo(AutofillFieldType type) const { +base::string16 NameInfo::GetRawInfo(AutofillFieldType type) const { if (type == NAME_FIRST) return first(); @@ -66,10 +66,10 @@ string16 NameInfo::GetRawInfo(AutofillFieldType type) const { if (type == NAME_FULL) return FullName(); - return string16(); + return base::string16(); } -void NameInfo::SetRawInfo(AutofillFieldType type, const string16& value) { +void NameInfo::SetRawInfo(AutofillFieldType type, const base::string16& value) { DCHECK_EQ(AutofillType::NAME, AutofillType(type).group()); if (type == NAME_FIRST) first_ = value; @@ -83,8 +83,8 @@ void NameInfo::SetRawInfo(AutofillFieldType type, const string16& value) { NOTREACHED(); } -string16 NameInfo::FullName() const { - std::vector<string16> full_name; +base::string16 NameInfo::FullName() const { + std::vector<base::string16> full_name; if (!first_.empty()) full_name.push_back(first_); @@ -97,23 +97,23 @@ string16 NameInfo::FullName() const { return JoinString(full_name, ' '); } -string16 NameInfo::MiddleInitial() const { +base::string16 NameInfo::MiddleInitial() const { if (middle_.empty()) - return string16(); + return base::string16(); - string16 middle_name(middle()); - string16 initial; + base::string16 middle_name(middle()); + base::string16 initial; initial.push_back(middle_name[0]); return initial; } -void NameInfo::SetFullName(const string16& full) { +void NameInfo::SetFullName(const base::string16& full) { // Clear the names. - first_ = string16(); - middle_ = string16(); - last_ = string16(); + first_ = base::string16(); + middle_ = base::string16(); + last_ = base::string16(); - std::vector<string16> full_name_tokens; + std::vector<base::string16> full_name_tokens; Tokenize(full, ASCIIToUTF16(" "), &full_name_tokens); // There are four possibilities: empty; first name; first and last names; @@ -151,14 +151,15 @@ void EmailInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { supported_types->insert(EMAIL_ADDRESS); } -string16 EmailInfo::GetRawInfo(AutofillFieldType type) const { +base::string16 EmailInfo::GetRawInfo(AutofillFieldType type) const { if (type == EMAIL_ADDRESS) return email_; - return string16(); + return base::string16(); } -void EmailInfo::SetRawInfo(AutofillFieldType type, const string16& value) { +void EmailInfo::SetRawInfo(AutofillFieldType type, + const base::string16& value) { DCHECK_EQ(EMAIL_ADDRESS, type); email_ = value; } @@ -183,14 +184,15 @@ void CompanyInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { supported_types->insert(COMPANY_NAME); } -string16 CompanyInfo::GetRawInfo(AutofillFieldType type) const { +base::string16 CompanyInfo::GetRawInfo(AutofillFieldType type) const { if (type == COMPANY_NAME) return company_name_; - return string16(); + return base::string16(); } -void CompanyInfo::SetRawInfo(AutofillFieldType type, const string16& value) { +void CompanyInfo::SetRawInfo(AutofillFieldType type, + const base::string16& value) { DCHECK_EQ(COMPANY_NAME, type); company_name_ = value; } diff --git a/components/autofill/browser/contact_info.h b/components/autofill/browser/contact_info.h index 7426627..5686f34 100644 --- a/components/autofill/browser/contact_info.h +++ b/components/autofill/browser/contact_info.h @@ -22,9 +22,9 @@ class NameInfo : public FormGroup { NameInfo& operator=(const NameInfo& info); // FormGroup: - virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; + virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; virtual void SetRawInfo(AutofillFieldType type, - const string16& value) OVERRIDE; + const base::string16& value) OVERRIDE; private: // FormGroup: @@ -32,23 +32,23 @@ class NameInfo : public FormGroup { // Returns the full name, which can include up to the first, middle, and last // name. - string16 FullName() const; + base::string16 FullName() const; // Returns the middle initial if |middle_| is non-empty. Returns an empty // string otherwise. - string16 MiddleInitial() const; + base::string16 MiddleInitial() const; - const string16& first() const { return first_; } - const string16& middle() const { return middle_; } - const string16& last() const { return last_; } + const base::string16& first() const { return first_; } + const base::string16& middle() const { return middle_; } + const base::string16& last() const { return last_; } // Sets |first_|, |middle_|, and |last_| to the tokenized |full|. // It is tokenized on a space only. - void SetFullName(const string16& full); + void SetFullName(const base::string16& full); - string16 first_; - string16 middle_; - string16 last_; + base::string16 first_; + base::string16 middle_; + base::string16 last_; }; class EmailInfo : public FormGroup { @@ -60,15 +60,15 @@ class EmailInfo : public FormGroup { EmailInfo& operator=(const EmailInfo& info); // FormGroup: - virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; + virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; virtual void SetRawInfo(AutofillFieldType type, - const string16& value) OVERRIDE; + const base::string16& value) OVERRIDE; private: // FormGroup: virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; - string16 email_; + base::string16 email_; }; class CompanyInfo : public FormGroup { @@ -80,15 +80,15 @@ class CompanyInfo : public FormGroup { CompanyInfo& operator=(const CompanyInfo& info); // FormGroup: - virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; + virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; virtual void SetRawInfo(AutofillFieldType type, - const string16& value) OVERRIDE; + const base::string16& value) OVERRIDE; private: // FormGroup: virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; - string16 company_name_; + base::string16 company_name_; }; #endif // COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_ diff --git a/components/autofill/browser/contact_info_unittest.cc b/components/autofill/browser/contact_info_unittest.cc index 377a219..27d990d 100644 --- a/components/autofill/browser/contact_info_unittest.cc +++ b/components/autofill/browser/contact_info_unittest.cc @@ -15,13 +15,13 @@ TEST(NameInfoTest, SetFullName) { NameInfo name; name.SetRawInfo(NAME_FULL, ASCIIToUTF16("Virgil")); EXPECT_EQ(name.GetRawInfo(NAME_FIRST), ASCIIToUTF16("Virgil")); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), string16()); - EXPECT_EQ(name.GetRawInfo(NAME_LAST), string16()); + EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), base::string16()); + EXPECT_EQ(name.GetRawInfo(NAME_LAST), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("Virgil")); name.SetRawInfo(NAME_FULL, ASCIIToUTF16("Murray Gell-Mann")); EXPECT_EQ(name.GetRawInfo(NAME_FIRST), ASCIIToUTF16("Murray")); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), string16()); + EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_LAST), ASCIIToUTF16("Gell-Mann")); EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("Murray Gell-Mann")); @@ -44,49 +44,49 @@ TEST(NameInfoTest, SetFullName) { TEST(NameInfoTest, GetFullName) { NameInfo name; name.SetRawInfo(NAME_FIRST, ASCIIToUTF16("First")); - name.SetRawInfo(NAME_MIDDLE, string16()); - name.SetRawInfo(NAME_LAST, string16()); + name.SetRawInfo(NAME_MIDDLE, base::string16()); + name.SetRawInfo(NAME_LAST, base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_FIRST), ASCIIToUTF16("First")); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), string16()); - EXPECT_EQ(name.GetRawInfo(NAME_LAST), string16()); + EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), base::string16()); + EXPECT_EQ(name.GetRawInfo(NAME_LAST), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("First")); - name.SetRawInfo(NAME_FIRST, string16()); + name.SetRawInfo(NAME_FIRST, base::string16()); name.SetRawInfo(NAME_MIDDLE, ASCIIToUTF16("Middle")); - name.SetRawInfo(NAME_LAST, string16()); - EXPECT_EQ(name.GetRawInfo(NAME_FIRST), string16()); + name.SetRawInfo(NAME_LAST, base::string16()); + EXPECT_EQ(name.GetRawInfo(NAME_FIRST), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), ASCIIToUTF16("Middle")); - EXPECT_EQ(name.GetRawInfo(NAME_LAST), string16()); + EXPECT_EQ(name.GetRawInfo(NAME_LAST), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("Middle")); - name.SetRawInfo(NAME_FIRST, string16()); - name.SetRawInfo(NAME_MIDDLE, string16()); + name.SetRawInfo(NAME_FIRST, base::string16()); + name.SetRawInfo(NAME_MIDDLE, base::string16()); name.SetRawInfo(NAME_LAST, ASCIIToUTF16("Last")); - EXPECT_EQ(name.GetRawInfo(NAME_FIRST), string16()); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), string16()); + EXPECT_EQ(name.GetRawInfo(NAME_FIRST), base::string16()); + EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_LAST), ASCIIToUTF16("Last")); EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("Last")); name.SetRawInfo(NAME_FIRST, ASCIIToUTF16("First")); name.SetRawInfo(NAME_MIDDLE, ASCIIToUTF16("Middle")); - name.SetRawInfo(NAME_LAST, string16()); + name.SetRawInfo(NAME_LAST, base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_FIRST), ASCIIToUTF16("First")); EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), ASCIIToUTF16("Middle")); - EXPECT_EQ(name.GetRawInfo(NAME_LAST), string16()); + EXPECT_EQ(name.GetRawInfo(NAME_LAST), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("First Middle")); name.SetRawInfo(NAME_FIRST, ASCIIToUTF16("First")); - name.SetRawInfo(NAME_MIDDLE, string16()); + name.SetRawInfo(NAME_MIDDLE, base::string16()); name.SetRawInfo(NAME_LAST, ASCIIToUTF16("Last")); EXPECT_EQ(name.GetRawInfo(NAME_FIRST), ASCIIToUTF16("First")); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), string16()); + EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_LAST), ASCIIToUTF16("Last")); EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("First Last")); - name.SetRawInfo(NAME_FIRST, string16()); + name.SetRawInfo(NAME_FIRST, base::string16()); name.SetRawInfo(NAME_MIDDLE, ASCIIToUTF16("Middle")); name.SetRawInfo(NAME_LAST, ASCIIToUTF16("Last")); - EXPECT_EQ(name.GetRawInfo(NAME_FIRST), string16()); + EXPECT_EQ(name.GetRawInfo(NAME_FIRST), base::string16()); EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), ASCIIToUTF16("Middle")); EXPECT_EQ(name.GetRawInfo(NAME_LAST), ASCIIToUTF16("Last")); EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("Middle Last")); diff --git a/components/autofill/browser/credit_card.cc b/components/autofill/browser/credit_card.cc index d02b47d..576d282 100644 --- a/components/autofill/browser/credit_card.cc +++ b/components/autofill/browser/credit_card.cc @@ -38,7 +38,7 @@ const char16 kCreditCardObfuscationSymbol = '*'; // too large and fills the screen. const size_t kMaxObfuscationSize = 20; -std::string GetCreditCardType(const string16& number) { +std::string GetCreditCardType(const base::string16& number) { // Don't check for a specific type if this is not a credit card number. if (!autofill::IsValidCreditCardNumber(number)) return kGenericCard; @@ -122,7 +122,7 @@ std::string GetCreditCardType(const string16& number) { return kGenericCard; } -bool ConvertYear(const string16& year, int* num) { +bool ConvertYear(const base::string16& year, int* num) { // If the |year| is empty, clear the stored value. if (year.empty()) { *num = 0; @@ -137,7 +137,7 @@ bool ConvertYear(const string16& year, int* num) { return false; } -bool ConvertMonth(const string16& month, +bool ConvertMonth(const base::string16& month, const std::string& app_locale, int* num) { // If the |month| is empty, clear the stored value. @@ -156,7 +156,7 @@ bool ConvertMonth(const string16& month, // Otherwise, try parsing the |month| as a named month, e.g. "January" or // "Jan". - string16 lowercased_month = StringToLowerASCII(month); + base::string16 lowercased_month = StringToLowerASCII(month); UErrorCode status = U_ZERO_ERROR; icu::Locale locale(app_locale.c_str()); @@ -167,7 +167,7 @@ bool ConvertMonth(const string16& month, int32_t num_months; const icu::UnicodeString* months = date_format_symbols.getMonths(num_months); for (int32_t i = 0; i < num_months; ++i) { - const string16 icu_month = string16(months[i].getBuffer(), + const base::string16 icu_month = base::string16(months[i].getBuffer(), months[i].length()); if (lowercased_month == StringToLowerASCII(icu_month)) { *num = i + 1; // Adjust from 0-indexed to 1-indexed. @@ -177,7 +177,7 @@ bool ConvertMonth(const string16& month, months = date_format_symbols.getShortMonths(num_months); for (int32_t i = 0; i < num_months; ++i) { - const string16 icu_month = string16(months[i].getBuffer(), + const base::string16 icu_month = base::string16(months[i].getBuffer(), months[i].length()); if (lowercased_month == StringToLowerASCII(icu_month)) { *num = i + 1; // Adjust from 0-indexed to 1-indexed. @@ -212,15 +212,15 @@ CreditCard::CreditCard(const CreditCard& credit_card) : FormGroup() { CreditCard::~CreditCard() {} // static -const string16 CreditCard::StripSeparators(const string16& number) { +const base::string16 CreditCard::StripSeparators(const base::string16& number) { const char16 kSeparators[] = {'-', ' ', '\0'}; - string16 stripped; + base::string16 stripped; RemoveChars(number, kSeparators, &stripped); return stripped; } // static -string16 CreditCard::TypeForDisplay(const std::string& type) { +base::string16 CreditCard::TypeForDisplay(const std::string& type) { if (type == kAmericanExpressCard) return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_AMEX); if (type == kDinersCard) @@ -239,14 +239,14 @@ string16 CreditCard::TypeForDisplay(const std::string& type) { // If you hit this DCHECK, the above list of cases needs to be updated to // include a new card. DCHECK_EQ(kGenericCard, type); - return string16(); + return base::string16(); } std::string CreditCard::GetGUID() const { return guid(); } -string16 CreditCard::GetRawInfo(AutofillFieldType type) const { +base::string16 CreditCard::GetRawInfo(AutofillFieldType type) const { switch (type) { case CREDIT_CARD_NAME: return name_on_card_; @@ -261,19 +261,19 @@ string16 CreditCard::GetRawInfo(AutofillFieldType type) const { return Expiration4DigitYearAsString(); case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR: { - string16 month = ExpirationMonthAsString(); - string16 year = Expiration2DigitYearAsString(); + base::string16 month = ExpirationMonthAsString(); + base::string16 year = Expiration2DigitYearAsString(); if (!month.empty() && !year.empty()) return month + ASCIIToUTF16("/") + year; - return string16(); + return base::string16(); } case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR: { - string16 month = ExpirationMonthAsString(); - string16 year = Expiration4DigitYearAsString(); + base::string16 month = ExpirationMonthAsString(); + base::string16 year = Expiration4DigitYearAsString(); if (!month.empty() && !year.empty()) return month + ASCIIToUTF16("/") + year; - return string16(); + return base::string16(); } case CREDIT_CARD_TYPE: @@ -284,15 +284,16 @@ string16 CreditCard::GetRawInfo(AutofillFieldType type) const { case CREDIT_CARD_VERIFICATION_CODE: // Chrome doesn't store credit card verification codes. - return string16(); + return base::string16(); default: // ComputeDataPresentForArray will hit this repeatedly. - return string16(); + return base::string16(); } } -void CreditCard::SetRawInfo(AutofillFieldType type, const string16& value) { +void CreditCard::SetRawInfo(AutofillFieldType type, + const base::string16& value) { switch (type) { case CREDIT_CARD_NAME: name_on_card_ = value; @@ -339,7 +340,7 @@ void CreditCard::SetRawInfo(AutofillFieldType type, const string16& value) { } } -string16 CreditCard::GetInfo(AutofillFieldType type, +base::string16 CreditCard::GetInfo(AutofillFieldType type, const std::string& app_locale) const { if (type == CREDIT_CARD_NUMBER) return StripSeparators(number_); @@ -348,7 +349,7 @@ string16 CreditCard::GetInfo(AutofillFieldType type, } bool CreditCard::SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) { if (type == CREDIT_CARD_NUMBER) SetRawInfo(type, StripSeparators(value)); @@ -360,12 +361,12 @@ bool CreditCard::SetInfo(AutofillFieldType type, return true; } -void CreditCard::GetMatchingTypes(const string16& text, +void CreditCard::GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const { FormGroup::GetMatchingTypes(text, app_locale, matching_types); - string16 card_number = GetInfo(CREDIT_CARD_NUMBER, app_locale); + base::string16 card_number = GetInfo(CREDIT_CARD_NUMBER, app_locale); if (!card_number.empty() && StripSeparators(text) == card_number) matching_types->insert(CREDIT_CARD_NUMBER); @@ -376,17 +377,17 @@ void CreditCard::GetMatchingTypes(const string16& text, } } -const string16 CreditCard::Label() const { - string16 label; +const base::string16 CreditCard::Label() const { + base::string16 label; if (number().empty()) return name_on_card_; // No CC number, return name only. - string16 obfuscated_cc_number = ObfuscatedNumber(); + base::string16 obfuscated_cc_number = ObfuscatedNumber(); if (!expiration_month_ || !expiration_year_) return obfuscated_cc_number; // No expiration date set. // TODO(georgey): Internationalize date. - string16 formatted_date(ExpirationMonthAsString()); + base::string16 formatted_date(ExpirationMonthAsString()); formatted_date.append(ASCIIToUTF16("/")); formatted_date.append(Expiration4DigitYearAsString()); @@ -396,12 +397,12 @@ const string16 CreditCard::Label() const { return label; } -void CreditCard::SetInfoForMonthInputType(const string16& value) { +void CreditCard::SetInfoForMonthInputType(const base::string16& value) { // Check if |text| is "yyyy-mm" format first, and check normal month format. if (!autofill::MatchesPattern(value, UTF8ToUTF16("^[0-9]{4}-[0-9]{1,2}$"))) return; - std::vector<string16> year_month; + std::vector<base::string16> year_month; base::SplitString(value, L'-', &year_month); DCHECK_EQ((int)year_month.size(), 2); int num = 0; @@ -414,39 +415,39 @@ void CreditCard::SetInfoForMonthInputType(const string16& value) { SetExpirationMonth(num); } -string16 CreditCard::ObfuscatedNumber() const { +base::string16 CreditCard::ObfuscatedNumber() const { // If the number is shorter than four digits, there's no need to obfuscate it. if (number_.size() < 4) return number_; - string16 number = StripSeparators(number_); + base::string16 number = StripSeparators(number_); // Avoid making very long obfuscated numbers. size_t obfuscated_digits = std::min(kMaxObfuscationSize, number.size() - 4); - string16 result(obfuscated_digits, kCreditCardObfuscationSymbol); + base::string16 result(obfuscated_digits, kCreditCardObfuscationSymbol); return result.append(LastFourDigits()); } -string16 CreditCard::LastFourDigits() const { +base::string16 CreditCard::LastFourDigits() const { static const size_t kNumLastDigits = 4; - string16 number = StripSeparators(number_); + base::string16 number = StripSeparators(number_); if (number.size() < kNumLastDigits) - return string16(); + return base::string16(); return number.substr(number.size() - kNumLastDigits, kNumLastDigits); } -string16 CreditCard::TypeForDisplay() const { +base::string16 CreditCard::TypeForDisplay() const { return CreditCard::TypeForDisplay(type_); } -string16 CreditCard::TypeAndLastFourDigits() const { - string16 type = TypeForDisplay(); +base::string16 CreditCard::TypeAndLastFourDigits() const { + base::string16 type = TypeForDisplay(); // TODO(estade): type may be empty, we probably want to return // "Card - 1234" or something in that case. - string16 digits = LastFourDigits(); + base::string16 digits = LastFourDigits(); if (digits.empty()) return type; @@ -520,8 +521,8 @@ void CreditCard::FillFormField(const AutofillField& field, FillSelectControl(field.type(), app_locale, field_data); } else if (field_data->form_control_type == "month") { // HTML5 input="month" consists of year-month. - string16 year = GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, app_locale); - string16 month = GetInfo(CREDIT_CARD_EXP_MONTH, app_locale); + base::string16 year = GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, app_locale); + base::string16 month = GetInfo(CREDIT_CARD_EXP_MONTH, app_locale); if (!year.empty() && !month.empty()) { // Fill the value only if |this| includes both year and month // information. @@ -585,34 +586,34 @@ void CreditCard::GetSupportedTypes(FieldTypeSet* supported_types) const { supported_types->insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); } -string16 CreditCard::ExpirationMonthAsString() const { +base::string16 CreditCard::ExpirationMonthAsString() const { if (expiration_month_ == 0) - return string16(); + return base::string16(); - string16 month = base::IntToString16(expiration_month_); + base::string16 month = base::IntToString16(expiration_month_); if (expiration_month_ >= 10) return month; - string16 zero = ASCIIToUTF16("0"); + base::string16 zero = ASCIIToUTF16("0"); zero.append(month); return zero; } -string16 CreditCard::Expiration4DigitYearAsString() const { +base::string16 CreditCard::Expiration4DigitYearAsString() const { if (expiration_year_ == 0) - return string16(); + return base::string16(); return base::IntToString16(Expiration4DigitYear()); } -string16 CreditCard::Expiration2DigitYearAsString() const { +base::string16 CreditCard::Expiration2DigitYearAsString() const { if (expiration_year_ == 0) - return string16(); + return base::string16(); return base::IntToString16(Expiration2DigitYear()); } -void CreditCard::SetExpirationMonthFromString(const string16& text, +void CreditCard::SetExpirationMonthFromString(const base::string16& text, const std::string& app_locale) { int month; if (!ConvertMonth(text, app_locale, &month)) @@ -621,7 +622,7 @@ void CreditCard::SetExpirationMonthFromString(const string16& text, SetExpirationMonth(month); } -void CreditCard::SetExpirationYearFromString(const string16& text) { +void CreditCard::SetExpirationYearFromString(const base::string16& text) { int year; if (!ConvertYear(text, &year)) return; @@ -629,7 +630,7 @@ void CreditCard::SetExpirationYearFromString(const string16& text) { SetExpirationYear(year); } -void CreditCard::SetNumber(const string16& number) { +void CreditCard::SetNumber(const base::string16& number) { number_ = number; type_ = GetCreditCardType(StripSeparators(number_)); } diff --git a/components/autofill/browser/credit_card.h b/components/autofill/browser/credit_card.h index 18ad97c..8c17af7 100644 --- a/components/autofill/browser/credit_card.h +++ b/components/autofill/browser/credit_card.h @@ -26,23 +26,23 @@ class CreditCard : public FormGroup { virtual ~CreditCard(); // Returns a version of |number| that has any separator characters removed. - static const string16 StripSeparators(const string16& number); + static const base::string16 StripSeparators(const base::string16& number); // The user-visible type of the card, e.g. 'Mastercard'. - static string16 TypeForDisplay(const std::string& type); + static base::string16 TypeForDisplay(const std::string& type); // FormGroup implementation: virtual std::string GetGUID() const OVERRIDE; - virtual void GetMatchingTypes(const string16& text, + virtual void GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const OVERRIDE; - virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; + virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; virtual void SetRawInfo(AutofillFieldType type, - const string16& value) OVERRIDE; - virtual string16 GetInfo(AutofillFieldType type, - const std::string& app_locale) const OVERRIDE; + const base::string16& value) OVERRIDE; + virtual base::string16 GetInfo(AutofillFieldType type, + const std::string& app_locale) const OVERRIDE; virtual bool SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) OVERRIDE; virtual void FillFormField(const AutofillField& field, size_t variant, @@ -50,19 +50,19 @@ class CreditCard : public FormGroup { FormFieldData* field_data) const OVERRIDE; // Credit card preview summary, for example: ******1234, Exp: 01/2020 - const string16 Label() const; + const base::string16 Label() const; // Special method to set value for HTML5 month input type. - void SetInfoForMonthInputType(const string16& value); + void SetInfoForMonthInputType(const base::string16& value); // The number altered for display, for example: ******1234 - string16 ObfuscatedNumber() const; + base::string16 ObfuscatedNumber() const; // The last four digits of the credit card number. - string16 LastFourDigits() const; + base::string16 LastFourDigits() const; // The user-visible type of the card, e.g. 'Mastercard'. - string16 TypeForDisplay() const; + base::string16 TypeForDisplay() const; // A label for this credit card formatted as 'Cardname - 2345'. - string16 TypeAndLastFourDigits() const; + base::string16 TypeAndLastFourDigits() const; // The ResourceBundle ID for the appropriate credit card image. int IconResourceId() const; @@ -104,7 +104,7 @@ class CreditCard : public FormGroup { bool IsComplete() const; // Returns the credit card number. - const string16& number() const { return number_; } + const base::string16& number() const { return number_; } private: // FormGroup: @@ -113,27 +113,27 @@ class CreditCard : public FormGroup { // The month and year are zero if not present. int Expiration4DigitYear() const { return expiration_year_; } int Expiration2DigitYear() const { return expiration_year_ % 100; } - string16 ExpirationMonthAsString() const; - string16 Expiration4DigitYearAsString() const; - string16 Expiration2DigitYearAsString() const; + base::string16 ExpirationMonthAsString() const; + base::string16 Expiration4DigitYearAsString() const; + base::string16 Expiration2DigitYearAsString() const; // Sets |expiration_month_| to the integer conversion of |text|. - void SetExpirationMonthFromString(const string16& text, + void SetExpirationMonthFromString(const base::string16& text, const std::string& app_locale); // Sets |expiration_year_| to the integer conversion of |text|. - void SetExpirationYearFromString(const string16& text); + void SetExpirationYearFromString(const base::string16& text); // Sets |number_| to |number| and computes the appropriate card |type_|. - void SetNumber(const string16& number); + void SetNumber(const base::string16& number); // These setters verify that the month and year are within appropriate // ranges. void SetExpirationMonth(int expiration_month); void SetExpirationYear(int expiration_year); - string16 number_; // The credit card number. - string16 name_on_card_; // The cardholder's name. + base::string16 number_; // The credit card number. + base::string16 name_on_card_; // The cardholder's name. std::string type_; // The type of the card. // These members are zero if not present. diff --git a/components/autofill/browser/credit_card_field.cc b/components/autofill/browser/credit_card_field.cc index 8baa9f1..9d68d98 100644 --- a/components/autofill/browser/credit_card_field.cc +++ b/components/autofill/browser/credit_card_field.cc @@ -40,7 +40,7 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner) { // credit card field and haven't yet parsed the expiration date (which // usually appears at the end). if (credit_card_field->cardholder_ == NULL) { - string16 name_pattern; + base::string16 name_pattern; if (fields == 0 || credit_card_field->expiration_month_) { // at beginning or end name_pattern = UTF8ToUTF16(autofill::kNameOnCardRe); @@ -67,7 +67,7 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner) { } // Check for a credit card type (Visa, MasterCard, etc.) field. - string16 type_pattern = UTF8ToUTF16(autofill::kCardTypeRe); + base::string16 type_pattern = UTF8ToUTF16(autofill::kCardTypeRe); if (!credit_card_field->type_ && ParseFieldSpecifics(scanner, type_pattern, MATCH_DEFAULT | MATCH_SELECT, @@ -80,7 +80,7 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner) { // has a plethora of names; we've seen "verification #", // "verification number", "card identification number" and others listed // in the |pattern| below. - string16 pattern = UTF8ToUTF16(autofill::kCardCvcRe); + base::string16 pattern = UTF8ToUTF16(autofill::kCardCvcRe); if (!credit_card_field->verification_ && ParseField(scanner, pattern, &credit_card_field->verification_)) { continue; diff --git a/components/autofill/browser/credit_card_unittest.cc b/components/autofill/browser/credit_card_unittest.cc index fb98e2b..636b013 100644 --- a/components/autofill/browser/credit_card_unittest.cc +++ b/components/autofill/browser/credit_card_unittest.cc @@ -46,54 +46,54 @@ const char* const kInvalidNumbers[] = { TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { // Case 0: empty credit card. CreditCard credit_card0; - string16 summary0 = credit_card0.Label(); - EXPECT_EQ(string16(), summary0); - string16 obfuscated0 = credit_card0.ObfuscatedNumber(); - EXPECT_EQ(string16(), obfuscated0); + base::string16 summary0 = credit_card0.Label(); + EXPECT_EQ(base::string16(), summary0); + base::string16 obfuscated0 = credit_card0.ObfuscatedNumber(); + EXPECT_EQ(base::string16(), obfuscated0); // Case 00: Empty credit card with empty strings. CreditCard credit_card00; autofill_test::SetCreditCardInfo(&credit_card00, "John Dillinger", "", "", ""); - string16 summary00 = credit_card00.Label(); - EXPECT_EQ(string16(ASCIIToUTF16("John Dillinger")), summary00); - string16 obfuscated00 = credit_card00.ObfuscatedNumber(); - EXPECT_EQ(string16(), obfuscated00); + base::string16 summary00 = credit_card00.Label(); + EXPECT_EQ(base::string16(ASCIIToUTF16("John Dillinger")), summary00); + base::string16 obfuscated00 = credit_card00.ObfuscatedNumber(); + EXPECT_EQ(base::string16(), obfuscated00); // Case 1: No credit card number. CreditCard credit_card1; autofill_test::SetCreditCardInfo(&credit_card1, "John Dillinger", "", "01", "2010"); - string16 summary1 = credit_card1.Label(); - EXPECT_EQ(string16(ASCIIToUTF16("John Dillinger")), summary1); - string16 obfuscated1 = credit_card1.ObfuscatedNumber(); - EXPECT_EQ(string16(), obfuscated1); + base::string16 summary1 = credit_card1.Label(); + EXPECT_EQ(base::string16(ASCIIToUTF16("John Dillinger")), summary1); + base::string16 obfuscated1 = credit_card1.ObfuscatedNumber(); + EXPECT_EQ(base::string16(), obfuscated1); // Case 2: No month. CreditCard credit_card2; autofill_test::SetCreditCardInfo(&credit_card2, "John Dillinger", "5105 1051 0510 5100", "", "2010"); - string16 summary2 = credit_card2.Label(); + base::string16 summary2 = credit_card2.Label(); EXPECT_EQ(ASCIIToUTF16("************5100"), summary2); - string16 obfuscated2 = credit_card2.ObfuscatedNumber(); + base::string16 obfuscated2 = credit_card2.ObfuscatedNumber(); EXPECT_EQ(ASCIIToUTF16("************5100"), obfuscated2); // Case 3: No year. CreditCard credit_card3; autofill_test::SetCreditCardInfo(&credit_card3, "John Dillinger", "5105 1051 0510 5100", "01", ""); - string16 summary3 = credit_card3.Label(); + base::string16 summary3 = credit_card3.Label(); EXPECT_EQ(ASCIIToUTF16("************5100"), summary3); - string16 obfuscated3 = credit_card3.ObfuscatedNumber(); + base::string16 obfuscated3 = credit_card3.ObfuscatedNumber(); EXPECT_EQ(ASCIIToUTF16("************5100"), obfuscated3); // Case 4: Have everything. CreditCard credit_card4; autofill_test::SetCreditCardInfo(&credit_card4, "John Dillinger", "5105 1051 0510 5100", "01", "2010"); - string16 summary4 = credit_card4.Label(); + base::string16 summary4 = credit_card4.Label(); EXPECT_EQ(ASCIIToUTF16("************5100, Exp: 01/2010"), summary4); - string16 obfuscated4 = credit_card4.ObfuscatedNumber(); + base::string16 obfuscated4 = credit_card4.ObfuscatedNumber(); EXPECT_EQ(ASCIIToUTF16("************5100"), obfuscated4); // Case 5: Very long credit card @@ -101,9 +101,9 @@ TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { autofill_test::SetCreditCardInfo(&credit_card5, "John Dillinger", "0123456789 0123456789 0123456789 5105 1051 0510 5100", "01", "2010"); - string16 summary5 = credit_card5.Label(); + base::string16 summary5 = credit_card5.Label(); EXPECT_EQ(ASCIIToUTF16("********************5100, Exp: 01/2010"), summary5); - string16 obfuscated5 = credit_card5.ObfuscatedNumber(); + base::string16 obfuscated5 = credit_card5.ObfuscatedNumber(); EXPECT_EQ(ASCIIToUTF16("********************5100"), obfuscated5); } @@ -191,7 +191,7 @@ TEST(CreditCardTest, CreditCardType) { // The card type cannot be set directly. card.SetRawInfo(CREDIT_CARD_TYPE, ASCIIToUTF16("Visa")); - EXPECT_EQ(string16(), card.GetRawInfo(CREDIT_CARD_TYPE)); + EXPECT_EQ(base::string16(), card.GetRawInfo(CREDIT_CARD_TYPE)); // Setting the number should implicitly set the type. card.SetRawInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("4111 1111 1111 1111")); @@ -203,7 +203,7 @@ TEST(CreditCardTest, CreditCardVerificationCode) { // The verification code cannot be set, as Chrome does not store this data. card.SetRawInfo(CREDIT_CARD_VERIFICATION_CODE, ASCIIToUTF16("999")); - EXPECT_EQ(string16(), card.GetRawInfo(CREDIT_CARD_VERIFICATION_CODE)); + EXPECT_EQ(base::string16(), card.GetRawInfo(CREDIT_CARD_VERIFICATION_CODE)); } @@ -211,7 +211,7 @@ TEST(CreditCardTest, CreditCardMonthExact) { const char* const kMonthsNumeric[] = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", }; - std::vector<string16> options(arraysize(kMonthsNumeric)); + std::vector<base::string16> options(arraysize(kMonthsNumeric)); for (size_t i = 0; i < arraysize(kMonthsNumeric); ++i) { options[i] = ASCIIToUTF16(kMonthsNumeric[i]); } @@ -232,7 +232,7 @@ TEST(CreditCardTest, CreditCardMonthAbbreviated) { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; - std::vector<string16> options(arraysize(kMonthsAbbreviated)); + std::vector<base::string16> options(arraysize(kMonthsAbbreviated)); for (size_t i = 0; i < arraysize(kMonthsAbbreviated); ++i) { options[i] = ASCIIToUTF16(kMonthsAbbreviated[i]); } @@ -253,7 +253,7 @@ TEST(CreditCardTest, CreditCardMonthFull) { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }; - std::vector<string16> options(arraysize(kMonthsFull)); + std::vector<base::string16> options(arraysize(kMonthsFull)); for (size_t i = 0; i < arraysize(kMonthsFull); ++i) { options[i] = ASCIIToUTF16(kMonthsFull[i]); } @@ -273,7 +273,7 @@ TEST(CreditCardTest, CreditCardMonthNumeric) { const char* const kMonthsNumeric[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", }; - std::vector<string16> options(arraysize(kMonthsNumeric)); + std::vector<base::string16> options(arraysize(kMonthsNumeric)); for (size_t i = 0; i < arraysize(kMonthsNumeric); ++i) { options[i] = ASCIIToUTF16(kMonthsNumeric[i]); } @@ -293,7 +293,7 @@ TEST(CreditCardTest, CreditCardTwoDigitYear) { const char* const kYears[] = { "12", "13", "14", "15", "16", "17", "18", "19" }; - std::vector<string16> options(arraysize(kYears)); + std::vector<base::string16> options(arraysize(kYears)); for (size_t i = 0; i < arraysize(kYears); ++i) { options[i] = ASCIIToUTF16(kYears[i]); } @@ -314,7 +314,7 @@ TEST(CreditCardTest, CreditCardTypeSelectControl) { const char* const kCreditCardTypes[] = { "Visa", "Master Card", "AmEx", "discover" }; - std::vector<string16> options(arraysize(kCreditCardTypes)); + std::vector<base::string16> options(arraysize(kCreditCardTypes)); for (size_t i = 0; i < arraysize(kCreditCardTypes); ++i) { options[i] = ASCIIToUTF16(kCreditCardTypes[i]); } diff --git a/components/autofill/browser/form_field.cc b/components/autofill/browser/form_field.cc index 2c1c5da..348b060 100644 --- a/components/autofill/browser/form_field.cc +++ b/components/autofill/browser/form_field.cc @@ -82,14 +82,14 @@ void FormField::ParseFormFields(const std::vector<AutofillField*>& fields, // static bool FormField::ParseField(AutofillScanner* scanner, - const string16& pattern, + const base::string16& pattern, const AutofillField** match) { return ParseFieldSpecifics(scanner, pattern, MATCH_DEFAULT, match); } // static bool FormField::ParseFieldSpecifics(AutofillScanner* scanner, - const string16& pattern, + const base::string16& pattern, int match_type, const AutofillField** match) { if (scanner->IsEnd()) @@ -136,7 +136,7 @@ bool FormField::AddClassification(const AutofillField* field, // static. bool FormField::MatchAndAdvance(AutofillScanner* scanner, - const string16& pattern, + const base::string16& pattern, int match_type, const AutofillField** match) { const AutofillField* field = scanner->Cursor(); @@ -152,7 +152,7 @@ bool FormField::MatchAndAdvance(AutofillScanner* scanner, // static bool FormField::Match(const AutofillField* field, - const string16& pattern, + const base::string16& pattern, int match_type) { if ((match_type & FormField::MATCH_LABEL) && autofill::MatchesPattern(field->label, pattern)) { diff --git a/components/autofill/browser/form_field.h b/components/autofill/browser/form_field.h index 8b9765d..1c24904 100644 --- a/components/autofill/browser/form_field.h +++ b/components/autofill/browser/form_field.h @@ -54,7 +54,7 @@ class FormField { // Attempts to parse a form field with the given pattern. Returns true on // success and fills |match| with a pointer to the field. static bool ParseField(AutofillScanner* scanner, - const string16& pattern, + const base::string16& pattern, const AutofillField** match); // Parses the stream of fields in |scanner| with regular expression |pattern| @@ -63,7 +63,7 @@ class FormField { // A |true| result is returned in the case of a successful match, false // otherwise. static bool ParseFieldSpecifics(AutofillScanner* scanner, - const string16& pattern, + const base::string16& pattern, int match_type, const AutofillField** match); @@ -95,14 +95,14 @@ class FormField { // Returns |true| if a match is found according to |match_type|, and |false| // otherwise. static bool MatchAndAdvance(AutofillScanner* scanner, - const string16& pattern, + const base::string16& pattern, int match_type, const AutofillField** match); // Matches the regular expression |pattern| against the components of |field| // as specified in the |match_type| bit field (see |MatchType|). static bool Match(const AutofillField* field, - const string16& pattern, + const base::string16& pattern, int match_type); // Perform a "pass" over the |fields| where each pass uses the supplied diff --git a/components/autofill/browser/form_field_unittest.cc b/components/autofill/browser/form_field_unittest.cc index b8994bc..f6b979e 100644 --- a/components/autofill/browser/form_field_unittest.cc +++ b/components/autofill/browser/form_field_unittest.cc @@ -13,14 +13,16 @@ TEST(FormFieldTest, Match) { AutofillField field; // Empty strings match. - EXPECT_TRUE(FormField::Match(&field, string16(), FormField::MATCH_LABEL)); + EXPECT_TRUE(FormField::Match(&field, base::string16(), + FormField::MATCH_LABEL)); // Empty pattern matches non-empty string. field.label = ASCIIToUTF16("a"); - EXPECT_TRUE(FormField::Match(&field, string16(), FormField::MATCH_LABEL)); + EXPECT_TRUE(FormField::Match(&field, base::string16(), + FormField::MATCH_LABEL)); // Strictly empty pattern matches empty string. - field.label = string16(); + field.label = base::string16(); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("^$"), FormField::MATCH_LABEL)); @@ -30,7 +32,7 @@ TEST(FormFieldTest, Match) { FormField::MATCH_LABEL)); // Non-empty pattern doesn't match empty string. - field.label = string16(); + field.label = base::string16(); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("a"), FormField::MATCH_LABEL)); diff --git a/components/autofill/browser/form_group.cc b/components/autofill/browser/form_group.cc index aca01b4..4ed49c7 100644 --- a/components/autofill/browser/form_group.cc +++ b/components/autofill/browser/form_group.cc @@ -27,8 +27,8 @@ class State { static const State all_states[]; - static string16 Abbreviation(const string16& name); - static string16 FullName(const string16& abbreviation); + static base::string16 Abbreviation(const base::string16& name); + static base::string16 FullName(const base::string16& abbreviation); }; const State State::all_states[] = { @@ -87,20 +87,20 @@ const State State::all_states[] = { { NULL, NULL } }; -string16 State::Abbreviation(const string16& name) { +base::string16 State::Abbreviation(const base::string16& name) { for (const State* state = all_states; state->name; ++state) { if (LowerCaseEqualsASCII(name, state->name)) return ASCIIToUTF16(state->abbreviation); } - return string16(); + return base::string16(); } -string16 State::FullName(const string16& abbreviation) { +base::string16 State::FullName(const base::string16& abbreviation) { for (const State* state = all_states; state->name; ++state) { if (LowerCaseEqualsASCII(abbreviation, state->abbreviation)) return ASCIIToUTF16(state->name); } - return string16(); + return base::string16(); } const char* const kMonthsAbbreviated[] = { @@ -122,9 +122,9 @@ const char* const kMonthsNumeric[] = { // Returns true if the value was successfully set, meaning |value| was found in // the list of select options in |field|. -bool SetSelectControlValue(const string16& value, +bool SetSelectControlValue(const base::string16& value, FormFieldData* field) { - string16 value_lowercase = StringToLowerASCII(value); + base::string16 value_lowercase = StringToLowerASCII(value); DCHECK_EQ(field->option_values.size(), field->option_contents.size()); for (size_t i = 0; i < field->option_values.size(); ++i) { @@ -138,9 +138,9 @@ bool SetSelectControlValue(const string16& value, return false; } -bool FillStateSelectControl(const string16& value, +bool FillStateSelectControl(const base::string16& value, FormFieldData* field) { - string16 abbrev, full; + base::string16 abbrev, full; if (value.size() < 4U) { abbrev = value; full = State::FullName(value); @@ -159,7 +159,7 @@ bool FillStateSelectControl(const string16& value, return SetSelectControlValue(full, field); } -bool FillExpirationMonthSelectControl(const string16& value, +bool FillExpirationMonthSelectControl(const base::string16& value, FormFieldData* field) { int index = 0; if (!base::StringToInt(value, &index) || @@ -176,17 +176,17 @@ bool FillExpirationMonthSelectControl(const string16& value, // Try to fill a credit card type |value| (Visa, MasterCard, etc.) into the // given |field|. -bool FillCreditCardTypeSelectControl(const string16& value, +bool FillCreditCardTypeSelectControl(const base::string16& value, FormFieldData* field) { // Try stripping off spaces. - string16 value_stripped; + base::string16 value_stripped; RemoveChars(StringToLowerASCII(value), kWhitespaceUTF16, &value_stripped); for (size_t i = 0; i < field->option_values.size(); ++i) { - string16 option_value_lowercase; + base::string16 option_value_lowercase; RemoveChars(StringToLowerASCII(field->option_values[i]), kWhitespaceUTF16, &option_value_lowercase); - string16 option_contents_lowercase; + base::string16 option_contents_lowercase; RemoveChars(StringToLowerASCII(field->option_contents[i]), kWhitespaceUTF16, &option_contents_lowercase); @@ -213,7 +213,7 @@ std::string FormGroup::GetGUID() const { return std::string(); } -void FormGroup::GetMatchingTypes(const string16& text, +void FormGroup::GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const { if (text.empty()) { @@ -244,13 +244,13 @@ void FormGroup::GetNonEmptyTypes(const std::string& app_locale, } } -string16 FormGroup::GetInfo(AutofillFieldType type, +base::string16 FormGroup::GetInfo(AutofillFieldType type, const std::string& app_locale) const { return GetRawInfo(type); } bool FormGroup::SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) { SetRawInfo(type, value); return true; @@ -270,12 +270,12 @@ void FormGroup::FillSelectControl(AutofillFieldType type, DCHECK_EQ("select-one", field->form_control_type); DCHECK_EQ(field->option_values.size(), field->option_contents.size()); - string16 field_text = GetInfo(type, app_locale); - string16 field_text_lower = StringToLowerASCII(field_text); + base::string16 field_text = GetInfo(type, app_locale); + base::string16 field_text_lower = StringToLowerASCII(field_text); if (field_text.empty()) return; - string16 value; + base::string16 value; for (size_t i = 0; i < field->option_values.size(); ++i) { if (field_text == field->option_values[i] || field_text == field->option_contents[i]) { @@ -319,6 +319,6 @@ bool FormGroup::FillCountrySelectControl(const std::string& app_locale, } // static -bool FormGroup::IsValidState(const string16& value) { +bool FormGroup::IsValidState(const base::string16& value) { return !State::Abbreviation(value).empty() || !State::FullName(value).empty(); } diff --git a/components/autofill/browser/form_group.h b/components/autofill/browser/form_group.h index c0038b5..4adda2f 100644 --- a/components/autofill/browser/form_group.h +++ b/components/autofill/browser/form_group.h @@ -30,7 +30,7 @@ class FormGroup { // into the field, interpreted in the given |app_locale| if appropriate. The // field types can then be reported back to the server. This method is // additive on |matching_types|. - virtual void GetMatchingTypes(const string16& text, + virtual void GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const; @@ -41,22 +41,23 @@ class FormGroup { // Returns the string associated with |type|, without canonicalizing the // returned value. For user-visible strings, use GetInfo() instead. - virtual string16 GetRawInfo(AutofillFieldType type) const = 0; + virtual base::string16 GetRawInfo(AutofillFieldType type) const = 0; // Sets this FormGroup object's data for |type| to |value|, without // canonicalizing the |value|. For data that has not already been // canonicalized, use SetInfo() instead. - virtual void SetRawInfo(AutofillFieldType type, const string16& value) = 0; + virtual void SetRawInfo(AutofillFieldType type, + const base::string16& value) = 0; // Returns the string that should be auto-filled into a text field given the // type of that field, localized to the given |app_locale| if appropriate. - virtual string16 GetInfo(AutofillFieldType type, - const std::string& app_locale) const; + virtual base::string16 GetInfo(AutofillFieldType type, + const std::string& app_locale) const; // Used to populate this FormGroup object with data. Canonicalizes the data // according to the specified |app_locale| prior to storing, if appropriate. virtual bool SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale); // Set |field_data|'s value based on |field| and contents of |this| (using @@ -75,7 +76,7 @@ class FormGroup { // Returns true if |value| is a valid US state name or abbreviation. It is // case insensitive. Valid for US states only. // TODO(estade): this is a crappy place for this function. - static bool IsValidState(const string16& value); + static bool IsValidState(const base::string16& value); protected: // AutofillProfile needs to call into GetSupportedTypes() for objects of diff --git a/components/autofill/browser/form_structure.cc b/components/autofill/browser/form_structure.cc index d7927a2..46f36d3 100644 --- a/components/autofill/browser/form_structure.cc +++ b/components/autofill/browser/form_structure.cc @@ -299,7 +299,7 @@ FormStructure::FormStructure(const FormData& form, autocheckout_url_prefix_(autocheckout_url_prefix), filled_by_autocheckout_(false) { // Copy the form fields. - std::map<string16, size_t> unique_names; + std::map<base::string16, size_t> unique_names; for (std::vector<FormFieldData>::const_iterator field = form.fields.begin(); field != form.fields.end(); field++) { @@ -324,7 +324,7 @@ FormStructure::FormStructure(const FormData& form, unique_names[field->name] = 1; else ++unique_names[field->name]; - string16 unique_name = field->name + ASCIIToUTF16("_") + + base::string16 unique_name = field->name + ASCIIToUTF16("_") + base::IntToString16(unique_names[field->name]); fields_.push_back(new AutofillField(*field, unique_name)); } @@ -736,7 +736,7 @@ void FormStructure::UpdateFromCache(const FormStructure& cached_form) { field->value == cached_field->second->value) { // From the perspective of learning user data, text fields containing // default values are equivalent to empty fields. - field->value = string16(); + field->value = base::string16(); } field->set_heuristic_type(cached_field->second->heuristic_type()); @@ -1163,7 +1163,7 @@ void FormStructure::IdentifySections(bool has_author_specified_sections) { if (!has_author_specified_sections) { // Name sections after the first field in the section. - string16 current_section = fields_.front()->unique_name(); + base::string16 current_section = fields_.front()->unique_name(); // Keep track of the types we've seen in this section. std::set<AutofillFieldType> seen_types; diff --git a/components/autofill/browser/form_structure.h b/components/autofill/browser/form_structure.h index 5512acc..2f50bfc 100644 --- a/components/autofill/browser/form_structure.h +++ b/components/autofill/browser/form_structure.h @@ -207,7 +207,7 @@ class FormStructure { size_t active_field_count() const; // The name of the form. - string16 form_name_; + base::string16 form_name_; // The source URL. GURL source_url_; diff --git a/components/autofill/browser/form_structure_unittest.cc b/components/autofill/browser/form_structure_unittest.cc index 5f7b998..ad79a14 100644 --- a/components/autofill/browser/form_structure_unittest.cc +++ b/components/autofill/browser/form_structure_unittest.cc @@ -77,7 +77,7 @@ TEST(FormStructureTest, FieldCount) { field.form_control_type = "password"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -119,7 +119,7 @@ TEST(FormStructureTest, AutofillCount) { field.form_control_type = "select-one"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -183,7 +183,7 @@ TEST(FormStructureTest, IsAutofillable) { field.form_control_type = "password"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -376,7 +376,7 @@ TEST(FormStructureTest, HeuristicsContactInfo) { field.name = ASCIIToUTF16("zipcode"); form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -417,17 +417,17 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttribute) { FormFieldData field; field.form_control_type = "text"; - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("field1"); field.autocomplete_attribute = "given-name"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("field2"); field.autocomplete_attribute = "family-name"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("field3"); field.autocomplete_attribute = "email"; form.fields.push_back(field); @@ -455,17 +455,17 @@ TEST(FormStructureTest, HeuristicsAutocompleteAttributePhoneTypes) { FormFieldData field; field.form_control_type = "text"; - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("field1"); field.autocomplete_attribute = "tel-local"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("field2"); field.autocomplete_attribute = "tel-local-prefix"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("field3"); field.autocomplete_attribute = "tel-local-suffix"; form.fields.push_back(field); @@ -702,10 +702,10 @@ TEST(FormStructureTest, HeuristicsDontOverrideAutocompleteAttributeSections) { field.name = ASCIIToUTF16("one"); field.autocomplete_attribute = "street-address"; form.fields.push_back(field); - field.name = string16(); + field.name = base::string16(); field.autocomplete_attribute = "section-foo email"; form.fields.push_back(field); - field.name = string16(); + field.name = base::string16(); field.autocomplete_attribute = "name"; form.fields.push_back(field); field.name = ASCIIToUTF16("two"); @@ -772,7 +772,7 @@ TEST(FormStructureTest, HeuristicsSample8) { field.name = ASCIIToUTF16("BillTo.Phone"); form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -839,7 +839,7 @@ TEST(FormStructureTest, HeuristicsSample6) { field.name = ASCIIToUTF16("Home.PostalCode"); form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.value = ASCIIToUTF16("continue"); field.form_control_type = "submit"; @@ -879,34 +879,34 @@ TEST(FormStructureTest, HeuristicsLabelsOnly) { field.form_control_type = "text"; field.label = ASCIIToUTF16("First Name"); - field.name = string16(); + field.name = base::string16(); form.fields.push_back(field); field.label = ASCIIToUTF16("Last Name"); - field.name = string16(); + field.name = base::string16(); form.fields.push_back(field); field.label = ASCIIToUTF16("Email"); - field.name = string16(); + field.name = base::string16(); form.fields.push_back(field); field.label = ASCIIToUTF16("Phone"); - field.name = string16(); + field.name = base::string16(); form.fields.push_back(field); field.label = ASCIIToUTF16("Address"); - field.name = string16(); + field.name = base::string16(); form.fields.push_back(field); field.label = ASCIIToUTF16("Address"); - field.name = string16(); + field.name = base::string16(); form.fields.push_back(field); field.label = ASCIIToUTF16("Zip code"); - field.name = string16(); + field.name = base::string16(); form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -964,7 +964,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfo) { field.name = ASCIIToUTF16("verification"); form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -1025,7 +1025,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfoWithUnknownCardField) { field.name = ASCIIToUTF16("verification"); form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); @@ -1448,7 +1448,7 @@ TEST(FormStructureTest, CVCCodeClash) { field.name = ASCIIToUTF16("ccexpiresmonth"); form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("ccexpiresyear"); form.fields.push_back(field); @@ -2208,7 +2208,7 @@ TEST(FormStructureTest, ToFormData) { field.form_control_type = "password"; form.fields.push_back(field); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("Submit"); field.form_control_type = "submit"; form.fields.push_back(field); diff --git a/components/autofill/browser/name_field_unittest.cc b/components/autofill/browser/name_field_unittest.cc index 2689191..d0bcf87 100644 --- a/components/autofill/browser/name_field_unittest.cc +++ b/components/autofill/browser/name_field_unittest.cc @@ -64,15 +64,15 @@ TEST_F(NameFieldTest, FirstMiddleLast2) { FormFieldData field; field.form_control_type = "text"; - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("firstName"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name1"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("middleName"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name2"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("lastName"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name3"))); @@ -95,11 +95,11 @@ TEST_F(NameFieldTest, FirstLast) { FormFieldData field; field.form_control_type = "text"; - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("first_name"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name1"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("last_name"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name2"))); @@ -178,7 +178,7 @@ TEST_F(NameFieldTest, FirstLastEmpty) { field.name = ASCIIToUTF16("first_name"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name1"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("last_name"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name2"))); @@ -202,11 +202,11 @@ TEST_F(NameFieldTest, FirstMiddleLastEmpty) { field.name = ASCIIToUTF16("first_name"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name1"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("middle_name"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name2"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("last_name"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name3"))); @@ -279,15 +279,15 @@ TEST_F(NameFieldTest, MiddleInitialAtEnd) { FormFieldData field; field.form_control_type = "text"; - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("XXXnameXXXfirst"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name1"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("XXXnameXXXmi"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name2"))); - field.label = string16(); + field.label = base::string16(); field.name = ASCIIToUTF16("XXXnameXXXlast"); list_.push_back(new AutofillField(field, ASCIIToUTF16("name3"))); diff --git a/components/autofill/browser/password_autofill_manager.cc b/components/autofill/browser/password_autofill_manager.cc index 6a641f6..a17168f 100644 --- a/components/autofill/browser/password_autofill_manager.cc +++ b/components/autofill/browser/password_autofill_manager.cc @@ -20,7 +20,7 @@ PasswordAutofillManager::~PasswordAutofillManager() { bool PasswordAutofillManager::DidAcceptAutofillSuggestion( const FormFieldData& field, - const string16& value) { + const base::string16& value) { PasswordFormFillData password; if (!FindLoginInfo(field, &password)) return false; @@ -53,7 +53,7 @@ void PasswordAutofillManager::Reset() { // PasswordAutofillManager, private: bool PasswordAutofillManager::WillFillUserNameAndPassword( - const string16& current_username, + const base::string16& current_username, const PasswordFormFillData& fill_data) { // Look for any suitable matches to current field text. if (fill_data.basic_data.fields[0].value == current_username) { diff --git a/components/autofill/browser/password_autofill_manager.h b/components/autofill/browser/password_autofill_manager.h index 3d16054..e1d7b5a 100644 --- a/components/autofill/browser/password_autofill_manager.h +++ b/components/autofill/browser/password_autofill_manager.h @@ -29,7 +29,7 @@ class PasswordAutofillManager { // Fills the password associated with user name |value|. Returns true if the // username and password fields were filled, false otherwise. bool DidAcceptAutofillSuggestion(const FormFieldData& field, - const string16& value); + const base::string16& value); // Invoked when a password mapping is added. void AddPasswordFormMapping( @@ -50,7 +50,7 @@ class PasswordAutofillManager { // Returns true if |current_username| matches a username for one of the // login mappings in |password|. bool WillFillUserNameAndPassword( - const string16& current_username, + const base::string16& current_username, const PasswordFormFillData& password); // Finds login information for a |node| that was previously filled. diff --git a/components/autofill/browser/password_autofill_manager_unittest.cc b/components/autofill/browser/password_autofill_manager_unittest.cc index bcdd6f0..919dc32 100644 --- a/components/autofill/browser/password_autofill_manager_unittest.cc +++ b/components/autofill/browser/password_autofill_manager_unittest.cc @@ -27,8 +27,8 @@ class PasswordAutofillManagerTest : public testing::Test { virtual void SetUp() OVERRIDE { // Add a preferred login and an additional login to the FillData. - string16 username1 = ASCIIToUTF16(kAliceUsername); - string16 password1 = ASCIIToUTF16(kAlicePassword); + base::string16 username1 = ASCIIToUTF16(kAliceUsername); + base::string16 password1 = ASCIIToUTF16(kAlicePassword); username_field_.name = ASCIIToUTF16(kUsernameName); username_field_.value = username1; diff --git a/components/autofill/browser/personal_data_manager.cc b/components/autofill/browser/personal_data_manager.cc index 9ce89c6..df8571d 100644 --- a/components/autofill/browser/personal_data_manager.cc +++ b/components/autofill/browser/personal_data_manager.cc @@ -32,7 +32,7 @@ using content::BrowserContext; namespace { -const string16::value_type kCreditCardPrefix[] = {'*', 0}; +const base::string16::value_type kCreditCardPrefix[] = {'*', 0}; template<typename T> class FormGroupMatchesByGUIDFunctor { @@ -110,7 +110,7 @@ bool IsMinimumAddress(const AutofillProfile& profile, // of importing a form. bool IsValidFieldTypeAndValue(const std::set<AutofillFieldType>& types_seen, AutofillFieldType field_type, - const string16& value) { + const base::string16& value) { // Abandon the import if two fields of the same type are encountered. // This indicates ambiguous data or miscategorization of types. // Make an exception for PHONE_HOME_NUMBER however as both prefix and @@ -241,7 +241,7 @@ bool PersonalDataManager::ImportFormData( for (size_t i = 0; i < form.field_count(); ++i) { const AutofillField* field = form.field(i); - string16 value = CollapseWhitespace(field->value, false); + base::string16 value = CollapseWhitespace(field->value, false); // If we don't know the type of the field, or the user hasn't entered any // information into the field, then skip it. @@ -300,7 +300,7 @@ bool PersonalDataManager::ImportFormData( // Construct the phone number. Reject the profile if the number is invalid. if (imported_profile.get() && !home.IsEmpty()) { - string16 constructed_number; + base::string16 constructed_number; if (!home.ParseNumber(*imported_profile, app_locale_, &constructed_number) || !imported_profile->SetInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number, @@ -549,12 +549,12 @@ void PersonalDataManager::Refresh() { void PersonalDataManager::GetProfileSuggestions( AutofillFieldType type, - const string16& field_contents, + const base::string16& field_contents, bool field_is_autofilled, std::vector<AutofillFieldType> other_field_types, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<GUIDPair>* guid_pairs) { values->clear(); labels->clear(); @@ -568,7 +568,7 @@ void PersonalDataManager::GetProfileSuggestions( AutofillProfile* profile = *iter; // The value of the stored data for this field type in the |profile|. - std::vector<string16> multi_values; + std::vector<base::string16> multi_values; profile->GetMultiInfo(type, app_locale_, &multi_values); for (size_t i = 0; i < multi_values.size(); ++i) { @@ -584,15 +584,16 @@ void PersonalDataManager::GetProfileSuggestions( if (multi_values[i].empty()) continue; - string16 profile_value_lower_case( + base::string16 profile_value_lower_case( StringToLowerASCII(multi_values[i])); - string16 field_value_lower_case(StringToLowerASCII(field_contents)); + base::string16 field_value_lower_case( + StringToLowerASCII(field_contents)); // Phone numbers could be split in US forms, so field value could be // either prefix or suffix of the phone. bool matched_phones = false; if (type == PHONE_HOME_NUMBER && !field_value_lower_case.empty() && (profile_value_lower_case.find(field_value_lower_case) != - string16::npos)) { + base::string16::npos)) { matched_phones = true; } @@ -629,10 +630,10 @@ void PersonalDataManager::GetProfileSuggestions( void PersonalDataManager::GetCreditCardSuggestions( AutofillFieldType type, - const string16& field_contents, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + const base::string16& field_contents, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<GUIDPair>* guid_pairs) { values->clear(); labels->clear(); @@ -644,13 +645,14 @@ void PersonalDataManager::GetCreditCardSuggestions( CreditCard* credit_card = *iter; // The value of the stored data for this field type in the |credit_card|. - string16 creditcard_field_value = credit_card->GetInfo(type, app_locale_); + base::string16 creditcard_field_value = + credit_card->GetInfo(type, app_locale_); if (!creditcard_field_value.empty() && StartsWith(creditcard_field_value, field_contents, false)) { if (type == CREDIT_CARD_NUMBER) creditcard_field_value = credit_card->ObfuscatedNumber(); - string16 label; + base::string16 label; if (credit_card->number().empty()) { // If there is no CC number, return name to show something. label = credit_card->GetInfo(CREDIT_CARD_NAME, app_locale_); @@ -679,19 +681,19 @@ bool PersonalDataManager::IsValidLearnableProfile( if (!IsMinimumAddress(profile, app_locale)) return false; - string16 email = profile.GetRawInfo(EMAIL_ADDRESS); + base::string16 email = profile.GetRawInfo(EMAIL_ADDRESS); if (!email.empty() && !autofill::IsValidEmailAddress(email)) return false; // Reject profiles with invalid US state information. - string16 state = profile.GetRawInfo(ADDRESS_HOME_STATE); + base::string16 state = profile.GetRawInfo(ADDRESS_HOME_STATE); if (profile.GetRawInfo(ADDRESS_HOME_COUNTRY) == ASCIIToUTF16("US") && !state.empty() && !FormGroup::IsValidState(state)) { return false; } // Reject profiles with invalid US zip information. - string16 zip = profile.GetRawInfo(ADDRESS_HOME_ZIP); + base::string16 zip = profile.GetRawInfo(ADDRESS_HOME_ZIP); if (profile.GetRawInfo(ADDRESS_HOME_COUNTRY) == ASCIIToUTF16("US") && !zip.empty() && !autofill::IsValidZip(zip)) return false; diff --git a/components/autofill/browser/personal_data_manager.h b/components/autofill/browser/personal_data_manager.h index 75d1e6b..9b1dc14 100644 --- a/components/autofill/browser/personal_data_manager.h +++ b/components/autofill/browser/personal_data_manager.h @@ -128,12 +128,12 @@ class PersonalDataManager : public WebDataServiceConsumer, // form. Identifying info is loaded into the last four outparams. void GetProfileSuggestions( AutofillFieldType type, - const string16& field_contents, + const base::string16& field_contents, bool field_is_autofilled, std::vector<AutofillFieldType> other_field_types, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<GUIDPair>* guid_pairs); // Gets credit cards that can suggest data for |type|. See @@ -141,10 +141,10 @@ class PersonalDataManager : public WebDataServiceConsumer, // GUID pair should be ignored. void GetCreditCardSuggestions( AutofillFieldType type, - const string16& field_contents, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + const base::string16& field_contents, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<GUIDPair>* guid_pairs); // Re-loads profiles and credit cards from the WebDatabase asynchronously. diff --git a/components/autofill/browser/personal_data_manager_mac.mm b/components/autofill/browser/personal_data_manager_mac.mm index 7534190..4642206 100644 --- a/components/autofill/browser/personal_data_manager_mac.mm +++ b/components/autofill/browser/personal_data_manager_mac.mm @@ -240,17 +240,17 @@ void AuxiliaryProfilesImpl::GetAddressBookPhoneNumbers( NSString* phoneLabelRaw = [phoneNumbers labelAtIndex:reverseK]; if ([addressLabelRaw isEqualToString:kABAddressHomeLabel] && [phoneLabelRaw isEqualToString:kABPhoneHomeLabel]) { - string16 homePhone = base::SysNSStringToUTF16( + base::string16 homePhone = base::SysNSStringToUTF16( [phoneNumbers valueAtIndex:reverseK]); profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, homePhone); } else if ([addressLabelRaw isEqualToString:kABAddressWorkLabel] && [phoneLabelRaw isEqualToString:kABPhoneWorkLabel]) { - string16 workPhone = base::SysNSStringToUTF16( + base::string16 workPhone = base::SysNSStringToUTF16( [phoneNumbers valueAtIndex:reverseK]); profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, workPhone); } else if ([phoneLabelRaw isEqualToString:kABPhoneMobileLabel] || [phoneLabelRaw isEqualToString:kABPhoneMainLabel]) { - string16 phone = base::SysNSStringToUTF16( + base::string16 phone = base::SysNSStringToUTF16( [phoneNumbers valueAtIndex:reverseK]); profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, phone); } diff --git a/components/autofill/browser/personal_data_manager_unittest.cc b/components/autofill/browser/personal_data_manager_unittest.cc index dd62b87..70c8111 100644 --- a/components/autofill/browser/personal_data_manager_unittest.cc +++ b/components/autofill/browser/personal_data_manager_unittest.cc @@ -1022,7 +1022,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoProfilesWithMultiValue) { const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); // Modify expected to include multi-valued fields. - std::vector<string16> values; + std::vector<base::string16> values; expected.GetRawMultiInfo(NAME_FULL, &values); values.push_back(ASCIIToUTF16("John Adams")); expected.SetRawMultiInfo(NAME_FULL, values); @@ -1135,7 +1135,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) { const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); // Add multi-valued phone number to expectation. Also, country gets added. - std::vector<string16> values; + std::vector<base::string16> values; expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); values.push_back(ASCIIToUTF16("(650) 223-1234")); expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); @@ -2122,7 +2122,7 @@ TEST_F(PersonalDataManagerTest, CaseInsensitiveMultiValueAggregation) { const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); // Modify expected to include multi-valued fields. - std::vector<string16> values; + std::vector<base::string16> values; expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); values.push_back(ASCIIToUTF16("(214) 555-1234")); expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); diff --git a/components/autofill/browser/phone_field.cc b/components/autofill/browser/phone_field.cc index e7415ba..e3b5a601 100644 --- a/components/autofill/browser/phone_field.cc +++ b/components/autofill/browser/phone_field.cc @@ -17,8 +17,8 @@ namespace { // This string includes all area code separators, including NoText. -string16 GetAreaRegex() { - string16 area_code = UTF8ToUTF16(autofill::kAreaCodeRe); +base::string16 GetAreaRegex() { + base::string16 area_code = UTF8ToUTF16(autofill::kAreaCodeRe); area_code.append(ASCIIToUTF16("|")); // Regexp separator. area_code.append(UTF8ToUTF16(autofill::kAreaCodeNotextRe)); return area_code; @@ -245,7 +245,7 @@ PhoneField::PhoneField() { } // static -string16 PhoneField::GetRegExp(RegexType regex_id) { +base::string16 PhoneField::GetRegExp(RegexType regex_id) { switch (regex_id) { case REGEX_COUNTRY: return UTF8ToUTF16(autofill::kCountryCodeRe); @@ -269,5 +269,5 @@ string16 PhoneField::GetRegExp(RegexType regex_id) { NOTREACHED(); break; } - return string16(); + return base::string16(); } diff --git a/components/autofill/browser/phone_field.h b/components/autofill/browser/phone_field.h index ee3cb0a..c262b68 100644 --- a/components/autofill/browser/phone_field.h +++ b/components/autofill/browser/phone_field.h @@ -77,7 +77,7 @@ class PhoneField : public FormField { PhoneField(); // Returns the regular expression string correspoding to |regex_id| - static string16 GetRegExp(RegexType regex_id); + static base::string16 GetRegExp(RegexType regex_id); // FIELD_PHONE is always present; holds suffix if prefix is present. // The rest could be NULL. diff --git a/components/autofill/browser/phone_number.cc b/components/autofill/browser/phone_number.cc index 703e63e..4b551de 100644 --- a/components/autofill/browser/phone_number.cc +++ b/components/autofill/browser/phone_number.cc @@ -24,7 +24,7 @@ const size_t kPhoneNumberLength = 7; // The number of digits in an area code. const size_t kPhoneCityCodeLength = 3; -void StripPunctuation(string16* number) { +void StripPunctuation(base::string16* number) { RemoveChars(*number, kPhoneNumberSeparators, number); } @@ -34,7 +34,7 @@ void StripPunctuation(string16* number) { // code corresponding to the |app_locale|. std::string GetRegion(const AutofillProfile& profile, const std::string& app_locale) { - string16 country_code = profile.GetRawInfo(ADDRESS_HOME_COUNTRY); + base::string16 country_code = profile.GetRawInfo(ADDRESS_HOME_COUNTRY); if (!country_code.empty()) return UTF16ToASCII(country_code); @@ -72,17 +72,18 @@ void PhoneNumber::GetSupportedTypes(FieldTypeSet* supported_types) const { supported_types->insert(PHONE_HOME_COUNTRY_CODE); } -string16 PhoneNumber::GetRawInfo(AutofillFieldType type) const { +base::string16 PhoneNumber::GetRawInfo(AutofillFieldType type) const { if (type == PHONE_HOME_WHOLE_NUMBER) return number_; // Only the whole number is available as raw data. All of the other types are // parsed from this raw info, and parsing requires knowledge of the phone // number's region, which is only available via GetInfo(). - return string16(); + return base::string16(); } -void PhoneNumber::SetRawInfo(AutofillFieldType type, const string16& value) { +void PhoneNumber::SetRawInfo(AutofillFieldType type, + const base::string16& value) { if (type != PHONE_HOME_CITY_AND_NUMBER && type != PHONE_HOME_WHOLE_NUMBER) { // Only full phone numbers should be set directly. The remaining field @@ -100,7 +101,7 @@ void PhoneNumber::SetRawInfo(AutofillFieldType type, const string16& value) { // (650)2345678 -> 6502345678 // 1-800-FLOWERS -> 18003569377 // If the phone cannot be normalized, returns the stored value verbatim. -string16 PhoneNumber::GetInfo(AutofillFieldType type, +base::string16 PhoneNumber::GetInfo(AutofillFieldType type, const std::string& app_locale) const { UpdateCacheIfNeeded(app_locale); @@ -108,7 +109,7 @@ string16 PhoneNumber::GetInfo(AutofillFieldType type, // normalization for the number fails. All other field types require // normalization. if (type != PHONE_HOME_WHOLE_NUMBER && !cached_parsed_phone_.IsValidNumber()) - return string16(); + return base::string16(); switch (type) { case PHONE_HOME_WHOLE_NUMBER: @@ -129,12 +130,12 @@ string16 PhoneNumber::GetInfo(AutofillFieldType type, default: NOTREACHED(); - return string16(); + return base::string16(); } } bool PhoneNumber::SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) { SetRawInfo(type, value); @@ -147,27 +148,27 @@ bool PhoneNumber::SetInfo(AutofillFieldType type, return !number_.empty(); } -void PhoneNumber::GetMatchingTypes(const string16& text, +void PhoneNumber::GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const { - string16 stripped_text = text; + base::string16 stripped_text = text; StripPunctuation(&stripped_text); FormGroup::GetMatchingTypes(stripped_text, app_locale, matching_types); // For US numbers, also compare to the three-digit prefix and the four-digit // suffix, since web sites often split numbers into these two fields. - string16 number = GetInfo(PHONE_HOME_NUMBER, app_locale); + base::string16 number = GetInfo(PHONE_HOME_NUMBER, app_locale); if (GetRegion(*profile_, app_locale) == "US" && number.size() == (kPrefixLength + kSuffixLength)) { - string16 prefix = number.substr(kPrefixOffset, kPrefixLength); - string16 suffix = number.substr(kSuffixOffset, kSuffixLength); + base::string16 prefix = number.substr(kPrefixOffset, kPrefixLength); + base::string16 suffix = number.substr(kSuffixOffset, kSuffixLength); if (text == prefix || text == suffix) matching_types->insert(PHONE_HOME_NUMBER); } - string16 whole_number = GetInfo(PHONE_HOME_WHOLE_NUMBER, app_locale); + base::string16 whole_number = GetInfo(PHONE_HOME_WHOLE_NUMBER, app_locale); if (!whole_number.empty()) { - string16 normalized_number = + base::string16 normalized_number = autofill_i18n::NormalizePhoneNumber(text, GetRegion(*profile_, app_locale)); if (normalized_number == whole_number) @@ -188,7 +189,7 @@ PhoneNumber::PhoneCombineHelper::~PhoneCombineHelper() { } bool PhoneNumber::PhoneCombineHelper::SetInfo(AutofillFieldType field_type, - const string16& value) { + const base::string16& value) { if (field_type == PHONE_HOME_COUNTRY_CODE) { country_ = value; return true; @@ -220,7 +221,7 @@ bool PhoneNumber::PhoneCombineHelper::SetInfo(AutofillFieldType field_type, bool PhoneNumber::PhoneCombineHelper::ParseNumber( const AutofillProfile& profile, const std::string& app_locale, - string16* value) { + base::string16* value) { if (IsEmpty()) return false; diff --git a/components/autofill/browser/phone_number.h b/components/autofill/browser/phone_number.h index 79b780d..50cc99f 100644 --- a/components/autofill/browser/phone_number.h +++ b/components/autofill/browser/phone_number.h @@ -28,16 +28,16 @@ class PhoneNumber : public FormGroup { void set_profile(AutofillProfile* profile) { profile_ = profile; } // FormGroup implementation: - virtual void GetMatchingTypes(const string16& text, + virtual void GetMatchingTypes(const base::string16& text, const std::string& app_locale, FieldTypeSet* matching_types) const OVERRIDE; - virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; + virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; virtual void SetRawInfo(AutofillFieldType type, - const string16& value) OVERRIDE; - virtual string16 GetInfo(AutofillFieldType type, + const base::string16& value) OVERRIDE; + virtual base::string16 GetInfo(AutofillFieldType type, const std::string& app_locale) const OVERRIDE; virtual bool SetInfo(AutofillFieldType type, - const string16& value, + const base::string16& value, const std::string& app_locale) OVERRIDE; // Size and offset of the prefix and suffix portions of phone numbers. @@ -54,7 +54,7 @@ class PhoneNumber : public FormGroup { // If |type| is a phone field type, saves the |value| accordingly and // returns true. For all other field types returs false. - bool SetInfo(AutofillFieldType type, const string16& value); + bool SetInfo(AutofillFieldType type, const base::string16& value); // Parses the number built up from pieces stored via SetInfo() according to // the specified |profile|'s country code, falling back to the given @@ -62,16 +62,16 @@ class PhoneNumber : public FormGroup { // true if parsing was successful, false otherwise. bool ParseNumber(const AutofillProfile& profile, const std::string& app_locale, - string16* value); + base::string16* value); // Returns true if both |phone_| and |whole_number_| are empty. bool IsEmpty() const; private: - string16 country_; - string16 city_; - string16 phone_; - string16 whole_number_; + base::string16 country_; + base::string16 city_; + base::string16 phone_; + base::string16 whole_number_; }; private: @@ -83,7 +83,7 @@ class PhoneNumber : public FormGroup { void UpdateCacheIfNeeded(const std::string& app_locale) const; // The phone number. - string16 number_; + base::string16 number_; // Profile which stores the region used as hint when normalizing the number. const AutofillProfile* profile_; // WEAK diff --git a/components/autofill/browser/phone_number_i18n.cc b/components/autofill/browser/phone_number_i18n.cc index 8ff85df..8af00f2 100644 --- a/components/autofill/browser/phone_number_i18n.cc +++ b/components/autofill/browser/phone_number_i18n.cc @@ -51,9 +51,9 @@ bool IsValidPhoneNumber(const PhoneNumber& phone_number) { // in explicitly, as |number| might have an implicit country code set, even // though the original input lacked a country code. void FormatValidatedNumber(const PhoneNumber& number, - const string16& country_code, - string16* formatted_number, - string16* normalized_number) { + const base::string16& country_code, + base::string16* formatted_number, + base::string16* normalized_number) { PhoneNumberUtil::PhoneNumberFormat format = country_code.empty() ? PhoneNumberUtil::NATIONAL : @@ -79,11 +79,11 @@ namespace autofill_i18n { // Parses the number stored in |value| as it should be interpreted in the given // |region|, and stores the results into the remaining arguments. The |region| // should be sanitized prior to calling this function. -bool ParsePhoneNumber(const string16& value, +bool ParsePhoneNumber(const base::string16& value, const std::string& region, - string16* country_code, - string16* city_code, - string16* number, + base::string16* country_code, + base::string16* city_code, + base::string16* number, PhoneNumber* i18n_number) { country_code->clear(); city_code->clear(); @@ -128,10 +128,10 @@ bool ParsePhoneNumber(const string16& value, } *number = UTF8ToUTF16(subscriber_number); *city_code = UTF8ToUTF16(area_code); - *country_code = string16(); + *country_code = base::string16(); phone_util->NormalizeDigitsOnly(&number_text); - string16 normalized_number(UTF8ToUTF16(number_text)); + base::string16 normalized_number(UTF8ToUTF16(number_text)); // Check if parsed number has a country code that was not inferred from the // region. @@ -148,34 +148,34 @@ bool ParsePhoneNumber(const string16& value, return true; } -string16 NormalizePhoneNumber(const string16& value, - const std::string& region) { +base::string16 NormalizePhoneNumber(const base::string16& value, + const std::string& region) { DCHECK_EQ(2u, region.size()); - string16 country_code; - string16 unused_city_code; - string16 unused_number; + base::string16 country_code; + base::string16 unused_city_code; + base::string16 unused_number; PhoneNumber phone_number; if (!ParsePhoneNumber(value, region, &country_code, &unused_city_code, &unused_number, &phone_number)) { - return string16(); // Parsing failed - do not store phone. + return base::string16(); // Parsing failed - do not store phone. } - string16 normalized_number; + base::string16 normalized_number; FormatValidatedNumber(phone_number, country_code, NULL, &normalized_number); return normalized_number; } -bool ConstructPhoneNumber(const string16& country_code, - const string16& city_code, - const string16& number, +bool ConstructPhoneNumber(const base::string16& country_code, + const base::string16& city_code, + const base::string16& number, const std::string& region, - string16* whole_number) { + base::string16* whole_number) { DCHECK_EQ(2u, region.size()); whole_number->clear(); - string16 unused_country_code; - string16 unused_city_code; - string16 unused_number; + base::string16 unused_country_code; + base::string16 unused_city_code; + base::string16 unused_number; PhoneNumber phone_number; if (!ParsePhoneNumber(country_code + city_code + number, region, &unused_country_code, &unused_city_code, &unused_number, @@ -187,8 +187,8 @@ bool ConstructPhoneNumber(const string16& country_code, return true; } -bool PhoneNumbersMatch(const string16& number_a, - const string16& number_b, +bool PhoneNumbersMatch(const base::string16& number_a, + const base::string16& number_b, const std::string& raw_region, const std::string& app_locale) { // Sanitize the provided |raw_region| before trying to use it for parsing. @@ -224,7 +224,7 @@ bool PhoneNumbersMatch(const string16& number_a, return false; } -PhoneObject::PhoneObject(const string16& number, +PhoneObject::PhoneObject(const base::string16& number, const std::string& region) : region_(region), i18n_number_(NULL) { @@ -258,7 +258,7 @@ PhoneObject::PhoneObject() : i18n_number_(NULL) { PhoneObject::~PhoneObject() { } -string16 PhoneObject::GetFormattedNumber() const { +base::string16 PhoneObject::GetFormattedNumber() const { if (i18n_number_ && formatted_number_.empty()) { FormatValidatedNumber(*i18n_number_, country_code_, &formatted_number_, &whole_number_); @@ -267,7 +267,7 @@ string16 PhoneObject::GetFormattedNumber() const { return formatted_number_; } -string16 PhoneObject::GetWholeNumber() const { +base::string16 PhoneObject::GetWholeNumber() const { if (i18n_number_ && whole_number_.empty()) { FormatValidatedNumber(*i18n_number_, country_code_, &formatted_number_, &whole_number_); diff --git a/components/autofill/browser/phone_number_i18n.h b/components/autofill/browser/phone_number_i18n.h index 708da45..2da7a4b 100644 --- a/components/autofill/browser/phone_number_i18n.h +++ b/components/autofill/browser/phone_number_i18n.h @@ -29,17 +29,17 @@ namespace autofill_i18n { // |region| should be a 2-letter country code. This is an internal function, // exposed in the header file so that it can be tested. bool ParsePhoneNumber( - const string16& value, + const base::string16& value, const std::string& region, - string16* country_code, - string16* city_code, - string16* number, + base::string16* country_code, + base::string16* city_code, + base::string16* number, i18n::phonenumbers::PhoneNumber* i18n_number) WARN_UNUSED_RESULT; // Normalizes phone number, by changing digits in the extended fonts // (such as \xFF1x) into '0'-'9'. Also strips out non-digit characters. -string16 NormalizePhoneNumber(const string16& value, - const std::string& region); +base::string16 NormalizePhoneNumber(const base::string16& value, + const std::string& region); // Constructs whole phone number from parts. // |city_code| - area code, could be empty. @@ -49,23 +49,23 @@ string16 NormalizePhoneNumber(const string16& value, // |whole_number| - constructed whole number. // Separator characters are stripped before parsing the digits. // Returns true if parsing was successful, false otherwise. -bool ConstructPhoneNumber(const string16& country_code, - const string16& city_code, - const string16& number, +bool ConstructPhoneNumber(const base::string16& country_code, + const base::string16& city_code, + const base::string16& number, const std::string& region, - string16* whole_number) WARN_UNUSED_RESULT; + base::string16* whole_number) WARN_UNUSED_RESULT; // Returns true if |number_a| and |number_b| parse to the same phone number in // the given |region|. -bool PhoneNumbersMatch(const string16& number_a, - const string16& number_b, +bool PhoneNumbersMatch(const base::string16& number_a, + const base::string16& number_b, const std::string& region, const std::string& app_locale); // The cached phone number, does parsing only once, improves performance. class PhoneObject { public: - PhoneObject(const string16& number, + PhoneObject(const base::string16& number, const std::string& region); PhoneObject(const PhoneObject&); PhoneObject(); @@ -73,12 +73,12 @@ class PhoneObject { std::string region() const { return region_; } - string16 country_code() const { return country_code_; } - string16 city_code() const { return city_code_; } - string16 number() const { return number_; } + base::string16 country_code() const { return country_code_; } + base::string16 city_code() const { return city_code_; } + base::string16 number() const { return number_; } - string16 GetFormattedNumber() const; - string16 GetWholeNumber() const; + base::string16 GetFormattedNumber() const; + base::string16 GetWholeNumber() const; PhoneObject& operator=(const PhoneObject& other); @@ -90,17 +90,17 @@ class PhoneObject { // The parsed number and its components. scoped_ptr<i18n::phonenumbers::PhoneNumber> i18n_number_; - string16 city_code_; - string16 country_code_; - string16 number_; + base::string16 city_code_; + base::string16 country_code_; + base::string16 number_; // Pretty printed version of the whole number, or empty if parsing failed. // Set on first request. - mutable string16 formatted_number_; + mutable base::string16 formatted_number_; // The whole number, normalized to contain only digits if possible. // Set on first request. - mutable string16 whole_number_; + mutable base::string16 whole_number_; }; } // namespace autofill_i18n diff --git a/components/autofill/browser/phone_number_i18n_unittest.cc b/components/autofill/browser/phone_number_i18n_unittest.cc index 0547520..4872a35 100644 --- a/components/autofill/browser/phone_number_i18n_unittest.cc +++ b/components/autofill/browser/phone_number_i18n_unittest.cc @@ -18,127 +18,129 @@ using content::BrowserThread; TEST(PhoneNumberI18NTest, NormalizePhoneNumber) { // "Large" digits. - string16 phone1(UTF8ToUTF16("\xEF\xBC\x91\xEF\xBC\x96\xEF\xBC\x95\xEF\xBC\x90" - "\xEF\xBC\x97\xEF\xBC\x94\xEF\xBC\x99\xEF\xBC\x98" - "\xEF\xBC\x93\xEF\xBC\x92\xEF\xBC\x93")); + base::string16 phone1(UTF8ToUTF16( + "\xEF\xBC\x91\xEF\xBC\x96\xEF\xBC\x95\xEF\xBC\x90" + "\xEF\xBC\x97\xEF\xBC\x94\xEF\xBC\x99\xEF\xBC\x98" + "\xEF\xBC\x93\xEF\xBC\x92\xEF\xBC\x93")); EXPECT_EQ(NormalizePhoneNumber(phone1, "US"), ASCIIToUTF16("16507498323")); // Devanagari script digits. - string16 phone2(UTF8ToUTF16("\xD9\xA1\xD9\xA6\xD9\xA5\xD9\xA0\xD9\xA8\xD9\xA3" - "\xD9\xA2\xD9\xA3\xD9\xA7\xD9\xA4\xD9\xA9")); + base::string16 phone2(UTF8ToUTF16( + "\xD9\xA1\xD9\xA6\xD9\xA5\xD9\xA0\xD9\xA8\xD9\xA3" + "\xD9\xA2\xD9\xA3\xD9\xA7\xD9\xA4\xD9\xA9")); EXPECT_EQ(NormalizePhoneNumber(phone2, "US"), ASCIIToUTF16("16508323749")); - string16 phone3(UTF8ToUTF16("16503334\xef\xbc\x92\x35\xd9\xa5")); + base::string16 phone3(UTF8ToUTF16("16503334\xef\xbc\x92\x35\xd9\xa5")); EXPECT_EQ(NormalizePhoneNumber(phone3, "US"), ASCIIToUTF16("16503334255")); - string16 phone4(UTF8ToUTF16("+1(650)2346789")); + base::string16 phone4(UTF8ToUTF16("+1(650)2346789")); EXPECT_EQ(NormalizePhoneNumber(phone4, "US"), ASCIIToUTF16("16502346789")); - string16 phone5(UTF8ToUTF16("6502346789")); + base::string16 phone5(UTF8ToUTF16("6502346789")); EXPECT_EQ(NormalizePhoneNumber(phone5, "US"), ASCIIToUTF16("6502346789")); } TEST(PhoneNumberI18NTest, ParsePhoneNumber) { - string16 number; - string16 city_code; - string16 country_code; + base::string16 number; + base::string16 city_code; + base::string16 country_code; i18n::phonenumbers::PhoneNumber unused_i18n_number; // Test for empty string. Should give back empty strings. - string16 phone0; + base::string16 phone0; EXPECT_FALSE(ParsePhoneNumber(phone0, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); // Test for string with less than 7 digits. Should give back empty strings. - string16 phone1(ASCIIToUTF16("1234")); + base::string16 phone1(ASCIIToUTF16("1234")); EXPECT_FALSE(ParsePhoneNumber(phone1, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); // Test for string with exactly 7 digits. // Not a valid number - starts with 1 - string16 phone2(ASCIIToUTF16("1234567")); + base::string16 phone2(ASCIIToUTF16("1234567")); EXPECT_FALSE(ParsePhoneNumber(phone2, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); // Not a valid number - does not have area code. - string16 phone3(ASCIIToUTF16("2234567")); + base::string16 phone3(ASCIIToUTF16("2234567")); EXPECT_FALSE(ParsePhoneNumber(phone3, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); // Test for string with greater than 7 digits but less than 10 digits. // Should fail parsing in US. - string16 phone4(ASCIIToUTF16("123456789")); + base::string16 phone4(ASCIIToUTF16("123456789")); EXPECT_FALSE(ParsePhoneNumber(phone4, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); // Test for string with greater than 7 digits but less than 10 digits and // separators. // Should fail parsing in US. - string16 phone_separator4(ASCIIToUTF16("12.345-6789")); + base::string16 phone_separator4(ASCIIToUTF16("12.345-6789")); EXPECT_FALSE(ParsePhoneNumber(phone_separator4, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); // Test for string with exactly 10 digits. // Should give back phone number and city code. // This one going to fail because of the incorrect area code. - string16 phone5(ASCIIToUTF16("1234567890")); + base::string16 phone5(ASCIIToUTF16("1234567890")); EXPECT_FALSE(ParsePhoneNumber(phone5, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); - string16 phone6(ASCIIToUTF16("6501567890")); + base::string16 phone6(ASCIIToUTF16("6501567890")); // This one going to fail because of the incorrect number (starts with 1). EXPECT_FALSE(ParsePhoneNumber(phone6, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); - string16 phone7(ASCIIToUTF16("6504567890")); + base::string16 phone7(ASCIIToUTF16("6504567890")); EXPECT_TRUE(ParsePhoneNumber(phone7, "US", &country_code, &city_code, @@ -146,11 +148,11 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { &unused_i18n_number)); EXPECT_EQ(ASCIIToUTF16("4567890"), number); EXPECT_EQ(ASCIIToUTF16("650"), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), country_code); // Test for string with exactly 10 digits and separators. // Should give back phone number and city code. - string16 phone_separator7(ASCIIToUTF16("(650) 456-7890")); + base::string16 phone_separator7(ASCIIToUTF16("(650) 456-7890")); EXPECT_TRUE(ParsePhoneNumber(phone_separator7, "US", &country_code, &city_code, @@ -158,23 +160,23 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { &unused_i18n_number)); EXPECT_EQ(ASCIIToUTF16("4567890"), number); EXPECT_EQ(ASCIIToUTF16("650"), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), country_code); // Tests for string with over 10 digits. // 01 is incorrect prefix in the USA, and if we interpret 011 as prefix, the // rest is too short for international number - the parsing should fail. - string16 phone8(ASCIIToUTF16("0116504567890")); + base::string16 phone8(ASCIIToUTF16("0116504567890")); EXPECT_FALSE(ParsePhoneNumber(phone8, "US", &country_code, &city_code, &number, &unused_i18n_number)); - EXPECT_EQ(string16(), number); - EXPECT_EQ(string16(), city_code); - EXPECT_EQ(string16(), country_code); + EXPECT_EQ(base::string16(), number); + EXPECT_EQ(base::string16(), city_code); + EXPECT_EQ(base::string16(), country_code); // 011 is a correct "dial out" prefix in the USA - the parsing should succeed. - string16 phone9(ASCIIToUTF16("01116504567890")); + base::string16 phone9(ASCIIToUTF16("01116504567890")); EXPECT_TRUE(ParsePhoneNumber(phone9, "US", &country_code, &city_code, @@ -185,7 +187,7 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { EXPECT_EQ(ASCIIToUTF16("1"), country_code); // 011 is a correct "dial out" prefix in the USA - the parsing should succeed. - string16 phone10(ASCIIToUTF16("01178124567890")); + base::string16 phone10(ASCIIToUTF16("01178124567890")); EXPECT_TRUE(ParsePhoneNumber(phone10, "US", &country_code, &city_code, @@ -198,7 +200,7 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { // Test for string with over 10 digits with separator characters. // Should give back phone number, city code, and country code. "011" is // US "dial out" code, which is discarded. - string16 phone11(ASCIIToUTF16("(0111) 650-456.7890")); + base::string16 phone11(ASCIIToUTF16("(0111) 650-456.7890")); EXPECT_TRUE(ParsePhoneNumber(phone11, "US", &country_code, &city_code, @@ -210,7 +212,7 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { // Now try phone from Chech republic - it has 00 dial out code, 420 country // code and variable length area codes. - string16 phone12(ASCIIToUTF16("+420 27-89.10.112")); + base::string16 phone12(ASCIIToUTF16("+420 27-89.10.112")); EXPECT_TRUE(ParsePhoneNumber(phone12, "US", &country_code, &city_code, @@ -229,7 +231,7 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { EXPECT_EQ(ASCIIToUTF16("278"), city_code); EXPECT_EQ(ASCIIToUTF16("420"), country_code); - string16 phone13(ASCIIToUTF16("420 57-89.10.112")); + base::string16 phone13(ASCIIToUTF16("420 57-89.10.112")); EXPECT_FALSE(ParsePhoneNumber(phone13, "US", &country_code, &city_code, @@ -244,7 +246,7 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { EXPECT_EQ(ASCIIToUTF16("578"), city_code); EXPECT_EQ(ASCIIToUTF16("420"), country_code); - string16 phone14(ASCIIToUTF16("1-650-FLOWERS")); + base::string16 phone14(ASCIIToUTF16("1-650-FLOWERS")); EXPECT_TRUE(ParsePhoneNumber(phone14, "US", &country_code, &city_code, @@ -256,7 +258,7 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { // 800 is not an area code, but the destination code. In our library these // codes should be treated the same as area codes. - string16 phone15(ASCIIToUTF16("1-800-FLOWERS")); + base::string16 phone15(ASCIIToUTF16("1-800-FLOWERS")); EXPECT_TRUE(ParsePhoneNumber(phone15, "US", &country_code, &city_code, @@ -268,38 +270,38 @@ TEST(PhoneNumberI18NTest, ParsePhoneNumber) { } TEST(PhoneNumberI18NTest, ConstructPhoneNumber) { - string16 number; + base::string16 number; EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"), ASCIIToUTF16("650"), ASCIIToUTF16("2345678"), "US", &number)); EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678")); - EXPECT_TRUE(ConstructPhoneNumber(string16(), + EXPECT_TRUE(ConstructPhoneNumber(base::string16(), ASCIIToUTF16("650"), ASCIIToUTF16("2345678"), "US", &number)); EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678")); EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("1"), - string16(), + base::string16(), ASCIIToUTF16("6502345678"), "US", &number)); EXPECT_EQ(number, ASCIIToUTF16("+1 650-234-5678")); - EXPECT_TRUE(ConstructPhoneNumber(string16(), - string16(), + EXPECT_TRUE(ConstructPhoneNumber(base::string16(), + base::string16(), ASCIIToUTF16("6502345678"), "US", &number)); EXPECT_EQ(number, ASCIIToUTF16("(650) 234-5678")); - EXPECT_FALSE(ConstructPhoneNumber(string16(), + EXPECT_FALSE(ConstructPhoneNumber(base::string16(), ASCIIToUTF16("650"), ASCIIToUTF16("234567890"), "US", &number)); - EXPECT_EQ(number, string16()); + EXPECT_EQ(number, base::string16()); // Italian number EXPECT_TRUE(ConstructPhoneNumber(ASCIIToUTF16("39"), ASCIIToUTF16("347"), @@ -307,7 +309,7 @@ TEST(PhoneNumberI18NTest, ConstructPhoneNumber) { "IT", &number)); EXPECT_EQ(number, ASCIIToUTF16("+39 347 234 5678")); - EXPECT_TRUE(ConstructPhoneNumber(string16(), + EXPECT_TRUE(ConstructPhoneNumber(base::string16(), ASCIIToUTF16("347"), ASCIIToUTF16("2345678"), "IT", @@ -320,7 +322,7 @@ TEST(PhoneNumberI18NTest, ConstructPhoneNumber) { "DE", &number)); EXPECT_EQ(number, ASCIIToUTF16("+49 2423/45678901")); - EXPECT_TRUE(ConstructPhoneNumber(string16(), + EXPECT_TRUE(ConstructPhoneNumber(base::string16(), ASCIIToUTF16("024"), ASCIIToUTF16("2345678901"), "DE", diff --git a/components/autofill/browser/phone_number_unittest.cc b/components/autofill/browser/phone_number_unittest.cc index 2fabb0b..e82e14d 100644 --- a/components/autofill/browser/phone_number_unittest.cc +++ b/components/autofill/browser/phone_number_unittest.cc @@ -14,12 +14,12 @@ TEST(PhoneNumberTest, Matcher) { AutofillProfile profile; profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); // Set phone number so country_code == 1, city_code = 650, number = 2345678. - string16 phone(ASCIIToUTF16("1 [650] 234-5678")); + base::string16 phone(ASCIIToUTF16("1 [650] 234-5678")); PhoneNumber phone_number(&profile); phone_number.SetInfo(PHONE_HOME_WHOLE_NUMBER, phone, "US"); FieldTypeSet matching_types; - phone_number.GetMatchingTypes(string16(), "US", &matching_types); + phone_number.GetMatchingTypes(base::string16(), "US", &matching_types); EXPECT_EQ(1U, matching_types.size()); EXPECT_TRUE(matching_types.find(EMPTY_TYPE) != matching_types.end()); matching_types.clear(); @@ -86,7 +86,7 @@ TEST(PhoneNumberTest, SetInfo) { profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); PhoneNumber phone(&profile); - EXPECT_EQ(string16(), phone.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); + EXPECT_EQ(base::string16(), phone.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); // Set the formatted info directly. EXPECT_TRUE(phone.SetInfo(PHONE_HOME_WHOLE_NUMBER, @@ -110,7 +110,7 @@ TEST(PhoneNumberTest, SetInfo) { // start with the digit '1'. EXPECT_FALSE(phone.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("650111111"), "US")); - EXPECT_EQ(string16(), phone.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); + EXPECT_EQ(base::string16(), phone.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); } // Test that cached phone numbers are correctly invalidated and updated. @@ -129,7 +129,7 @@ TEST(PhoneNumberTest, UpdateCachedPhoneNumber) { // Change the phone number to have a UK format, but try to parse with the // wrong locale. phone.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("07023456789")); - EXPECT_EQ(string16(), phone.GetInfo(PHONE_HOME_CITY_CODE, "US")); + EXPECT_EQ(base::string16(), phone.GetInfo(PHONE_HOME_CITY_CODE, "US")); // Now try parsing using the correct locale. Note that the profile's country // code should override the app locale, which is still set to "US". @@ -151,7 +151,7 @@ TEST(PhoneNumberTest, PhoneCombineHelper) { ASCIIToUTF16("650"))); EXPECT_TRUE(number1.SetInfo(PHONE_HOME_NUMBER, ASCIIToUTF16("2345678"))); - string16 parsed_phone; + base::string16 parsed_phone; EXPECT_TRUE(number1.ParseNumber(profile, "en-US", &parsed_phone)); // International format as it has a country code. EXPECT_EQ(ASCIIToUTF16("+1 650-234-5678"), parsed_phone); @@ -171,7 +171,7 @@ TEST(PhoneNumberTest, PhoneCombineHelper) { EXPECT_TRUE(number4.SetInfo(PHONE_HOME_NUMBER, ASCIIToUTF16("2345680"))); EXPECT_FALSE(number4.ParseNumber(profile, "en-US", &parsed_phone)); - EXPECT_EQ(string16(), parsed_phone); + EXPECT_EQ(base::string16(), parsed_phone); PhoneNumber::PhoneCombineHelper number5; EXPECT_TRUE(number5.SetInfo(PHONE_HOME_CITY_AND_NUMBER, diff --git a/components/autofill/browser/test_autofill_external_delegate.cc b/components/autofill/browser/test_autofill_external_delegate.cc index 31bb02b..e9643d8 100644 --- a/components/autofill/browser/test_autofill_external_delegate.cc +++ b/components/autofill/browser/test_autofill_external_delegate.cc @@ -18,8 +18,8 @@ void GenerateTestAutofillPopup( gfx::RectF bounds(100.f, 100.f); autofill_external_delegate->OnQuery(query_id, form, field, bounds, false); - std::vector<string16> autofill_item; - autofill_item.push_back(string16()); + std::vector<base::string16> autofill_item; + autofill_item.push_back(base::string16()); std::vector<int> autofill_id; autofill_id.push_back(0); autofill_external_delegate->OnSuggestionsReturned( diff --git a/components/autofill/browser/test_autofill_manager_delegate.cc b/components/autofill/browser/test_autofill_manager_delegate.cc index 33b8944..6b6f911 100644 --- a/components/autofill/browser/test_autofill_manager_delegate.cc +++ b/components/autofill/browser/test_autofill_manager_delegate.cc @@ -64,9 +64,9 @@ void TestAutofillManagerDelegate::ShowRequestAutocompleteDialog( void TestAutofillManagerDelegate::ShowAutofillPopup( const gfx::RectF& element_bounds, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& identifiers, AutofillPopupDelegate* delegate) {} diff --git a/components/autofill/browser/test_autofill_manager_delegate.h b/components/autofill/browser/test_autofill_manager_delegate.h index 0c31d98..f88c7cc 100644 --- a/components/autofill/browser/test_autofill_manager_delegate.h +++ b/components/autofill/browser/test_autofill_manager_delegate.h @@ -48,9 +48,9 @@ class TestAutofillManagerDelegate : public AutofillManagerDelegate { const base::Callback<void(const FormStructure*, const std::string&)>& callback) OVERRIDE; virtual void ShowAutofillPopup(const gfx::RectF& element_bounds, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& identifiers, AutofillPopupDelegate* delegate) OVERRIDE; virtual void HideAutofillPopup() OVERRIDE; diff --git a/components/autofill/browser/validation.cc b/components/autofill/browser/validation.cc index e8380a0..c5779fb 100644 --- a/components/autofill/browser/validation.cc +++ b/components/autofill/browser/validation.cc @@ -13,10 +13,10 @@ namespace autofill { -bool IsValidCreditCardExpirationDate(const string16& year, - const string16& month, +bool IsValidCreditCardExpirationDate(const base::string16& year, + const base::string16& month, const base::Time& now) { - string16 year_cleaned, month_cleaned; + base::string16 year_cleaned, month_cleaned; TrimWhitespace(year, TRIM_ALL, &year_cleaned); TrimWhitespace(month, TRIM_ALL, &month_cleaned); if (year_cleaned.length() != 4) @@ -42,8 +42,8 @@ bool IsValidCreditCardExpirationDate(const string16& year, return true; } -bool IsValidCreditCardNumber(const string16& text) { - string16 number = CreditCard::StripSeparators(text); +bool IsValidCreditCardNumber(const base::string16& text) { + base::string16 number = CreditCard::StripSeparators(text); // Credit card numbers are at most 19 digits in length [1]. 12 digits seems to // be a fairly safe lower-bound [2]. @@ -59,7 +59,7 @@ bool IsValidCreditCardNumber(const string16& text) { // [3] http://en.wikipedia.org/wiki/Luhn_algorithm int sum = 0; bool odd = false; - for (string16::reverse_iterator iter = number.rbegin(); + for (base::string16::reverse_iterator iter = number.rbegin(); iter != number.rend(); ++iter) { if (!IsAsciiDigit(*iter)) @@ -78,11 +78,11 @@ bool IsValidCreditCardNumber(const string16& text) { return (sum % 10) == 0; } -bool IsValidCreditCardSecurityCode(const string16& text) { +bool IsValidCreditCardSecurityCode(const base::string16& text) { if (text.size() < 3U || text.size() > 4U) return false; - for (string16::const_iterator iter = text.begin(); + for (base::string16::const_iterator iter = text.begin(); iter != text.end(); ++iter) { if (!IsAsciiDigit(*iter)) @@ -91,8 +91,8 @@ bool IsValidCreditCardSecurityCode(const string16& text) { return true; } -bool IsValidCreditCardSecurityCode(const string16& code, - const string16& number) { +bool IsValidCreditCardSecurityCode(const base::string16& code, + const base::string16& number) { CreditCard card; card.SetRawInfo(CREDIT_CARD_NUMBER, number); size_t required_length = 3; @@ -102,16 +102,16 @@ bool IsValidCreditCardSecurityCode(const string16& code, return code.length() == required_length; } -bool IsValidEmailAddress(const string16& text) { +bool IsValidEmailAddress(const base::string16& text) { // E-Mail pattern as defined by the WhatWG. (4.10.7.1.5 E-Mail state) - const string16 kEmailPattern = ASCIIToUTF16( + const base::string16 kEmailPattern = ASCIIToUTF16( "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@" "[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$"); return MatchesPattern(text, kEmailPattern); } -bool IsValidZip(const string16& value) { - const string16 kZipPattern = ASCIIToUTF16("^\\d{5}(-\\d{4})?$"); +bool IsValidZip(const base::string16& value) { + const base::string16 kZipPattern = ASCIIToUTF16("^\\d{5}(-\\d{4})?$"); return MatchesPattern(value, kZipPattern); } diff --git a/components/autofill/browser/validation.h b/components/autofill/browser/validation.h index 352a639..618dcc1 100644 --- a/components/autofill/browser/validation.h +++ b/components/autofill/browser/validation.h @@ -15,28 +15,28 @@ namespace autofill { // Returns true if |year| and |month| describe a date later than |now|. // |year| must have 4 digits. -bool IsValidCreditCardExpirationDate(const string16& year, - const string16& month, +bool IsValidCreditCardExpirationDate(const base::string16& year, + const base::string16& month, const base::Time& now); // Returns true if |text| looks like a valid credit card number. // Uses the Luhn formula to validate the number. -bool IsValidCreditCardNumber(const string16& text); +bool IsValidCreditCardNumber(const base::string16& text); // Returns true if |text| looks like a valid credit card security code. -bool IsValidCreditCardSecurityCode(const string16& text); +bool IsValidCreditCardSecurityCode(const base::string16& text); // Returns true if |code| looks like a valid credit card security code // for the type of credit card designated by |number|. -bool IsValidCreditCardSecurityCode(const string16& code, - const string16& number); +bool IsValidCreditCardSecurityCode(const base::string16& code, + const base::string16& number); // Returns true if |text| looks like a valid e-mail address. -bool IsValidEmailAddress(const string16& text); +bool IsValidEmailAddress(const base::string16& text); // Returns true if |text| looks like a valid zip code. // Valid for US zip codes only. -bool IsValidZip(const string16& text); +bool IsValidZip(const base::string16& text); } // namespace autofill diff --git a/components/autofill/browser/wallet/encryption_escrow_client.cc b/components/autofill/browser/wallet/encryption_escrow_client.cc index f69acf0..4b74c1a 100644 --- a/components/autofill/browser/wallet/encryption_escrow_client.cc +++ b/components/autofill/browser/wallet/encryption_escrow_client.cc @@ -6,8 +6,8 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" -#include "base/string_number_conversions.h" #include "base/stringprintf.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/utf_string_conversions.h" #include "components/autofill/browser/wallet/encryption_escrow_client_observer.h" diff --git a/components/autofill/browser/wallet/full_wallet.cc b/components/autofill/browser/wallet/full_wallet.cc index 9e9fb03..b68c1aa 100644 --- a/components/autofill/browser/wallet/full_wallet.cc +++ b/components/autofill/browser/wallet/full_wallet.cc @@ -124,7 +124,7 @@ scoped_ptr<FullWallet> required_actions)); } -string16 FullWallet::GetInfo(AutofillFieldType type) { +base::string16 FullWallet::GetInfo(AutofillFieldType type) { switch (type) { case CREDIT_CARD_NUMBER: return UTF8ToUTF16(GetPan()); @@ -145,7 +145,7 @@ string16 FullWallet::GetInfo(AutofillFieldType type) { NOTREACHED(); } - return string16(); + return base::string16(); } bool FullWallet::HasRequiredAction(RequiredAction action) const { diff --git a/components/autofill/browser/wallet/full_wallet.h b/components/autofill/browser/wallet/full_wallet.h index 3c04c61..0a592db 100644 --- a/components/autofill/browser/wallet/full_wallet.h +++ b/components/autofill/browser/wallet/full_wallet.h @@ -38,7 +38,7 @@ class FullWallet { CreateFullWallet(const base::DictionaryValue& dictionary); // Returns corresponding data for |type|. - string16 GetInfo(AutofillFieldType type); + base::string16 GetInfo(AutofillFieldType type); // Whether or not |action| is in |required_actions_|. bool HasRequiredAction(RequiredAction action) const; diff --git a/components/autofill/browser/wallet/instrument.cc b/components/autofill/browser/wallet/instrument.cc index 7c90d29..f2ef382 100644 --- a/components/autofill/browser/wallet/instrument.cc +++ b/components/autofill/browser/wallet/instrument.cc @@ -5,8 +5,8 @@ #include "components/autofill/browser/wallet/instrument.h" #include "base/logging.h" -#include "base/string_number_conversions.h" #include "base/string_util.h" +#include "base/strings/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "components/autofill/browser/autofill_country.h" @@ -57,7 +57,7 @@ std::string FormOfPaymentToString(Instrument::FormOfPayment form_of_payment) { } // namespace Instrument::Instrument(const CreditCard& card, - const string16& card_verification_number, + const base::string16& card_verification_number, const AutofillProfile& profile) : primary_account_number_(card.GetRawInfo(CREDIT_CARD_NUMBER)), card_verification_number_(card_verification_number), @@ -68,8 +68,8 @@ Instrument::Instrument(const CreditCard& card, Init(); } -Instrument::Instrument(const string16& primary_account_number, - const string16& card_verification_number, +Instrument::Instrument(const base::string16& primary_account_number, + const base::string16& card_verification_number, int expiration_month, int expiration_year, FormOfPayment form_of_payment, diff --git a/components/autofill/browser/wallet/instrument.h b/components/autofill/browser/wallet/instrument.h index 40c02f2..cb23d85 100644 --- a/components/autofill/browser/wallet/instrument.h +++ b/components/autofill/browser/wallet/instrument.h @@ -38,11 +38,11 @@ class Instrument { // Convert the info in |card| to an Instrument using |profile| for address. Instrument(const CreditCard& card, - const string16& card_verification_number, + const base::string16& card_verification_number, const AutofillProfile& profile); - Instrument(const string16& primary_account_number, - const string16& card_verification_number, + Instrument(const base::string16& primary_account_number, + const base::string16& card_verification_number, int expiration_month, int expiration_year, FormOfPayment form_of_payment, @@ -58,26 +58,26 @@ class Instrument { // in the constructor were valid for use with Google Wallet. bool IsValid() const; - const string16& primary_account_number() const { + const base::string16& primary_account_number() const { return primary_account_number_; } - const string16& card_verification_number() const { + const base::string16& card_verification_number() const { return card_verification_number_; } int expiration_month() const { return expiration_month_; } int expiration_year() const { return expiration_year_; } const Address& address() const { return *address_; } FormOfPayment form_of_payment() const { return form_of_payment_; } - const string16& last_four_digits() { return last_four_digits_; } + const base::string16& last_four_digits() { return last_four_digits_; } private: void Init(); // |primary_account_number_| is expected to be \d{12-19}. - string16 primary_account_number_; + base::string16 primary_account_number_; // |card_verification_number_| is expected to be \d{3-4}. - string16 card_verification_number_; + base::string16 card_verification_number_; // |expiration month_| should be 1-12. int expiration_month_; @@ -92,7 +92,7 @@ class Instrument { scoped_ptr<Address> address_; // The last four digits of |primary_account_number_|. - string16 last_four_digits_; + base::string16 last_four_digits_; DISALLOW_ASSIGN(Instrument); }; diff --git a/components/autofill/browser/wallet/instrument_unittest.cc b/components/autofill/browser/wallet/instrument_unittest.cc index e2b945b..382ef03 100644 --- a/components/autofill/browser/wallet/instrument_unittest.cc +++ b/components/autofill/browser/wallet/instrument_unittest.cc @@ -33,7 +33,7 @@ TEST(Instrument, LastFourDigits) { } TEST(Instrument, NoPrimaryAccountNumberIsInvalid) { - Instrument instrument(string16(), + Instrument instrument(base::string16(), ASCIIToUTF16(kCardVerificationNumber), 12, 2015, @@ -78,7 +78,7 @@ TEST(Instrument, PrimaryAccountNumberNotPassingLuhnIsInvalid) { TEST(Instrument, NoCardVerificationNumberIsInvalid) { Instrument instrument(ASCIIToUTF16(kPrimaryAccountNumber), - string16(), + base::string16(), 12, 2015, Instrument::VISA, diff --git a/components/autofill/browser/wallet/wallet_address.h b/components/autofill/browser/wallet/wallet_address.h index b8ebf94..0b4bf36 100644 --- a/components/autofill/browser/wallet/wallet_address.h +++ b/components/autofill/browser/wallet/wallet_address.h @@ -42,13 +42,13 @@ class Address { explicit Address(const AutofillProfile& profile); Address(const std::string& country_name_code, - const string16& recipient_name, - const string16& address_line_1, - const string16& address_line_2, - const string16& locality_name, - const string16& administrative_area_name, - const string16& postal_code_number, - const string16& phone_number, + const base::string16& recipient_name, + const base::string16& address_line_1, + const base::string16& address_line_2, + const base::string16& locality_name, + const base::string16& administrative_area_name, + const base::string16& postal_code_number, + const base::string16& phone_number, const std::string& object_id); ~Address(); @@ -81,50 +81,53 @@ class Address { // Returns a string that summarizes this address, suitable for display to // the user. - string16 DisplayName() const; + base::string16 DisplayName() const; // Returns a string that could be used as a sub-label, suitable for display // to the user together with DisplayName(). - string16 DisplayNameDetail() const; + base::string16 DisplayNameDetail() const; // Returns data appropriate for |type|. - string16 GetInfo(AutofillFieldType type, + base::string16 GetInfo(AutofillFieldType type, const std::string& app_locale) const; const std::string& country_name_code() const { return country_name_code_; } - const string16& recipient_name() const { return recipient_name_; } - const string16& address_line_1() const { return address_line_1_; } - const string16& address_line_2() const { return address_line_2_; } - const string16& locality_name() const { return locality_name_; } - const string16& administrative_area_name() const { + const base::string16& recipient_name() const { return recipient_name_; } + const base::string16& address_line_1() const { return address_line_1_; } + const base::string16& address_line_2() const { return address_line_2_; } + const base::string16& locality_name() const { return locality_name_; } + const base::string16& administrative_area_name() const { return administrative_area_name_; } - const string16& postal_code_number() const { return postal_code_number_; } - const string16& phone_number() const { return phone_number_; } + const base::string16& postal_code_number() const { + return postal_code_number_; + } + const base::string16& phone_number() const { return phone_number_; } const std::string& object_id() const { return object_id_; } void set_country_name_code(const std::string& country_name_code) { country_name_code_ = country_name_code; } - void set_recipient_name(const string16& recipient_name) { + void set_recipient_name(const base::string16& recipient_name) { recipient_name_ = recipient_name; } - void set_address_line_1(const string16& address_line_1) { + void set_address_line_1(const base::string16& address_line_1) { address_line_1_ = address_line_1; } - void set_address_line_2(const string16& address_line_2) { + void set_address_line_2(const base::string16& address_line_2) { address_line_2_ = address_line_2; } - void set_locality_name(const string16& locality_name) { + void set_locality_name(const base::string16& locality_name) { locality_name_ = locality_name; } - void set_administrative_area_name(const string16& administrative_area_name) { + void set_administrative_area_name( + const base::string16& administrative_area_name) { administrative_area_name_ = administrative_area_name; } - void set_postal_code_number(const string16& postal_code_number) { + void set_postal_code_number(const base::string16& postal_code_number) { postal_code_number_ = postal_code_number; } - void set_phone_number(const string16& phone_number) { + void set_phone_number(const base::string16& phone_number) { phone_number_ = phone_number; } void set_object_id(const std::string& object_id) { @@ -140,12 +143,12 @@ class Address { std::string country_name_code_; // The recipient's name. For example "John Doe". - string16 recipient_name_; + base::string16 recipient_name_; // |address_line_1| and |address_line_2| correspond to the "AddressLine" // elements in xAL, which are used to hold unstructured text. - string16 address_line_1_; - string16 address_line_2_; + base::string16 address_line_1_; + base::string16 address_line_2_; // Locality. This is something of a fuzzy term, but it generally refers to // the city/town portion of an address. In regions of the world where @@ -153,20 +156,20 @@ class Address { // (for example, Japan and China), leave locality_name empty and use // |address_line_2|. // Examples: US city, IT comune, UK post town. - string16 locality_name_; + base::string16 locality_name_; // Top-level administrative subdivision of this country. // Examples: US state, IT region, UK constituent nation, JP prefecture. - string16 administrative_area_name_; + base::string16 administrative_area_name_; // Despite the name, |postal_code_number_| values are frequently alphanumeric. // Examples: "94043", "SW1W", "SW1W 9TQ". - string16 postal_code_number_; + base::string16 postal_code_number_; // A valid international phone number. If |phone_number_| is a user provided // value, it should have been validated using libphonenumber by clients of // this class before being set; see http://code.google.com/p/libphonenumber/. - string16 phone_number_; + base::string16 phone_number_; // Externalized Online Wallet id for this address. std::string object_id_; diff --git a/components/autofill/browser/wallet/wallet_items.cc b/components/autofill/browser/wallet/wallet_items.cc index 8d7e8c4..6d99c5e 100644 --- a/components/autofill/browser/wallet/wallet_items.cc +++ b/components/autofill/browser/wallet/wallet_items.cc @@ -5,7 +5,7 @@ #include "components/autofill/browser/wallet/wallet_items.h" #include "base/logging.h" -#include "base/string_number_conversions.h" +#include "base/strings/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "components/autofill/browser/autofill_type.h" @@ -83,10 +83,10 @@ WalletItems::MaskedInstrument::Status } // anonymous namespace WalletItems::MaskedInstrument::MaskedInstrument( - const string16& descriptive_name, + const base::string16& descriptive_name, const WalletItems::MaskedInstrument::Type& type, - const std::vector<string16>& supported_currencies, - const string16& last_four_digits, + const std::vector<base::string16>& supported_currencies, + const base::string16& last_four_digits, int expiration_month, int expiration_year, scoped_ptr<Address> address, @@ -118,7 +118,7 @@ scoped_ptr<WalletItems::MaskedInstrument> return scoped_ptr<MaskedInstrument>(); } - string16 last_four_digits; + base::string16 last_four_digits; if (!dictionary.GetString("last_four_digits", &last_four_digits)) { DLOG(ERROR) << "Response from Google Wallet missing last four digits"; return scoped_ptr<MaskedInstrument>(); @@ -151,11 +151,11 @@ scoped_ptr<WalletItems::MaskedInstrument> return scoped_ptr<MaskedInstrument>(); } - std::vector<string16> supported_currencies; + std::vector<base::string16> supported_currencies; const ListValue* supported_currency_list; if (dictionary.GetList("supported_currency", &supported_currency_list)) { for (size_t i = 0; i < supported_currency_list->GetSize(); ++i) { - string16 currency; + base::string16 currency; if (supported_currency_list->GetString(i, ¤cy)) supported_currencies.push_back(currency); } @@ -171,7 +171,7 @@ scoped_ptr<WalletItems::MaskedInstrument> if (!dictionary.GetInteger("expiration_year", &expiration_year)) DVLOG(1) << "Response from Google Wallet missing expiration year"; - string16 descriptive_name; + base::string16 descriptive_name; if (!dictionary.GetString("descriptive_name", &descriptive_name)) DVLOG(1) << "Response from Google Wallet missing descriptive name"; @@ -242,7 +242,7 @@ const WalletItems::MaskedInstrument* WalletItems::GetInstrumentById( return NULL; } -string16 WalletItems::MaskedInstrument::DisplayName() const { +base::string16 WalletItems::MaskedInstrument::DisplayName() const { #if defined(OS_ANDROID) // TODO(aruslan): improve this stub implementation. return descriptive_name(); @@ -251,17 +251,17 @@ string16 WalletItems::MaskedInstrument::DisplayName() const { #endif } -string16 WalletItems::MaskedInstrument::DisplayNameDetail() const { +base::string16 WalletItems::MaskedInstrument::DisplayNameDetail() const { #if defined(OS_ANDROID) // TODO(aruslan): improve this stub implementation. return address().DisplayName(); #else - return string16(); + return base::string16(); #endif } -string16 WalletItems::MaskedInstrument::TypeAndLastFourDigits() const { - string16 display_type; +base::string16 WalletItems::MaskedInstrument::TypeAndLastFourDigits() const { + base::string16 display_type; if (type_ == AMEX) display_type = CreditCard::TypeForDisplay(kAmericanExpressCard); @@ -313,7 +313,7 @@ const gfx::Image& WalletItems::MaskedInstrument::CardIcon() const { return ResourceBundle::GetSharedInstance().GetImageNamed(idr); } -string16 WalletItems::MaskedInstrument::GetInfo( +base::string16 WalletItems::MaskedInstrument::GetInfo( AutofillFieldType type, const std::string& app_locale) const { if (AutofillType(type).group() != AutofillType::CREDIT_CARD) @@ -337,7 +337,7 @@ string16 WalletItems::MaskedInstrument::GetInfo( NOTREACHED(); } - return string16(); + return base::string16(); } WalletItems::LegalDocument::~LegalDocument() {} @@ -351,7 +351,7 @@ scoped_ptr<WalletItems::LegalDocument> return scoped_ptr<LegalDocument>(); } - string16 display_name; + base::string16 display_name; if (!dictionary.GetString("display_name", &display_name)) { DLOG(ERROR) << "Response from Google Wallet missing display name"; return scoped_ptr<LegalDocument>(); @@ -378,13 +378,13 @@ bool WalletItems::LegalDocument::operator!=(const LegalDocument& other) const { } WalletItems::LegalDocument::LegalDocument(const std::string& id, - const string16& display_name) + const base::string16& display_name) : id_(id), url_(kLegalDocumentUrl + id), display_name_(display_name) {} WalletItems::LegalDocument::LegalDocument(const GURL& url, - const string16& display_name) + const base::string16& display_name) : url_(url), display_name_(display_name) {} diff --git a/components/autofill/browser/wallet/wallet_items.h b/components/autofill/browser/wallet/wallet_items.h index f072b79..a437181 100644 --- a/components/autofill/browser/wallet/wallet_items.h +++ b/components/autofill/browser/wallet/wallet_items.h @@ -82,22 +82,22 @@ class WalletItems { // Returns a pair of strings that summarizes this CC, // suitable for display to the user. - string16 DisplayName() const; - string16 DisplayNameDetail() const; + base::string16 DisplayName() const; + base::string16 DisplayNameDetail() const; // Gets info that corresponds with |type|. - string16 GetInfo(AutofillFieldType type, + base::string16 GetInfo(AutofillFieldType type, const std::string& app_locale) const; // Returns the display type of the and last four digits (e.g. Visa - 4444). - string16 TypeAndLastFourDigits() const; + base::string16 TypeAndLastFourDigits() const; - const string16& descriptive_name() const { return descriptive_name_; } + const base::string16& descriptive_name() const { return descriptive_name_; } const Type& type() const { return type_; } - const std::vector<string16>& supported_currencies() const { + const std::vector<base::string16>& supported_currencies() const { return supported_currencies_; } - const string16& last_four_digits() const { return last_four_digits_; } + const base::string16& last_four_digits() const { return last_four_digits_; } int expiration_month() const { return expiration_month_; } int expiration_year() const { return expiration_year_; } const Address& address() const { return *address_; } @@ -112,10 +112,10 @@ class WalletItems { FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateMaskedInstrument); FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateWalletItems); - MaskedInstrument(const string16& descriptve_name, + MaskedInstrument(const base::string16& descriptve_name, const Type& type, - const std::vector<string16>& supported_currencies, - const string16& last_four_digits, + const std::vector<base::string16>& supported_currencies, + const base::string16& last_four_digits, int expiration_month, int expiration_year, scoped_ptr<Address> address, @@ -124,16 +124,16 @@ class WalletItems { // A user-provided description of the instrument. For example, "Google Visa // Card". - string16 descriptive_name_; + base::string16 descriptive_name_; // The payment network of the instrument. For example, Visa. Type type_; // |supported_currencies_| are ISO 4217 currency codes, e.g. USD. - std::vector<string16> supported_currencies_; + std::vector<base::string16> supported_currencies_; // The last four digits of the primary account number of the instrument. - string16 last_four_digits_; + base::string16 last_four_digits_; // |expiration month_| should be 1-12. int expiration_month_; @@ -172,7 +172,7 @@ class WalletItems { const std::string& id() { return id_; } const GURL& url() const { return url_; } - const string16& display_name() const { return display_name_; } + const base::string16& display_name() const { return display_name_; } private: friend class WalletItemsTest; @@ -181,9 +181,9 @@ class WalletItems { FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, LegalDocumentUrl); FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, LegalDocumentEmptyId); LegalDocument(const std::string& id, - const string16& display_name); + const base::string16& display_name); LegalDocument(const GURL& url, - const string16& display_name); + const base::string16& display_name); // Externalized Online Wallet id for the document, or an empty string for // documents not tracked by the server (such as the privacy policy). @@ -191,7 +191,7 @@ class WalletItems { // The human-visitable URL that displays the document. GURL url_; // User displayable name for the document. - string16 display_name_; + base::string16 display_name_; DISALLOW_COPY_AND_ASSIGN(LegalDocument); }; diff --git a/components/autofill/browser/wallet/wallet_items_unittest.cc b/components/autofill/browser/wallet/wallet_items_unittest.cc index 9495d8b..bda43bd 100644 --- a/components/autofill/browser/wallet/wallet_items_unittest.cc +++ b/components/autofill/browser/wallet/wallet_items_unittest.cc @@ -419,7 +419,7 @@ TEST_F(WalletItemsTest, CreateMaskedInstrument) { ASCIIToUTF16("postal_code"), ASCIIToUTF16("phone_number"), std::string())); - std::vector<string16> supported_currencies; + std::vector<base::string16> supported_currencies; supported_currencies.push_back(ASCIIToUTF16("currency")); WalletItems::MaskedInstrument masked_instrument( ASCIIToUTF16("descriptive_name"), @@ -521,7 +521,7 @@ TEST_F(WalletItemsTest, CreateWalletItems) { ASCIIToUTF16("postal_code"), ASCIIToUTF16("phone_number"), std::string())); - std::vector<string16> supported_currencies; + std::vector<base::string16> supported_currencies; supported_currencies.push_back(ASCIIToUTF16("currency")); scoped_ptr<WalletItems::MaskedInstrument> masked_instrument( new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), diff --git a/components/autofill/browser/wallet/wallet_test_util.cc b/components/autofill/browser/wallet/wallet_test_util.cc index 1565408..0326196 100644 --- a/components/autofill/browser/wallet/wallet_test_util.cc +++ b/components/autofill/browser/wallet/wallet_test_util.cc @@ -49,7 +49,7 @@ scoped_ptr<WalletItems::MaskedInstrument> GetTestMaskedInstrument() { return scoped_ptr<WalletItems::MaskedInstrument>( new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), WalletItems::MaskedInstrument::UNKNOWN, - std::vector<string16>(), + std::vector<base::string16>(), ASCIIToUTF16("last_four_digits"), 12, 2012, diff --git a/components/autofill/browser/webdata/autofill_entry.cc b/components/autofill/browser/webdata/autofill_entry.cc index 713f6bc..4d47790 100644 --- a/components/autofill/browser/webdata/autofill_entry.cc +++ b/components/autofill/browser/webdata/autofill_entry.cc @@ -19,7 +19,8 @@ const int64 kExpirationPeriodInDays = 60; AutofillKey::AutofillKey() {} -AutofillKey::AutofillKey(const string16& name, const string16& value) +AutofillKey::AutofillKey(const base::string16& name, + const base::string16& value) : name_(name), value_(value) { } diff --git a/components/autofill/browser/webdata/autofill_entry.h b/components/autofill/browser/webdata/autofill_entry.h index 14509eca..24f2ffa 100644 --- a/components/autofill/browser/webdata/autofill_entry.h +++ b/components/autofill/browser/webdata/autofill_entry.h @@ -15,20 +15,20 @@ class AutofillKey { public: AutofillKey(); - AutofillKey(const string16& name, const string16& value); + AutofillKey(const base::string16& name, const base::string16& value); AutofillKey(const char* name, const char* value); AutofillKey(const AutofillKey& key); virtual ~AutofillKey(); - const string16& name() const { return name_; } - const string16& value() const { return value_; } + const base::string16& name() const { return name_; } + const base::string16& value() const { return value_; } bool operator==(const AutofillKey& key) const; bool operator<(const AutofillKey& key) const; private: - string16 name_; - string16 value_; + base::string16 name_; + base::string16 value_; }; class AutofillEntry { diff --git a/components/autofill/browser/webdata/autofill_table.cc b/components/autofill/browser/webdata/autofill_table.cc index 9b76aae..4078891 100644 --- a/components/autofill/browser/webdata/autofill_table.cc +++ b/components/autofill/browser/webdata/autofill_table.cc @@ -34,7 +34,8 @@ using base::Time; namespace { -typedef std::vector<Tuple3<int64, string16, string16> > AutofillElementList; +typedef std::vector<Tuple3<int64, base::string16, base::string16> > + AutofillElementList; // TODO(dhollowa): Find a common place for this. It is duplicated in // personal_data_manager.cc. @@ -43,7 +44,7 @@ T* address_of(T& v) { return &v; } -string16 LimitDataSize(const string16& data) { +base::string16 LimitDataSize(const base::string16& data) { if (data.size() > AutofillTable::kMaxDataLength) return data.substr(0, AutofillTable::kMaxDataLength); @@ -56,7 +57,7 @@ void BindAutofillProfileToStatement(const AutofillProfile& profile, DCHECK(base::IsValidGUID(profile.guid())); s->BindString(0, profile.guid()); - string16 text = profile.GetRawInfo(COMPANY_NAME); + base::string16 text = profile.GetRawInfo(COMPANY_NAME); s->BindString16(1, LimitDataSize(text)); text = profile.GetRawInfo(ADDRESS_HOME_LINE1); s->BindString16(2, LimitDataSize(text)); @@ -99,7 +100,7 @@ void BindCreditCardToStatement(const CreditCard& credit_card, DCHECK(base::IsValidGUID(credit_card.guid())); s->BindString(0, credit_card.guid()); - string16 text = credit_card.GetRawInfo(CREDIT_CARD_NAME); + base::string16 text = credit_card.GetRawInfo(CREDIT_CARD_NAME); s->BindString16(1, LimitDataSize(text)); text = credit_card.GetRawInfo(CREDIT_CARD_EXP_MONTH); s->BindString16(2, LimitDataSize(text)); @@ -123,7 +124,7 @@ CreditCard* CreditCardFromStatement(const sql::Statement& s) { credit_card->SetRawInfo(CREDIT_CARD_EXP_MONTH, s.ColumnString16(2)); credit_card->SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, s.ColumnString16(3)); int encrypted_number_len = s.ColumnByteLength(4); - string16 credit_card_number; + base::string16 credit_card_number; if (encrypted_number_len) { std::string encrypted_number; encrypted_number.resize(encrypted_number_len); @@ -147,9 +148,9 @@ bool AddAutofillProfileNamesToProfile(sql::Connection* db, if (!s.is_valid()) return false; - std::vector<string16> first_names; - std::vector<string16> middle_names; - std::vector<string16> last_names; + std::vector<base::string16> first_names; + std::vector<base::string16> middle_names; + std::vector<base::string16> last_names; while (s.Step()) { DCHECK_EQ(profile->guid(), s.ColumnString(0)); first_names.push_back(s.ColumnString16(1)); @@ -176,7 +177,7 @@ bool AddAutofillProfileEmailsToProfile(sql::Connection* db, if (!s.is_valid()) return false; - std::vector<string16> emails; + std::vector<base::string16> emails; while (s.Step()) { DCHECK_EQ(profile->guid(), s.ColumnString(0)); emails.push_back(s.ColumnString16(1)); @@ -202,7 +203,7 @@ bool AddAutofillProfilePhonesToProfile(sql::Connection* db, if (!s.is_valid()) return false; - std::vector<string16> numbers; + std::vector<base::string16> numbers; while (s.Step()) { DCHECK_EQ(profile->guid(), s.ColumnString(0)); numbers.push_back(s.ColumnString16(2)); @@ -216,11 +217,11 @@ bool AddAutofillProfilePhonesToProfile(sql::Connection* db, bool AddAutofillProfileNames(const AutofillProfile& profile, sql::Connection* db) { - std::vector<string16> first_names; + std::vector<base::string16> first_names; profile.GetRawMultiInfo(NAME_FIRST, &first_names); - std::vector<string16> middle_names; + std::vector<base::string16> middle_names; profile.GetRawMultiInfo(NAME_MIDDLE, &middle_names); - std::vector<string16> last_names; + std::vector<base::string16> last_names; profile.GetRawMultiInfo(NAME_LAST, &last_names); DCHECK_EQ(first_names.size(), middle_names.size()); DCHECK_EQ(middle_names.size(), last_names.size()); @@ -244,7 +245,7 @@ bool AddAutofillProfileNames(const AutofillProfile& profile, bool AddAutofillProfileEmails(const AutofillProfile& profile, sql::Connection* db) { - std::vector<string16> emails; + std::vector<base::string16> emails; profile.GetRawMultiInfo(EMAIL_ADDRESS, &emails); for (size_t i = 0; i < emails.size(); ++i) { @@ -265,7 +266,7 @@ bool AddAutofillProfileEmails(const AutofillProfile& profile, bool AddAutofillProfilePhones(const AutofillProfile& profile, sql::Connection* db) { - std::vector<string16> numbers; + std::vector<base::string16> numbers; profile.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &numbers); for (size_t i = 0; i < numbers.size(); ++i) { @@ -417,10 +418,11 @@ bool AutofillTable::AddFormFieldValue(const FormFieldData& element, return AddFormFieldValueTime(element, changes, Time::Now()); } -bool AutofillTable::GetFormValuesForElementName(const string16& name, - const string16& prefix, - std::vector<string16>* values, - int limit) { +bool AutofillTable::GetFormValuesForElementName( + const base::string16& name, + const base::string16& prefix, + std::vector<base::string16>* values, + int limit) { DCHECK(values); sql::Statement s; @@ -433,8 +435,8 @@ bool AutofillTable::GetFormValuesForElementName(const string16& name, s.BindString16(0, name); s.BindInt(1, limit); } else { - string16 prefix_lower = base::i18n::ToLower(prefix); - string16 next_prefix = prefix_lower; + base::string16 prefix_lower = base::i18n::ToLower(prefix); + base::string16 next_prefix = prefix_lower; next_prefix[next_prefix.length() - 1]++; s.Assign(db_->GetUniqueStatement( @@ -725,7 +727,7 @@ bool AutofillTable::AddFormFieldValuesTime( // Only add one new entry for each unique element name. Use |seen_names| to // track this. Add up to |kMaximumUniqueNames| unique entries per form. const size_t kMaximumUniqueNames = 256; - std::set<string16> seen_names; + std::set<base::string16> seen_names; bool result = true; for (std::vector<FormFieldData>::const_iterator itr = elements.begin(); itr != elements.end(); ++itr) { @@ -770,7 +772,7 @@ bool AutofillTable::GetAllAutofillEntries(std::vector<AutofillEntry>* entries) { bool first_entry = true; AutofillKey* current_key_ptr = NULL; std::vector<Time>* timestamps_ptr = NULL; - string16 name, value; + base::string16 name, value; Time time; while (s.Step()) { name = s.ColumnString16(0); @@ -813,8 +815,8 @@ bool AutofillTable::GetAllAutofillEntries(std::vector<AutofillEntry>* entries) { return s.Succeeded(); } -bool AutofillTable::GetAutofillTimestamps(const string16& name, - const string16& value, +bool AutofillTable::GetAutofillTimestamps(const base::string16& name, + const base::string16& value, std::vector<Time>* timestamps) { DCHECK(timestamps); sql::Statement s(db_->GetUniqueStatement( @@ -914,8 +916,8 @@ bool AutofillTable::AddFormFieldValueTime(const FormFieldData& element, } -bool AutofillTable::RemoveFormElement(const string16& name, - const string16& value) { +bool AutofillTable::RemoveFormElement(const base::string16& name, + const base::string16& value) { // Find the id for that pair. sql::Statement s(db_->GetUniqueStatement( "SELECT pair_id FROM autofill WHERE name = ? AND value= ?")); @@ -1011,7 +1013,7 @@ bool AutofillTable::UpdateAutofillProfile(const AutofillProfile& profile) { return true; AutofillProfile new_profile(profile); - std::vector<string16> values; + std::vector<base::string16> values; old_profile->GetRawMultiInfo(NAME_FULL, &values); values[0] = new_profile.GetRawInfo(NAME_FULL); @@ -1946,7 +1948,7 @@ bool AutofillTable::MigrateToVersion34ProfilesBasedOnCountryCode() { db_->GetUniqueStatement("UPDATE autofill_profiles " "SET country_code=? WHERE guid=?")); - string16 country = s.ColumnString16(1); + base::string16 country = s.ColumnString16(1); update_s.BindString(0, AutofillCountry::GetCountryCode(country, app_locale_)); update_s.BindString(1, s.ColumnString(0)); diff --git a/components/autofill/browser/webdata/autofill_table.h b/components/autofill/browser/webdata/autofill_table.h index 24afba8..5828a62 100644 --- a/components/autofill/browser/webdata/autofill_table.h +++ b/components/autofill/browser/webdata/autofill_table.h @@ -142,9 +142,9 @@ class AutofillTable : public WebDatabaseTable { // Retrieves a vector of all values which have been recorded in the autofill // table as the value in a form element with name |name| and which start with // |prefix|. The comparison of the prefix is case insensitive. - bool GetFormValuesForElementName(const string16& name, - const string16& prefix, - std::vector<string16>* values, + bool GetFormValuesForElementName(const base::string16& name, + const base::string16& prefix, + std::vector<base::string16>* values, int limit); // Removes rows from autofill_dates if they were created on or after @@ -206,14 +206,15 @@ class AutofillTable : public WebDatabaseTable { bool RemoveFormElementForID(int64 pair_id); // Removes row from the autofill tables for the given |name| |value| pair. - virtual bool RemoveFormElement(const string16& name, const string16& value); + virtual bool RemoveFormElement(const base::string16& name, + const base::string16& value); // Retrieves all of the entries in the autofill table. virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries); // Retrieves a single entry from the autofill table. - virtual bool GetAutofillTimestamps(const string16& name, - const string16& value, + virtual bool GetAutofillTimestamps(const base::string16& name, + const base::string16& value, std::vector<base::Time>* timestamps); // Replaces existing autofill entries with the entries supplied in diff --git a/components/autofill/browser/webdata/autofill_table_unittest.cc b/components/autofill/browser/webdata/autofill_table_unittest.cc index deb2314..1b19489 100644 --- a/components/autofill/browser/webdata/autofill_table_unittest.cc +++ b/components/autofill/browser/webdata/autofill_table_unittest.cc @@ -138,7 +138,7 @@ TEST_F(AutofillTableTest, Autofill) { base::Time now = base::Time::Now(); base::TimeDelta two_seconds = base::TimeDelta::FromSeconds(2); EXPECT_TRUE(table_->AddFormFieldValue(field, &changes)); - std::vector<string16> v; + std::vector<base::string16> v; for (int i = 0; i < 5; i++) { field.value = ASCIIToUTF16("Clark Kent"); EXPECT_TRUE(table_->AddFormFieldValueTime(field, &changes, @@ -183,7 +183,7 @@ TEST_F(AutofillTableTest, Autofill) { // no matter what they start with. The order that the names occur in the list // should be decreasing order by count. EXPECT_TRUE(table_->GetFormValuesForElementName( - ASCIIToUTF16("Name"), string16(), &v, 6)); + ASCIIToUTF16("Name"), base::string16(), &v, 6)); EXPECT_EQ(3U, v.size()); if (v.size() == 3) { EXPECT_EQ(ASCIIToUTF16("Clark Kent"), v[0]); @@ -194,7 +194,7 @@ TEST_F(AutofillTableTest, Autofill) { // If we query again limiting the list size to 1, we should only get the most // frequent entry. EXPECT_TRUE(table_->GetFormValuesForElementName( - ASCIIToUTF16("Name"), string16(), &v, 1)); + ASCIIToUTF16("Name"), base::string16(), &v, 1)); EXPECT_EQ(1U, v.size()); if (v.size() == 1) { EXPECT_EQ(ASCIIToUTF16("Clark Kent"), v[0]); @@ -240,13 +240,13 @@ TEST_F(AutofillTableTest, Autofill) { EXPECT_EQ(0, count); EXPECT_TRUE(table_->GetFormValuesForElementName( - ASCIIToUTF16("Name"), string16(), &v, 6)); + ASCIIToUTF16("Name"), base::string16(), &v, 6)); EXPECT_EQ(0U, v.size()); // Now add some values with empty strings. - const string16 kValue = ASCIIToUTF16(" toto "); + const base::string16 kValue = ASCIIToUTF16(" toto "); field.name = ASCIIToUTF16("blank"); - field.value = string16(); + field.value = base::string16(); EXPECT_TRUE(table_->AddFormFieldValue(field, &changes)); field.name = ASCIIToUTF16("blank"); field.value = ASCIIToUTF16(" "); @@ -262,7 +262,7 @@ TEST_F(AutofillTableTest, Autofill) { // values. v.clear(); EXPECT_TRUE(table_->GetFormValuesForElementName( - ASCIIToUTF16("blank"), string16(), &v, 10)); + ASCIIToUTF16("blank"), base::string16(), &v, 10)); EXPECT_EQ(4U, v.size()); // Now we'll check that ClearAutofillEmptyValueElements() works as expected. @@ -270,7 +270,7 @@ TEST_F(AutofillTableTest, Autofill) { v.clear(); EXPECT_TRUE(table_->GetFormValuesForElementName( - ASCIIToUTF16("blank"), string16(), &v, 10)); + ASCIIToUTF16("blank"), base::string16(), &v, 10)); ASSERT_EQ(1U, v.size()); EXPECT_EQ(kValue, v[0]); @@ -616,9 +616,9 @@ TEST_F(AutofillTableTest, AutofillProfile) { TEST_F(AutofillTableTest, AutofillProfileMultiValueNames) { AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("John Doe")); - const string16 kJohnPDoe(ASCIIToUTF16("John P. Doe")); - std::vector<string16> set_values; + const base::string16 kJohnDoe(ASCIIToUTF16("John Doe")); + const base::string16 kJohnPDoe(ASCIIToUTF16("John P. Doe")); + std::vector<base::string16> set_values; set_values.push_back(kJohnDoe); set_values.push_back(kJohnPDoe); p.SetRawMultiInfo(NAME_FULL, set_values); @@ -632,7 +632,7 @@ TEST_F(AutofillTableTest, AutofillProfileMultiValueNames) { delete db_profile; // Update the values. - const string16 kNoOne(ASCIIToUTF16("No One")); + const base::string16 kNoOne(ASCIIToUTF16("No One")); set_values[1] = kNoOne; p.SetRawMultiInfo(NAME_FULL, set_values); EXPECT_TRUE(table_->UpdateAutofillProfileMulti(p)); @@ -648,15 +648,15 @@ TEST_F(AutofillTableTest, AutofillProfileMultiValueNames) { ASSERT_TRUE(table_->GetAutofillProfile(p.guid(), &db_profile)); EXPECT_EQ(p, *db_profile); EXPECT_EQ(0, p.Compare(*db_profile)); - EXPECT_EQ(string16(), db_profile->GetRawInfo(NAME_FULL)); + EXPECT_EQ(base::string16(), db_profile->GetRawInfo(NAME_FULL)); delete db_profile; } TEST_F(AutofillTableTest, AutofillProfileSingleValue) { AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("John Doe")); - const string16 kJohnPDoe(ASCIIToUTF16("John P. Doe")); - std::vector<string16> set_values; + const base::string16 kJohnDoe(ASCIIToUTF16("John Doe")); + const base::string16 kJohnPDoe(ASCIIToUTF16("John P. Doe")); + std::vector<base::string16> set_values; set_values.push_back(kJohnDoe); set_values.push_back(kJohnPDoe); p.SetRawMultiInfo(NAME_FULL, set_values); @@ -669,7 +669,7 @@ TEST_F(AutofillTableTest, AutofillProfileSingleValue) { EXPECT_EQ(0, p.Compare(*db_profile)); delete db_profile; - const string16 kNoOne(ASCIIToUTF16("No One")); + const base::string16 kNoOne(ASCIIToUTF16("No One")); set_values.resize(1); set_values[0] = kNoOne; p.SetRawMultiInfo(NAME_FULL, set_values); @@ -687,9 +687,9 @@ TEST_F(AutofillTableTest, AutofillProfileSingleValue) { TEST_F(AutofillTableTest, AutofillProfileMultiValueEmails) { AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("john@doe.com")); - const string16 kJohnPDoe(ASCIIToUTF16("john_p@doe.com")); - std::vector<string16> set_values; + const base::string16 kJohnDoe(ASCIIToUTF16("john@doe.com")); + const base::string16 kJohnPDoe(ASCIIToUTF16("john_p@doe.com")); + std::vector<base::string16> set_values; set_values.push_back(kJohnDoe); set_values.push_back(kJohnPDoe); p.SetRawMultiInfo(EMAIL_ADDRESS, set_values); @@ -703,7 +703,7 @@ TEST_F(AutofillTableTest, AutofillProfileMultiValueEmails) { delete db_profile; // Update the values. - const string16 kNoOne(ASCIIToUTF16("no@one.com")); + const base::string16 kNoOne(ASCIIToUTF16("no@one.com")); set_values[1] = kNoOne; p.SetRawMultiInfo(EMAIL_ADDRESS, set_values); EXPECT_TRUE(table_->UpdateAutofillProfileMulti(p)); @@ -719,15 +719,15 @@ TEST_F(AutofillTableTest, AutofillProfileMultiValueEmails) { ASSERT_TRUE(table_->GetAutofillProfile(p.guid(), &db_profile)); EXPECT_EQ(p, *db_profile); EXPECT_EQ(0, p.Compare(*db_profile)); - EXPECT_EQ(string16(), db_profile->GetRawInfo(EMAIL_ADDRESS)); + EXPECT_EQ(base::string16(), db_profile->GetRawInfo(EMAIL_ADDRESS)); delete db_profile; } TEST_F(AutofillTableTest, AutofillProfileMultiValuePhone) { AutofillProfile p; - const string16 kJohnDoe(ASCIIToUTF16("4151112222")); - const string16 kJohnPDoe(ASCIIToUTF16("4151113333")); - std::vector<string16> set_values; + const base::string16 kJohnDoe(ASCIIToUTF16("4151112222")); + const base::string16 kJohnPDoe(ASCIIToUTF16("4151113333")); + std::vector<base::string16> set_values; set_values.push_back(kJohnDoe); set_values.push_back(kJohnPDoe); p.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, set_values); @@ -741,7 +741,7 @@ TEST_F(AutofillTableTest, AutofillProfileMultiValuePhone) { delete db_profile; // Update the values. - const string16 kNoOne(ASCIIToUTF16("4151110000")); + const base::string16 kNoOne(ASCIIToUTF16("4151110000")); set_values[1] = kNoOne; p.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, set_values); EXPECT_TRUE(table_->UpdateAutofillProfileMulti(p)); @@ -757,7 +757,7 @@ TEST_F(AutofillTableTest, AutofillProfileMultiValuePhone) { ASSERT_TRUE(table_->GetAutofillProfile(p.guid(), &db_profile)); EXPECT_EQ(p, *db_profile); EXPECT_EQ(0, p.Compare(*db_profile)); - EXPECT_EQ(string16(), db_profile->GetRawInfo(EMAIL_ADDRESS)); + EXPECT_EQ(base::string16(), db_profile->GetRawInfo(EMAIL_ADDRESS)); delete db_profile; } diff --git a/components/autofill/browser/webdata/autofill_webdata.h b/components/autofill/browser/webdata/autofill_webdata.h index 58f683b..9576d0c 100644 --- a/components/autofill/browser/webdata/autofill_webdata.h +++ b/components/autofill/browser/webdata/autofill_webdata.h @@ -33,8 +33,8 @@ class AutofillWebData { // |consumer| gets called back when the request is finished, with the vector // included in the argument |result|. virtual WebDataServiceBase::Handle GetFormValuesForElementName( - const string16& name, - const string16& prefix, + const base::string16& name, + const base::string16& prefix, int limit, WebDataServiceConsumer* consumer) = 0; @@ -43,8 +43,8 @@ class AutofillWebData { const base::Time& delete_begin, const base::Time& delete_end) = 0; virtual void RemoveExpiredFormElements() = 0; - virtual void RemoveFormValueForElementName(const string16& name, - const string16& value) = 0; + virtual void RemoveFormValueForElementName(const base::string16& name, + const base::string16& value) = 0; // Schedules a task to add an Autofill profile to the web database. virtual void AddAutofillProfile(const AutofillProfile& profile) = 0; diff --git a/components/autofill/browser/webdata/autofill_webdata_service.cc b/components/autofill/browser/webdata/autofill_webdata_service.cc index 2ec7f4d..c61e032 100644 --- a/components/autofill/browser/webdata/autofill_webdata_service.cc +++ b/components/autofill/browser/webdata/autofill_webdata_service.cc @@ -52,7 +52,7 @@ void AutofillWebDataService::AddFormFields( } WebDataServiceBase::Handle AutofillWebDataService::GetFormValuesForElementName( - const string16& name, const string16& prefix, int limit, + const base::string16& name, const base::string16& prefix, int limit, WebDataServiceConsumer* consumer) { return wdbs_->ScheduleDBTaskWithResult(FROM_HERE, Bind(&AutofillWebDataService::GetFormValuesForElementNameImpl, @@ -72,7 +72,7 @@ void AutofillWebDataService::RemoveExpiredFormElements() { } void AutofillWebDataService::RemoveFormValueForElementName( - const string16& name, const string16& value) { + const base::string16& name, const base::string16& value) { wdbs_->ScheduleDBTask(FROM_HERE, Bind(&AutofillWebDataService::RemoveFormValueForElementNameImpl, this, name, value)); @@ -199,13 +199,15 @@ WebDatabase::State AutofillWebDataService::AddFormElementsImpl( scoped_ptr<WDTypedResult> AutofillWebDataService::GetFormValuesForElementNameImpl( - const string16& name, const string16& prefix, int limit, WebDatabase* db) { + const base::string16& name, const base::string16& prefix, int limit, + WebDatabase* db) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); - std::vector<string16> values; + std::vector<base::string16> values; AutofillTable::FromWebDatabase(db)->GetFormValuesForElementName( name, prefix, &values, limit); return scoped_ptr<WDTypedResult>( - new WDResult<std::vector<string16> >(AUTOFILL_VALUE_RESULT, values)); + new WDResult<std::vector<base::string16> >(AUTOFILL_VALUE_RESULT, + values)); } WebDatabase::State AutofillWebDataService::RemoveFormElementsAddedBetweenImpl( @@ -249,7 +251,7 @@ WebDatabase::State AutofillWebDataService::RemoveExpiredFormElementsImpl( } WebDatabase::State AutofillWebDataService::RemoveFormValueForElementNameImpl( - const string16& name, const string16& value, WebDatabase* db) { + const base::string16& name, const base::string16& value, WebDatabase* db) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); if (AutofillTable::FromWebDatabase(db)->RemoveFormElement(name, value)) { diff --git a/components/autofill/browser/webdata/autofill_webdata_service.h b/components/autofill/browser/webdata/autofill_webdata_service.h index f1573fd..3907057 100644 --- a/components/autofill/browser/webdata/autofill_webdata_service.h +++ b/components/autofill/browser/webdata/autofill_webdata_service.h @@ -53,15 +53,16 @@ class AutofillWebDataService : public AutofillWebData, virtual void AddFormFields( const std::vector<FormFieldData>& fields) OVERRIDE; virtual WebDataServiceBase::Handle GetFormValuesForElementName( - const string16& name, - const string16& prefix, + const base::string16& name, + const base::string16& prefix, int limit, WebDataServiceConsumer* consumer) OVERRIDE; virtual void RemoveFormElementsAddedBetween( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; virtual void RemoveExpiredFormElements() OVERRIDE; - virtual void RemoveFormValueForElementName(const string16& name, - const string16& value) OVERRIDE; + virtual void RemoveFormValueForElementName( + const base::string16& name, + const base::string16& value) OVERRIDE; virtual void AddAutofillProfile(const AutofillProfile& profile) OVERRIDE; virtual void UpdateAutofillProfile(const AutofillProfile& profile) OVERRIDE; virtual void RemoveAutofillProfile(const std::string& guid) OVERRIDE; @@ -91,13 +92,14 @@ class AutofillWebDataService : public AutofillWebData, WebDatabase::State AddFormElementsImpl( const std::vector<FormFieldData>& fields, WebDatabase* db); scoped_ptr<WDTypedResult> GetFormValuesForElementNameImpl( - const string16& name, const string16& prefix, int limit, WebDatabase* db); + const base::string16& name, const base::string16& prefix, int limit, + WebDatabase* db); WebDatabase::State RemoveFormElementsAddedBetweenImpl( const base::Time& delete_begin, const base::Time& delete_end, WebDatabase* db); WebDatabase::State RemoveExpiredFormElementsImpl(WebDatabase* db); WebDatabase::State RemoveFormValueForElementNameImpl( - const string16& name, const string16& value, WebDatabase* db); + const base::string16& name, const base::string16& value, WebDatabase* db); WebDatabase::State AddAutofillProfileImpl( const AutofillProfile& profile, WebDatabase* db); WebDatabase::State UpdateAutofillProfileImpl( diff --git a/components/autofill/browser/webdata/web_data_service_unittest.cc b/components/autofill/browser/webdata/web_data_service_unittest.cc index a933925..f62f560 100644 --- a/components/autofill/browser/webdata/web_data_service_unittest.cc +++ b/components/autofill/browser/webdata/web_data_service_unittest.cc @@ -149,8 +149,8 @@ class WebDataServiceAutofillTest : public WebDataServiceTest { WebDataServiceTest::TearDown(); } - void AppendFormField(const string16& name, - const string16& value, + void AppendFormField(const base::string16& name, + const base::string16& value, std::vector<FormFieldData>* form_fields) { FormFieldData field; field.name = name; @@ -158,10 +158,10 @@ class WebDataServiceAutofillTest : public WebDataServiceTest { form_fields->push_back(field); } - string16 name1_; - string16 name2_; - string16 value1_; - string16 value2_; + base::string16 name1_; + base::string16 name2_; + base::string16 value1_; + base::string16 value2_; int unique_id1_, unique_id2_; const TimeDelta test_timeout_; testing::NiceMock<MockAutofillWebDataServiceObserver> observer_; @@ -215,11 +215,11 @@ TEST_F(WebDataServiceAutofillTest, FormFillAdd) { // The event will be signaled when the mock observer is notified. done_event_.TimedWait(test_timeout_); - AutofillWebDataServiceConsumer<std::vector<string16> > consumer; + AutofillWebDataServiceConsumer<std::vector<base::string16> > consumer; WebDataService::Handle handle; static const int limit = 10; handle = wds_->GetFormValuesForElementName( - name1_, string16(), limit, &consumer); + name1_, base::string16(), limit, &consumer); // The message loop will exit when the consumer is called. MessageLoop::current()->Run(); diff --git a/components/autofill/common/autofill_messages.h b/components/autofill/common/autofill_messages.h index 7a35b17..56fc84a 100644 --- a/components/autofill/common/autofill_messages.h +++ b/components/autofill/common/autofill_messages.h @@ -91,9 +91,9 @@ IPC_MESSAGE_ROUTED0(AutofillMsg_GetAllForms) // Autofill suggestions. IPC_MESSAGE_ROUTED5(AutofillMsg_SuggestionsReturned, int /* id of the request message */, - std::vector<string16> /* names */, - std::vector<string16> /* labels */, - std::vector<string16> /* icons */, + std::vector<base::string16> /* names */, + std::vector<base::string16> /* labels */, + std::vector<base::string16> /* icons */, std::vector<int> /* unique_ids */) // Reply to the AutofillHostMsg_FillAutofillFormData message with the @@ -128,16 +128,16 @@ IPC_MESSAGE_ROUTED0(AutofillMsg_ClearPreviewedForm) // Sets the currently selected node's value. IPC_MESSAGE_ROUTED1(AutofillMsg_SetNodeText, - string16 /* new node text */) + base::string16 /* new node text */) // Sets the currently selected node's value to be the given data list value. IPC_MESSAGE_ROUTED1(AutofillMsg_AcceptDataListSuggestion, - string16 /* accepted data list value */) + base::string16 /* accepted data list value */) // Tells the renderer to populate the correct password fields with this // generated password. IPC_MESSAGE_ROUTED1(AutofillMsg_GeneratedPasswordAccepted, - string16 /* generated_password */) + base::string16 /* generated_password */) // Tells the renderer whether password generation is enabled. IPC_MESSAGE_ROUTED1(AutofillMsg_PasswordGenerationEnabled, @@ -145,7 +145,7 @@ IPC_MESSAGE_ROUTED1(AutofillMsg_PasswordGenerationEnabled, // Tells the renderer that the password field has accept the suggestion. IPC_MESSAGE_ROUTED1(AutofillMsg_AcceptPasswordAutofillSuggestion, - string16 /* username value*/) + base::string16 /* username value*/) // Tells the renderer that this password form is not blacklisted. A form can // be blacklisted if a user chooses "never save passwords for this site". @@ -242,8 +242,8 @@ IPC_MESSAGE_ROUTED2(AutofillHostMsg_RequestAutocomplete, // Instructs the browser to remove the specified Autocomplete entry from the // database. IPC_MESSAGE_ROUTED2(AutofillHostMsg_RemoveAutocompleteEntry, - string16 /* field name */, - string16 /* value */) + base::string16 /* field name */, + base::string16 /* value */) // Instructs the browser to show the Autofill dialog. IPC_MESSAGE_ROUTED0(AutofillHostMsg_ShowAutofillDialog) @@ -278,11 +278,11 @@ IPC_MESSAGE_ROUTED2(AutofillHostMsg_AddPasswordFormMapping, IPC_MESSAGE_ROUTED3(AutofillHostMsg_ShowPasswordSuggestions, FormFieldData /* the form field */, gfx::RectF /* input field bounds, window-relative */, - std::vector<string16> /* suggestions */) + std::vector<base::string16> /* suggestions */) // Inform browser of data list values for the curent field. IPC_MESSAGE_ROUTED4(AutofillHostMsg_SetDataList, - std::vector<string16> /* values */, - std::vector<string16> /* labels */, - std::vector<string16> /* icons */, + std::vector<base::string16> /* values */, + std::vector<base::string16> /* labels */, + std::vector<base::string16> /* icons */, std::vector<int> /* unique ids */) diff --git a/components/autofill/common/form_data.h b/components/autofill/common/form_data.h index 01ab98a..8d683be 100644 --- a/components/autofill/common/form_data.h +++ b/components/autofill/common/form_data.h @@ -23,9 +23,9 @@ struct FormData { bool operator!=(const FormData& form) const; // The name of the form. - string16 name; + base::string16 name; // GET or POST. - string16 method; + base::string16 method; // The URL (minus query parameters) containing the form. GURL origin; // The action target of the form. diff --git a/components/autofill/common/form_field_data.h b/components/autofill/common/form_field_data.h index 6d0d2f6..f77c85d 100644 --- a/components/autofill/common/form_field_data.h +++ b/components/autofill/common/form_field_data.h @@ -23,9 +23,9 @@ struct FormFieldData { // Comparison operator exposed for STL map. Uses label, then name to sort. bool operator<(const FormFieldData& field) const; - string16 label; - string16 name; - string16 value; + base::string16 label; + base::string16 name; + base::string16 value; std::string form_control_type; std::string autocomplete_attribute; size_t max_length; @@ -37,8 +37,8 @@ struct FormFieldData { // For the HTML snippet |<option value="US">United States</option>|, the // value is "US" and the contents are "United States". - std::vector<string16> option_values; - std::vector<string16> option_contents; + std::vector<base::string16> option_values; + std::vector<base::string16> option_contents; }; // So we can compare FormFieldDatas with EXPECT_EQ(). diff --git a/components/autofill/common/password_form_fill_data.h b/components/autofill/common/password_form_fill_data.h index 01985df..90a5ebd 100644 --- a/components/autofill/common/password_form_fill_data.h +++ b/components/autofill/common/password_form_fill_data.h @@ -21,7 +21,7 @@ // associated with this form. This can happen, for example, if action URI's // of the observed form and our saved representation don't match up. struct PasswordFormFillData { - typedef std::map<string16, string16> LoginCollection; + typedef std::map<base::string16, base::string16> LoginCollection; FormData basic_data; LoginCollection additional_logins; diff --git a/components/autofill/renderer/autofill_agent.cc b/components/autofill/renderer/autofill_agent.cc index f32896b..cea773d 100644 --- a/components/autofill/renderer/autofill_agent.cc +++ b/components/autofill/renderer/autofill_agent.cc @@ -66,18 +66,18 @@ const size_t kMaximumDataListSizeForAutofill = 30; const int kAutocheckoutClickTimeout = 3; void AppendDataListSuggestions(const WebKit::WebInputElement& element, - std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, + std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<int>* item_ids) { WebNodeCollection options = element.dataListOptions(); if (options.isNull()) return; - string16 prefix = element.editingValue(); + base::string16 prefix = element.editingValue(); if (element.isMultiple() && element.formControlType() == WebString::fromUTF8("email")) { - std::vector<string16> parts; + std::vector<base::string16> parts; base::SplitStringDontTrim(prefix, ',', &parts); if (parts.size() > 0) TrimWhitespace(parts[parts.size() - 1], TRIM_LEADING, &prefix); @@ -93,17 +93,17 @@ void AppendDataListSuggestions(const WebKit::WebInputElement& element, if (option.value() != option.label()) labels->push_back(option.label()); else - labels->push_back(string16()); - icons->push_back(string16()); + labels->push_back(base::string16()); + icons->push_back(base::string16()); item_ids->push_back(WebAutofillClient::MenuItemIDDataListEntry); } } // Trim the vectors before sending them to the browser process to ensure we // don't send too much data through the IPC. -void TrimDataListsForIPC(std::vector<string16>* values, - std::vector<string16>* labels, - std::vector<string16>* icons, +void TrimDataListsForIPC(std::vector<base::string16>* values, + std::vector<base::string16>* labels, + std::vector<base::string16>* icons, std::vector<int>* unique_ids) { // Limit the size of the vectors. if (values->size() > kMaximumDataListSizeForAutofill) { @@ -495,27 +495,28 @@ void AutofillAgent::textFieldDidReceiveKeyDown(const WebInputElement& element, ShowSuggestions(element, true, true, true); } -void AutofillAgent::OnSuggestionsReturned(int query_id, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, - const std::vector<int>& unique_ids) { +void AutofillAgent::OnSuggestionsReturned( + int query_id, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, + const std::vector<int>& unique_ids) { if (query_id != autofill_query_id_) return; if (element_.isNull() || !element_.isFocusable()) return; - std::vector<string16> v(values); - std::vector<string16> l(labels); - std::vector<string16> i(icons); + std::vector<base::string16> v(values); + std::vector<base::string16> l(labels); + std::vector<base::string16> i(icons); std::vector<int> ids(unique_ids); if (!element_.autoComplete() && !v.empty()) { // If autofill is disabled and we had suggestions, show a warning instead. v.assign(1, l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED)); - l.assign(1, string16()); - i.assign(1, string16()); + l.assign(1, base::string16()); + i.assign(1, base::string16()); ids.assign(1, WebAutofillClient::MenuItemIDWarningMessage); } else if (ids.size() > 1 && ids[0] == WebAutofillClient::MenuItemIDWarningMessage) { @@ -547,24 +548,24 @@ void AutofillAgent::OnSuggestionsReturned(int query_id, } if (has_autofill_item) { - v.push_back(string16()); - l.push_back(string16()); - i.push_back(string16()); + v.push_back(base::string16()); + l.push_back(base::string16()); + i.push_back(base::string16()); ids.push_back(WebAutofillClient::MenuItemIDSeparator); if (FormWithElementIsAutofilled(element_)) { // The form has been auto-filled, so give the user the chance to clear the // form. Append the 'Clear form' menu item. v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_CLEAR_FORM_MENU_ITEM)); - l.push_back(string16()); - i.push_back(string16()); + l.push_back(base::string16()); + i.push_back(base::string16()); ids.push_back(WebAutofillClient::MenuItemIDClearForm); } // Append the 'Chrome Autofill options' menu item; v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS_POPUP)); - l.push_back(string16()); - i.push_back(string16()); + l.push_back(base::string16()); + i.push_back(base::string16()); ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions); } @@ -573,14 +574,14 @@ void AutofillAgent::OnSuggestionsReturned(int query_id, void AutofillAgent::CombineDataListEntriesAndShow( const WebKit::WebInputElement& element, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& item_ids, bool has_autofill_item) { - std::vector<string16> v; - std::vector<string16> l; - std::vector<string16> i; + std::vector<base::string16> v; + std::vector<base::string16> l; + std::vector<base::string16> i; std::vector<int> ids; AppendDataListSuggestions(element, &v, &l, &i, &ids); @@ -588,9 +589,9 @@ void AutofillAgent::CombineDataListEntriesAndShow( // If there are both <datalist> items and Autofill suggestions, add a // separator between them. if (!v.empty() && !values.empty()) { - v.push_back(string16()); - l.push_back(string16()); - i.push_back(string16()); + v.push_back(base::string16()); + l.push_back(base::string16()); + i.push_back(base::string16()); ids.push_back(WebAutofillClient::MenuItemIDSeparator); } @@ -619,19 +620,20 @@ void AutofillAgent::CombineDataListEntriesAndShow( has_shown_autofill_popup_for_current_edit_ |= has_autofill_item; } -void AutofillAgent::AcceptDataListSuggestion(const string16& suggested_value) { - string16 new_value = suggested_value; +void AutofillAgent::AcceptDataListSuggestion( + const base::string16& suggested_value) { + base::string16 new_value = suggested_value; // If this element takes multiple values then replace the last part with // the suggestion. if (element_.isMultiple() && element_.formControlType() == WebString::fromUTF8("email")) { - std::vector<string16> parts; + std::vector<base::string16> parts; base::SplitStringDontTrim(element_.editingValue(), ',', &parts); if (parts.size() == 0) - parts.push_back(string16()); + parts.push_back(base::string16()); - string16 last_part = parts.back(); + base::string16 last_part = parts.back(); // We want to keep just the leading whitespace. for (size_t i = 0; i < last_part.size(); ++i) { if (!IsWhitespace(last_part[i])) { @@ -693,15 +695,16 @@ void AutofillAgent::OnClearPreviewedForm() { didClearAutofillSelection(element_); } -void AutofillAgent::OnSetNodeText(const string16& value) { +void AutofillAgent::OnSetNodeText(const base::string16& value) { SetNodeText(value, &element_); } -void AutofillAgent::OnAcceptDataListSuggestion(const string16& value) { +void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) { AcceptDataListSuggestion(value); } -void AutofillAgent::OnAcceptPasswordAutofillSuggestion(const string16& value) { +void AutofillAgent::OnAcceptPasswordAutofillSuggestion( + const base::string16& value) { // We need to make sure this is handled here because the browser process // skipped it handling because it believed it would be handled here. If it // isn't handled here then the browser logic needs to be updated. @@ -813,12 +816,13 @@ void AutofillAgent::ShowSuggestions(const WebInputElement& element, // as it does not allow us to distinguish the case where autocomplete is // disabled for *both* the element and for the form. // Also, if the field has no name, then we won't have values. - const string16 autocomplete_attribute = element.getAttribute("autocomplete"); + const base::string16 autocomplete_attribute = + element.getAttribute("autocomplete"); if (LowerCaseEqualsASCII(autocomplete_attribute, "off") || element.nameForAutofill().isEmpty()) { - CombineDataListEntriesAndShow(element, std::vector<string16>(), - std::vector<string16>(), - std::vector<string16>(), + CombineDataListEntriesAndShow(element, std::vector<base::string16>(), + std::vector<base::string16>(), + std::vector<base::string16>(), std::vector<int>(), false); return; } @@ -858,9 +862,9 @@ void AutofillAgent::QueryAutofillSuggestions(const WebInputElement& element, GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_); // Find the datalist values and send them to the browser process. - std::vector<string16> data_list_values; - std::vector<string16> data_list_labels; - std::vector<string16> data_list_icons; + std::vector<base::string16> data_list_values; + std::vector<base::string16> data_list_labels; + std::vector<base::string16> data_list_icons; std::vector<int> data_list_unique_ids; AppendDataListSuggestions(element_, &data_list_values, @@ -911,10 +915,10 @@ void AutofillAgent::FillAutofillFormData(const WebNode& node, routing_id(), autofill_query_id_, form, field, unique_id)); } -void AutofillAgent::SetNodeText(const string16& value, +void AutofillAgent::SetNodeText(const base::string16& value, WebKit::WebInputElement* node) { did_set_node_text_ = true; - string16 substring = value; + base::string16 substring = value; substring = substring.substr(0, node->maxLength()); node->setEditingValue(substring); diff --git a/components/autofill/renderer/autofill_agent.h b/components/autofill/renderer/autofill_agent.h index 5df4b8e..998125b 100644 --- a/components/autofill/renderer/autofill_agent.h +++ b/components/autofill/renderer/autofill_agent.h @@ -105,9 +105,9 @@ class AutofillAgent : public content::RenderViewObserver, virtual void setIgnoreTextChanges(bool ignore) OVERRIDE; void OnSuggestionsReturned(int query_id, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& unique_ids); void OnFormDataFilled(int query_id, const FormData& form); void OnFieldTypePredictionsAvailable( @@ -118,9 +118,9 @@ class AutofillAgent : public content::RenderViewObserver, void OnClearForm(); void OnSetAutofillActionPreview(); void OnClearPreviewedForm(); - void OnSetNodeText(const string16& value); - void OnAcceptDataListSuggestion(const string16& value); - void OnAcceptPasswordAutofillSuggestion(const string16& value); + void OnSetNodeText(const base::string16& value); + void OnAcceptDataListSuggestion(const base::string16& value); + void OnAcceptPasswordAutofillSuggestion(const base::string16& value); void OnGetAllForms(); // Called when interactive autocomplete finishes. @@ -173,14 +173,14 @@ class AutofillAgent : public content::RenderViewObserver, // Combines DataList suggestion entries with the autofill ones and show them // to the user. void CombineDataListEntriesAndShow(const WebKit::WebInputElement& element, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, + const std::vector<base::string16>& values, + const std::vector<base::string16>& labels, + const std::vector<base::string16>& icons, const std::vector<int>& item_ids, bool has_autofill_item); // Sets the element value to reflect the selected |suggested_value|. - void AcceptDataListSuggestion(const string16& suggested_value); + void AcceptDataListSuggestion(const base::string16& suggested_value); // Queries the AutofillManager for form data for the form containing |node|. // |value| is the current text in the field, and |unique_id| is the selected @@ -198,7 +198,7 @@ class AutofillAgent : public content::RenderViewObserver, FormFieldData* field) WARN_UNUSED_RESULT; // Set |node| to display the given |value|. - void SetNodeText(const string16& value, WebKit::WebInputElement* node); + void SetNodeText(const base::string16& value, WebKit::WebInputElement* node); // Hides any currently showing Autofill UI in the renderer or browser. void HideAutofillUi(); diff --git a/components/autofill/renderer/form_autofill_util.cc b/components/autofill/renderer/form_autofill_util.cc index a0bbc43..2d255df 100644 --- a/components/autofill/renderer/form_autofill_util.cc +++ b/components/autofill/renderer/form_autofill_util.cc @@ -104,15 +104,16 @@ bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) { // * CombineAndCollapseWhitespace("foo ", " bar", false) -> "foo bar" // * CombineAndCollapseWhitespace(" foo", "bar ", false) -> " foobar " // * CombineAndCollapseWhitespace(" foo", "bar ", true) -> " foo bar " -const string16 CombineAndCollapseWhitespace(const string16& prefix, - const string16& suffix, - bool force_whitespace) { - string16 prefix_trimmed; +const base::string16 CombineAndCollapseWhitespace( + const base::string16& prefix, + const base::string16& suffix, + bool force_whitespace) { + base::string16 prefix_trimmed; TrimPositions prefix_trailing_whitespace = TrimWhitespace(prefix, TRIM_TRAILING, &prefix_trimmed); // Recursively compute the children's text. - string16 suffix_trimmed; + base::string16 suffix_trimmed; TrimPositions suffix_leading_whitespace = TrimWhitespace(suffix, TRIM_LEADING, &suffix_trimmed); @@ -126,9 +127,9 @@ const string16 CombineAndCollapseWhitespace(const string16& prefix, // This is a helper function for the FindChildText() function (see below). // Search depth is limited with the |depth| parameter. -string16 FindChildTextInner(const WebNode& node, int depth) { +base::string16 FindChildTextInner(const WebNode& node, int depth) { if (depth <= 0 || node.isNull()) - return string16(); + return base::string16(); // Skip over comments. if (node.nodeType() == WebNode::CommentNode) @@ -136,7 +137,7 @@ string16 FindChildTextInner(const WebNode& node, int depth) { if (node.nodeType() != WebNode::ElementNode && node.nodeType() != WebNode::TextNode) - return string16(); + return base::string16(); // Ignore elements known not to contain inferable labels. if (node.isElementNode()) { @@ -146,22 +147,23 @@ string16 FindChildTextInner(const WebNode& node, int depth) { IsNoScriptElement(element) || (element.isFormControlElement() && IsAutofillableElement(element.toConst<WebFormControlElement>()))) { - return string16(); + return base::string16(); } } // Extract the text exactly at this node. - string16 node_text = node.nodeValue(); + base::string16 node_text = node.nodeValue(); // Recursively compute the children's text. // Preserve inter-element whitespace separation. - string16 child_text = FindChildTextInner(node.firstChild(), depth - 1); + base::string16 child_text = FindChildTextInner(node.firstChild(), depth - 1); bool add_space = node.nodeType() == WebNode::TextNode && node_text.empty(); node_text = CombineAndCollapseWhitespace(node_text, child_text, add_space); // Recursively compute the siblings' text. // Again, preserve inter-element whitespace separation. - string16 sibling_text = FindChildTextInner(node.nextSibling(), depth - 1); + base::string16 sibling_text = + FindChildTextInner(node.nextSibling(), depth - 1); add_space = node.nodeType() == WebNode::TextNode && node_text.empty(); node_text = CombineAndCollapseWhitespace(node_text, sibling_text, add_space); @@ -174,14 +176,14 @@ string16 FindChildTextInner(const WebNode& node, int depth) { // used when the structure is not directly known. However, unlike with // |innerText()|, the search depth and breadth are limited to a fixed threshold. // Whitespace is trimmed from text accumulated at descendant nodes. -string16 FindChildText(const WebNode& node) { +base::string16 FindChildText(const WebNode& node) { if (node.isTextNode()) return node.nodeValue(); WebNode child = node.firstChild(); const int kChildSearchDepth = 10; - string16 node_text = FindChildTextInner(child, kChildSearchDepth); + base::string16 node_text = FindChildTextInner(child, kChildSearchDepth); TrimWhitespace(node_text, TRIM_ALL, &node_text); return node_text; } @@ -194,8 +196,8 @@ string16 FindChildText(const WebNode& node) { // or <label>Some Text</label> <input ...> // or Some Text <img><input ...> // or <b>Some Text</b><br/> <input ...>. -string16 InferLabelFromPrevious(const WebFormControlElement& element) { - string16 inferred_label; +base::string16 InferLabelFromPrevious(const WebFormControlElement& element) { + base::string16 inferred_label; WebNode previous = element; while (true) { previous = previous.previousSibling(); @@ -223,7 +225,7 @@ string16 InferLabelFromPrevious(const WebFormControlElement& element) { if (previous.isTextNode() || HasTagName(previous, kBold) || HasTagName(previous, kStrong) || HasTagName(previous, kSpan) || HasTagName(previous, kFont)) { - string16 value = FindChildText(previous); + base::string16 value = FindChildText(previous); // A text node's value will be empty if it is for a line break. bool add_space = previous.isTextNode() && value.empty(); inferred_label = @@ -233,7 +235,7 @@ string16 InferLabelFromPrevious(const WebFormControlElement& element) { // If we have identified a partial label and have reached a non-lightweight // element, consider the label to be complete. - string16 trimmed_label; + base::string16 trimmed_label; TrimWhitespace(inferred_label, TRIM_ALL, &trimmed_label); if (!trimmed_label.empty()) break; @@ -261,7 +263,7 @@ string16 InferLabelFromPrevious(const WebFormControlElement& element) { // Helper for |InferLabelForElement()| that infers a label, if possible, from // enclosing list item, // e.g. <li>Some Text<input ...><input ...><input ...></tr> -string16 InferLabelFromListItem(const WebFormControlElement& element) { +base::string16 InferLabelFromListItem(const WebFormControlElement& element) { WebNode parent = element.parentNode(); CR_DEFINE_STATIC_LOCAL(WebString, kListItem, ("li")); while (!parent.isNull() && parent.isElementNode() && @@ -272,7 +274,7 @@ string16 InferLabelFromListItem(const WebFormControlElement& element) { if (!parent.isNull() && HasTagName(parent, kListItem)) return FindChildText(parent); - return string16(); + return base::string16(); } // Helper for |InferLabelForElement()| that infers a label, if possible, from @@ -281,7 +283,7 @@ string16 InferLabelFromListItem(const WebFormControlElement& element) { // or <tr><th>Some Text</th><td><input ...></td></tr> // or <tr><td><b>Some Text</b></td><td><b><input ...></b></td></tr> // or <tr><th><b>Some Text</b></th><td><b><input ...></b></td></tr> -string16 InferLabelFromTableColumn(const WebFormControlElement& element) { +base::string16 InferLabelFromTableColumn(const WebFormControlElement& element) { CR_DEFINE_STATIC_LOCAL(WebString, kTableCell, ("td")); WebNode parent = element.parentNode(); while (!parent.isNull() && parent.isElementNode() && @@ -290,11 +292,11 @@ string16 InferLabelFromTableColumn(const WebFormControlElement& element) { } if (parent.isNull()) - return string16(); + return base::string16(); // Check all previous siblings, skipping non-element nodes, until we find a // non-empty text block. - string16 inferred_label; + base::string16 inferred_label; WebNode previous = parent.previousSibling(); CR_DEFINE_STATIC_LOCAL(WebString, kTableHeader, ("th")); while (inferred_label.empty() && !previous.isNull()) { @@ -310,7 +312,7 @@ string16 InferLabelFromTableColumn(const WebFormControlElement& element) { // Helper for |InferLabelForElement()| that infers a label, if possible, from // surrounding table structure, // e.g. <tr><td>Some Text</td></tr><tr><td><input ...></td></tr> -string16 InferLabelFromTableRow(const WebFormControlElement& element) { +base::string16 InferLabelFromTableRow(const WebFormControlElement& element) { CR_DEFINE_STATIC_LOCAL(WebString, kTableRow, ("tr")); WebNode parent = element.parentNode(); while (!parent.isNull() && parent.isElementNode() && @@ -319,11 +321,11 @@ string16 InferLabelFromTableRow(const WebFormControlElement& element) { } if (parent.isNull()) - return string16(); + return base::string16(); // Check all previous siblings, skipping non-element nodes, until we find a // non-empty text block. - string16 inferred_label; + base::string16 inferred_label; WebNode previous = parent.previousSibling(); while (inferred_label.empty() && !previous.isNull()) { if (HasTagName(previous, kTableRow)) @@ -339,12 +341,12 @@ string16 InferLabelFromTableRow(const WebFormControlElement& element) { // a surrounding div table, // e.g. <div>Some Text<span><input ...></span></div> // e.g. <div>Some Text</div><div><input ...></div> -string16 InferLabelFromDivTable(const WebFormControlElement& element) { +base::string16 InferLabelFromDivTable(const WebFormControlElement& element) { WebNode node = element.parentNode(); bool looking_for_parent = true; // Search the sibling and parent <div>s until we find a candidate label. - string16 inferred_label; + base::string16 inferred_label; CR_DEFINE_STATIC_LOCAL(WebString, kDiv, ("div")); CR_DEFINE_STATIC_LOCAL(WebString, kTable, ("table")); CR_DEFINE_STATIC_LOCAL(WebString, kFieldSet, ("fieldset")); @@ -376,7 +378,8 @@ string16 InferLabelFromDivTable(const WebFormControlElement& element) { // a surrounding definition list, // e.g. <dl><dt>Some Text</dt><dd><input ...></dd></dl> // e.g. <dl><dt><b>Some Text</b></dt><dd><b><input ...></b></dd></dl> -string16 InferLabelFromDefinitionList(const WebFormControlElement& element) { +base::string16 InferLabelFromDefinitionList( + const WebFormControlElement& element) { CR_DEFINE_STATIC_LOCAL(WebString, kDefinitionData, ("dd")); WebNode parent = element.parentNode(); while (!parent.isNull() && parent.isElementNode() && @@ -384,7 +387,7 @@ string16 InferLabelFromDefinitionList(const WebFormControlElement& element) { parent = parent.parentNode(); if (parent.isNull() || !HasTagName(parent, kDefinitionData)) - return string16(); + return base::string16(); // Skip by any intervening text nodes. WebNode previous = parent.previousSibling(); @@ -393,15 +396,15 @@ string16 InferLabelFromDefinitionList(const WebFormControlElement& element) { CR_DEFINE_STATIC_LOCAL(WebString, kDefinitionTag, ("dt")); if (previous.isNull() || !HasTagName(previous, kDefinitionTag)) - return string16(); + return base::string16(); return FindChildText(previous); } // Infers corresponding label for |element| from surrounding context in the DOM, // e.g. the contents of the preceding <p> tag or text element. -string16 InferLabelForElement(const WebFormControlElement& element) { - string16 inferred_label = InferLabelFromPrevious(element); +base::string16 InferLabelForElement(const WebFormControlElement& element) { + base::string16 inferred_label = InferLabelFromPrevious(element); if (!inferred_label.empty()) return inferred_label; @@ -432,8 +435,8 @@ string16 InferLabelForElement(const WebFormControlElement& element) { // Fills |option_strings| with the values of the <option> elements present in // |select_element|. void GetOptionStringsFromElement(const WebSelectElement& select_element, - std::vector<string16>* option_values, - std::vector<string16>* option_contents) { + std::vector<base::string16>* option_values, + std::vector<base::string16>* option_contents) { DCHECK(!select_element.isNull()); option_values->clear(); @@ -482,7 +485,7 @@ void ForEachMatchingFormField(const WebFormElement& form_element, for (size_t i = 0; i < control_elements.size(); ++i) { WebFormControlElement* element = &control_elements[i]; - if (string16(element->nameForAutofill()) != data.fields[i].name) { + if (base::string16(element->nameForAutofill()) != data.fields[i].name) { // This case should be reachable only for pathological websites, which // rename form fields while the user is interacting with the Autofill // popup. I (isherman) am not aware of any such websites, and so am @@ -612,8 +615,8 @@ bool IsAutofillableInputElement(const WebInputElement* element) { return IsTextInput(element) || IsCheckableElement(element); } -const string16 GetFormIdentifier(const WebFormElement& form) { - string16 identifier = form.name(); +const base::string16 GetFormIdentifier(const WebFormElement& form) { + base::string16 identifier = form.name(); CR_DEFINE_STATIC_LOCAL(WebString, kId, ("id")); if (identifier.empty()) identifier = form.getAttribute(kId); @@ -727,7 +730,7 @@ void WebFormControlElementToFormField(const WebFormControlElement& element, if (!(extract_mask & EXTRACT_VALUE)) return; - string16 value; + base::string16 value; if (IsAutofillableInputElement(input_element)) { value = input_element->value(); } else { @@ -789,7 +792,7 @@ bool WebFormElementToFormData( form->action = GURL(form_element.action()); // A map from a FormFieldData's name to the FormFieldData itself. - std::map<string16, FormFieldData*> name_map; + std::map<base::string16, FormFieldData*> name_map; // The extracted FormFields. We use pointers so we can store them in // |name_map|. @@ -841,7 +844,7 @@ bool WebFormElementToFormData( WebFormControlElement field_element = label.correspondingControl().to<WebFormControlElement>(); - string16 element_name; + base::string16 element_name; if (field_element.isNull()) { // Sometimes site authors will incorrectly specify the corresponding // field element's name rather than its id, so we compensate here. @@ -854,10 +857,10 @@ bool WebFormElementToFormData( element_name = field_element.nameForAutofill(); } - std::map<string16, FormFieldData*>::iterator iter = + std::map<base::string16, FormFieldData*>::iterator iter = name_map.find(element_name); if (iter != name_map.end()) { - string16 label_text = FindChildText(label); + base::string16 label_text = FindChildText(label); // Concatenate labels because some sites might have multiple label // candidates. diff --git a/components/autofill/renderer/form_autofill_util.h b/components/autofill/renderer/form_autofill_util.h index a7579ce..dfc80cd 100644 --- a/components/autofill/renderer/form_autofill_util.h +++ b/components/autofill/renderer/form_autofill_util.h @@ -64,7 +64,7 @@ bool IsAutofillableInputElement(const WebKit::WebInputElement* element); // Returns the form's |name| attribute if non-empty; otherwise the form's |id| // attribute. -const string16 GetFormIdentifier(const WebKit::WebFormElement& form); +const base::string16 GetFormIdentifier(const WebKit::WebFormElement& form); // Returns true if the element specified by |click_element| was successfully // clicked. diff --git a/components/autofill/renderer/form_cache.cc b/components/autofill/renderer/form_cache.cc index 4edcc4a..343998a 100644 --- a/components/autofill/renderer/form_cache.cc +++ b/components/autofill/renderer/form_cache.cc @@ -191,7 +191,7 @@ bool FormCache::ClearFormWithElement(const WebInputElement& element) { if (!input_element->isEnabled()) continue; - input_element->setValue(string16(), true); + input_element->setValue(base::string16(), true); input_element->setAutofilled(false); // Clearing the value in the focused node (above) can cause selection @@ -203,7 +203,7 @@ bool FormCache::ClearFormWithElement(const WebInputElement& element) { } else if (IsSelectElement(control_element)) { WebSelectElement select_element = control_element.to<WebSelectElement>(); - std::map<const WebSelectElement, string16>::const_iterator + std::map<const WebSelectElement, base::string16>::const_iterator initial_value_iter = initial_select_values_.find(select_element); if (initial_value_iter != initial_select_values_.end() && select_element.value() != initial_value_iter->second) { @@ -247,7 +247,7 @@ bool FormCache::ShowPredictions(const FormDataPredictions& form) { // to |true| -- WebKit distinguishes between a "null" string (lhs) and an // "empty" string (rhs). We don't want that distinction, so forcing to // string16. - string16 element_name = GetFormIdentifier(form_element); + base::string16 element_name = GetFormIdentifier(form_element); GURL action(form_element.document().completeURL(form_element.action())); if (element_name == form.data.name && action == form.data.action) { found_form = true; @@ -271,14 +271,15 @@ bool FormCache::ShowPredictions(const FormDataPredictions& form) { for (size_t i = 0; i < control_elements.size(); ++i) { WebFormControlElement* element = &control_elements[i]; - if (string16(element->nameForAutofill()) != form.data.fields[i].name) { + if (base::string16(element->nameForAutofill()) != + form.data.fields[i].name) { // Keep things simple. Don't show predictions for elements whose names // were modified between page load and the server's response to our query. continue; } std::string placeholder = form.fields[i].overall_type; - string16 title = l10n_util::GetStringFUTF16( + base::string16 title = l10n_util::GetStringFUTF16( IDS_AUTOFILL_SHOW_PREDICTIONS_TITLE, UTF8ToUTF16(form.fields[i].heuristic_type), UTF8ToUTF16(form.fields[i].server_type), diff --git a/components/autofill/renderer/form_cache.h b/components/autofill/renderer/form_cache.h index 9af737e..eb1d84a 100644 --- a/components/autofill/renderer/form_cache.h +++ b/components/autofill/renderer/form_cache.h @@ -63,7 +63,8 @@ class FormCache { std::set<WebKit::WebDocument> web_documents_; // The cached initial values for <select> elements. - std::map<const WebKit::WebSelectElement, string16> initial_select_values_; + std::map<const WebKit::WebSelectElement, base::string16> + initial_select_values_; // The cached initial values for checkable <input> elements. std::map<const WebKit::WebInputElement, bool> initial_checked_state_; diff --git a/components/autofill/renderer/password_autofill_agent.cc b/components/autofill/renderer/password_autofill_agent.cc index d266757..fe3564f 100644 --- a/components/autofill/renderer/password_autofill_agent.cc +++ b/components/autofill/renderer/password_autofill_agent.cc @@ -31,7 +31,7 @@ namespace { static const size_t kMaximumTextSizeForAutocomplete = 1000; // Maps element names to the actual elements to simplify form filling. -typedef std::map<string16, WebKit::WebInputElement> +typedef std::map<base::string16, WebKit::WebInputElement> FormInputElementMap; // Utility struct for form lookup and autofill. When we parse the DOM to look up @@ -155,7 +155,7 @@ void FillForm(FormElements* fe, const FormData& data) { if (!fe->form_element.autoComplete()) return; - std::map<string16, string16> data_map; + std::map<base::string16, base::string16> data_map; for (size_t i = 0; i < data.fields.size(); i++) data_map[data.fields[i].name] = data.fields[i].value; @@ -189,8 +189,8 @@ void SetElementAutofilled(WebKit::WebInputElement* element, bool autofilled) { element->dispatchFormControlChangeEvent(); } -bool DoUsernamesMatch(const string16& username1, - const string16& username2, +bool DoUsernamesMatch(const base::string16& username1, + const base::string16& username2, bool exact_match) { if (exact_match) return username1 == username2; @@ -253,7 +253,7 @@ bool PasswordAutofillAgent::TextDidChangeInTextField( WebKit::WebInputElement password = iter->second.password_field; SetElementAutofilled(&username, false); if (password.isAutofilled()) { - password.setValue(string16()); + password.setValue(base::string16()); SetElementAutofilled(&password, false); } @@ -486,8 +486,8 @@ void PasswordAutofillAgent::OnFillPasswordForm( void PasswordAutofillAgent::GetSuggestions( const PasswordFormFillData& fill_data, - const string16& input, - std::vector<string16>* suggestions) { + const base::string16& input, + std::vector<base::string16>* suggestions) { if (StartsWith(fill_data.basic_data.fields[0].value, input, false)) suggestions->push_back(fill_data.basic_data.fields[0].value); @@ -510,7 +510,7 @@ bool PasswordAutofillAgent::ShowSuggestionPopup( if (!webview) return false; - std::vector<string16> suggestions; + std::vector<base::string16> suggestions; GetSuggestions(fill_data, user_input.value(), &suggestions); if (disable_popup_) { @@ -540,8 +540,8 @@ bool PasswordAutofillAgent::ShowSuggestionPopup( return false; } - std::vector<string16> labels(suggestions.size()); - std::vector<string16> icons(suggestions.size()); + std::vector<base::string16> labels(suggestions.size()); + std::vector<base::string16> icons(suggestions.size()); std::vector<int> ids(suggestions.size(), WebKit::WebAutofillClient::MenuItemIDPasswordEntry); webview->applyAutofillSuggestions( @@ -555,10 +555,10 @@ bool PasswordAutofillAgent::FillUserNameAndPassword( const PasswordFormFillData& fill_data, bool exact_username_match, bool set_selection) { - string16 current_username = username_element->value(); + base::string16 current_username = username_element->value(); // username and password will contain the match found if any. - string16 username; - string16 password; + base::string16 username; + base::string16 password; // Look for any suitable matches to current field text. if (DoUsernamesMatch(fill_data.basic_data.fields[0].value, current_username, diff --git a/components/autofill/renderer/password_autofill_agent.h b/components/autofill/renderer/password_autofill_agent.h index e2955fd..5f787d6 100644 --- a/components/autofill/renderer/password_autofill_agent.h +++ b/components/autofill/renderer/password_autofill_agent.h @@ -86,8 +86,8 @@ class PasswordAutofillAgent : public content::RenderViewObserver, void SendPasswordForms(WebKit::WebFrame* frame, bool only_visible); void GetSuggestions(const PasswordFormFillData& fill_data, - const string16& input, - std::vector<string16>* suggestions); + const base::string16& input, + std::vector<base::string16>* suggestions); bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, const WebKit::WebInputElement& user_input); diff --git a/components/autofill/renderer/password_generation_manager.cc b/components/autofill/renderer/password_generation_manager.cc index 331c4d5..fab0eb1 100644 --- a/components/autofill/renderer/password_generation_manager.cc +++ b/components/autofill/renderer/password_generation_manager.cc @@ -215,7 +215,8 @@ void PasswordGenerationManager::OnFormNotBlacklisted( MaybeShowIcon(); } -void PasswordGenerationManager::OnPasswordAccepted(const string16& password) { +void PasswordGenerationManager::OnPasswordAccepted( + const base::string16& password) { for (std::vector<WebKit::WebInputElement>::iterator it = passwords_.begin(); it != passwords_.end(); ++it) { it->setValue(password); diff --git a/components/autofill/renderer/password_generation_manager.h b/components/autofill/renderer/password_generation_manager.h index 9ed94ca..46510d1 100644 --- a/components/autofill/renderer/password_generation_manager.h +++ b/components/autofill/renderer/password_generation_manager.h @@ -60,7 +60,7 @@ class PasswordGenerationManager : public content::RenderViewObserver, // Message handlers. void OnFormNotBlacklisted(const content::PasswordForm& form); - void OnPasswordAccepted(const string16& password); + void OnPasswordAccepted(const base::string16& password); void OnPasswordGenerationEnabled(bool enabled); // Helper function to decide whether we should show password generation icon. diff --git a/components/user_prefs/pref_registry_syncable.cc b/components/user_prefs/pref_registry_syncable.cc index 81eb65c..9a3a76d 100644 --- a/components/user_prefs/pref_registry_syncable.cc +++ b/components/user_prefs/pref_registry_syncable.cc @@ -6,7 +6,7 @@ #include "base/files/file_path.h" #include "base/prefs/default_pref_store.h" -#include "base/string_number_conversions.h" +#include "base/strings/string_number_conversions.h" #include "base/values.h" #include "ui/base/l10n/l10n_util.h" diff --git a/components/visitedlink/test/visitedlink_unittest.cc b/components/visitedlink/test/visitedlink_unittest.cc index 4bdadf4..bc11ec3 100644 --- a/components/visitedlink/test/visitedlink_unittest.cc +++ b/components/visitedlink/test/visitedlink_unittest.cc @@ -686,7 +686,7 @@ TEST_F(VisitedLinkEventsTest, Coalescense) { } TEST_F(VisitedLinkEventsTest, Basics) { - RenderViewHostTester::For(rvh())->CreateRenderView(string16(), + RenderViewHostTester::For(rvh())->CreateRenderView(base::string16(), MSG_ROUTING_NONE, -1); @@ -711,7 +711,7 @@ TEST_F(VisitedLinkEventsTest, Basics) { } TEST_F(VisitedLinkEventsTest, TabVisibility) { - RenderViewHostTester::For(rvh())->CreateRenderView(string16(), + RenderViewHostTester::For(rvh())->CreateRenderView(base::string16(), MSG_ROUTING_NONE, -1); diff --git a/components/web_contents_delegate_android/web_contents_delegate_android.cc b/components/web_contents_delegate_android/web_contents_delegate_android.cc index debb7b2..1e09f2f 100644 --- a/components/web_contents_delegate_android/web_contents_delegate_android.cc +++ b/components/web_contents_delegate_android/web_contents_delegate_android.cc @@ -184,9 +184,9 @@ void WebContentsDelegateAndroid::MoveContents(WebContents* source, bool WebContentsDelegateAndroid::AddMessageToConsole( WebContents* source, int32 level, - const string16& message, + const base::string16& message, int32 line_no, - const string16& source_id) { + const base::string16& source_id) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); if (obj.is_null()) diff --git a/components/web_contents_delegate_android/web_contents_delegate_android.h b/components/web_contents_delegate_android/web_contents_delegate_android.h index 23f2452..dd26ba4 100644 --- a/components/web_contents_delegate_android/web_contents_delegate_android.h +++ b/components/web_contents_delegate_android/web_contents_delegate_android.h @@ -74,9 +74,9 @@ class WebContentsDelegateAndroid : public content::WebContentsDelegate { const gfx::Rect& pos) OVERRIDE; virtual bool AddMessageToConsole(content::WebContents* source, int32 level, - const string16& message, + const base::string16& message, int32 line_no, - const string16& source_id) OVERRIDE; + const base::string16& source_id) OVERRIDE; virtual void UpdateTargetURL(content::WebContents* source, int32 page_id, const GURL& url) OVERRIDE; diff --git a/components/webdata/common/web_database_migration_unittest.cc b/components/webdata/common/web_database_migration_unittest.cc index f894e9a..fad8510 100644 --- a/components/webdata/common/web_database_migration_unittest.cc +++ b/components/webdata/common/web_database_migration_unittest.cc @@ -39,7 +39,7 @@ namespace { void AutofillProfile31FromStatement(const sql::Statement& s, AutofillProfile* profile, - string16* label, + base::string16* label, int* unique_id, int64* date_modified) { DCHECK(profile); @@ -84,7 +84,7 @@ void AutofillProfile33FromStatement(const sql::Statement& s, void CreditCard31FromStatement(const sql::Statement& s, CreditCard* credit_card, - string16* label, + base::string16* label, int* unique_id, std::string* encrypted_number, int64* date_modified) { @@ -715,11 +715,11 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) { // Verify pre-conditions. These are expectations for version 30 of the // database. AutofillProfile profile; - string16 profile_label; + base::string16 profile_label; int profile_unique_id = 0; int64 profile_date_modified = 0; CreditCard credit_card; - string16 cc_label; + base::string16 cc_label; int cc_unique_id = 0; std::string cc_number_encrypted; int64 cc_date_modified = 0; @@ -835,7 +835,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) { ASSERT_TRUE(s2.Step()); CreditCard credit_card_a; - string16 cc_label_a; + base::string16 cc_label_a; std::string cc_number_encrypted_a; int64 cc_date_modified_a = 0; EXPECT_NO_FATAL_FAILURE(CreditCard32FromStatement(s2, @@ -970,9 +970,9 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { // Dave Smith. ASSERT_TRUE(s1.Step()); EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s1.ColumnString(0)); - EXPECT_EQ(string16(), s1.ColumnString16(1)); + EXPECT_EQ(base::string16(), s1.ColumnString16(1)); EXPECT_EQ(ASCIIToUTF16("2 Main Street"), s1.ColumnString16(2)); - EXPECT_EQ(string16(), s1.ColumnString16(3)); + EXPECT_EQ(base::string16(), s1.ColumnString16(3)); EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); @@ -982,9 +982,9 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { // Dave Smith (Part 2). ASSERT_TRUE(s1.Step()); EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s1.ColumnString(0)); - EXPECT_EQ(string16(), s1.ColumnString16(1)); + EXPECT_EQ(base::string16(), s1.ColumnString16(1)); EXPECT_EQ(ASCIIToUTF16("2 Main St"), s1.ColumnString16(2)); - EXPECT_EQ(string16(), s1.ColumnString16(3)); + EXPECT_EQ(base::string16(), s1.ColumnString16(3)); EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); @@ -997,9 +997,9 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { // 3 Main St. ASSERT_TRUE(s1.Step()); EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s1.ColumnString(0)); - EXPECT_EQ(string16(), s1.ColumnString16(1)); + EXPECT_EQ(base::string16(), s1.ColumnString16(1)); EXPECT_EQ(ASCIIToUTF16("3 Main St"), s1.ColumnString16(2)); - EXPECT_EQ(string16(), s1.ColumnString16(3)); + EXPECT_EQ(base::string16(), s1.ColumnString16(3)); EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(4)); EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(5)); EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(6)); @@ -1018,7 +1018,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { ASSERT_TRUE(s2.Step()); EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s2.ColumnString(0)); EXPECT_EQ(ASCIIToUTF16("John"), s2.ColumnString16(1)); - EXPECT_EQ(string16(), s2.ColumnString16(2)); + EXPECT_EQ(base::string16(), s2.ColumnString16(2)); EXPECT_EQ(ASCIIToUTF16("Doe"), s2.ColumnString16(3)); // John P. Doe. Note same guid as above due to merging of multi-valued @@ -1033,14 +1033,14 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { ASSERT_TRUE(s2.Step()); EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s2.ColumnString(0)); EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1)); - EXPECT_EQ(string16(), s2.ColumnString16(2)); + EXPECT_EQ(base::string16(), s2.ColumnString16(2)); EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); // Dave Smith (Part 2). ASSERT_TRUE(s2.Step()); EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s2.ColumnString(0)); EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1)); - EXPECT_EQ(string16(), s2.ColumnString16(2)); + EXPECT_EQ(base::string16(), s2.ColumnString16(2)); EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3)); // Alfred E Newman. @@ -1049,9 +1049,9 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { // 3 Main St. ASSERT_TRUE(s2.Step()); EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s2.ColumnString(0)); - EXPECT_EQ(string16(), s2.ColumnString16(1)); - EXPECT_EQ(string16(), s2.ColumnString16(2)); - EXPECT_EQ(string16(), s2.ColumnString16(3)); + EXPECT_EQ(base::string16(), s2.ColumnString16(1)); + EXPECT_EQ(base::string16(), s2.ColumnString16(2)); + EXPECT_EQ(base::string16(), s2.ColumnString16(3)); // Should be all. EXPECT_FALSE(s2.Step()); @@ -1073,12 +1073,12 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { // 2 Main Street. ASSERT_TRUE(s3.Step()); EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s3.ColumnString(0)); - EXPECT_EQ(string16(), s3.ColumnString16(1)); + EXPECT_EQ(base::string16(), s3.ColumnString16(1)); // 2 Main St. ASSERT_TRUE(s3.Step()); EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s3.ColumnString(0)); - EXPECT_EQ(string16(), s3.ColumnString16(1)); + EXPECT_EQ(base::string16(), s3.ColumnString16(1)); // Alfred E Newman. // Gets culled during migration from 35 to 36 due to incomplete address. @@ -1086,7 +1086,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { // 3 Main St. ASSERT_TRUE(s3.Step()); EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s3.ColumnString(0)); - EXPECT_EQ(string16(), s3.ColumnString16(1)); + EXPECT_EQ(base::string16(), s3.ColumnString16(1)); // Should be all. EXPECT_FALSE(s3.Step()); @@ -1117,7 +1117,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { ASSERT_TRUE(s4.Step()); EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s4.ColumnString(0)); EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. - EXPECT_EQ(string16(), s4.ColumnString16(2)); + EXPECT_EQ(base::string16(), s4.ColumnString16(2)); // 2 Main Street fax. // Gets culled after fax type removed. @@ -1126,7 +1126,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { ASSERT_TRUE(s4.Step()); EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s4.ColumnString(0)); EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. - EXPECT_EQ(string16(), s4.ColumnString16(2)); + EXPECT_EQ(base::string16(), s4.ColumnString16(2)); // 2 Main St fax. // Gets culled after fax type removed. @@ -1137,7 +1137,7 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) { ASSERT_TRUE(s4.Step()); EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s4.ColumnString(0)); EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone. - EXPECT_EQ(string16(), s4.ColumnString16(2)); + EXPECT_EQ(base::string16(), s4.ColumnString16(2)); // 2 Main St fax. // Gets culled after fax type removed. diff --git a/components/webdata/encryptor/encryptor.h b/components/webdata/encryptor/encryptor.h index 94ce108..d76c3c7 100644 --- a/components/webdata/encryptor/encryptor.h +++ b/components/webdata/encryptor/encryptor.h @@ -17,7 +17,7 @@ class Encryptor { // Encrypt a string16. The output (second argument) is // really an array of bytes, but we're passing it back // as a std::string - static bool EncryptString16(const string16& plaintext, + static bool EncryptString16(const base::string16& plaintext, std::string* ciphertext); // Decrypt an array of bytes obtained with EncryptString16 @@ -25,7 +25,7 @@ class Encryptor { // is a std::string, so you need to first get your (binary) // data into a string. static bool DecryptString16(const std::string& ciphertext, - string16* plaintext); + base::string16* plaintext); // Encrypt a string. static bool EncryptString(const std::string& plaintext, diff --git a/components/webdata/encryptor/encryptor_mac.mm b/components/webdata/encryptor/encryptor_mac.mm index 67c46313..e402578 100644 --- a/components/webdata/encryptor/encryptor_mac.mm +++ b/components/webdata/encryptor/encryptor_mac.mm @@ -69,13 +69,13 @@ crypto::SymmetricKey* GetEncryptionKey() { } // namespace -bool Encryptor::EncryptString16(const string16& plaintext, +bool Encryptor::EncryptString16(const base::string16& plaintext, std::string* ciphertext) { return EncryptString(UTF16ToUTF8(plaintext), ciphertext); } bool Encryptor::DecryptString16(const std::string& ciphertext, - string16* plaintext) { + base::string16* plaintext) { std::string utf8; if (!DecryptString(ciphertext, &utf8)) return false; diff --git a/components/webdata/encryptor/encryptor_posix.cc b/components/webdata/encryptor/encryptor_posix.cc index 70d536c..ef730a4 100644 --- a/components/webdata/encryptor/encryptor_posix.cc +++ b/components/webdata/encryptor/encryptor_posix.cc @@ -54,13 +54,13 @@ crypto::SymmetricKey* GetEncryptionKey() { } // namespace -bool Encryptor::EncryptString16(const string16& plaintext, +bool Encryptor::EncryptString16(const base::string16& plaintext, std::string* ciphertext) { return EncryptString(UTF16ToUTF8(plaintext), ciphertext); } bool Encryptor::DecryptString16(const std::string& ciphertext, - string16* plaintext) { + base::string16* plaintext) { std::string utf8; if (!DecryptString(ciphertext, &utf8)) return false; diff --git a/components/webdata/encryptor/encryptor_unittest.cc b/components/webdata/encryptor/encryptor_unittest.cc index c9f8026..6d166bd 100644 --- a/components/webdata/encryptor/encryptor_unittest.cc +++ b/components/webdata/encryptor/encryptor_unittest.cc @@ -27,8 +27,8 @@ class EncryptorTest : public testing::Test { }; TEST_F(EncryptorTest, String16EncryptionDecryption) { - string16 plaintext; - string16 result; + base::string16 plaintext; + base::string16 result; std::string utf8_plaintext; std::string utf8_result; std::string ciphertext; diff --git a/components/webdata/encryptor/encryptor_win.cc b/components/webdata/encryptor/encryptor_win.cc index ceb6020..3ad36f6 100644 --- a/components/webdata/encryptor/encryptor_win.cc +++ b/components/webdata/encryptor/encryptor_win.cc @@ -10,13 +10,13 @@ #pragma comment(lib, "crypt32.lib") -bool Encryptor::EncryptString16(const string16& plaintext, +bool Encryptor::EncryptString16(const base::string16& plaintext, std::string* ciphertext) { return EncryptString(UTF16ToUTF8(plaintext), ciphertext); } bool Encryptor::DecryptString16(const std::string& ciphertext, - string16* plaintext) { + base::string16* plaintext) { std::string utf8; if (!DecryptString(ciphertext, &utf8)) return false; diff --git a/components/zip/zip_internal.cc b/components/zip/zip_internal.cc index 0efbcfe..56bca5e9 100644 --- a/components/zip/zip_internal.cc +++ b/components/zip/zip_internal.cc @@ -54,7 +54,7 @@ void* ZipOpenFunc(void *opaque, const char* filename, int mode) { creation_disposition = CREATE_ALWAYS; } - string16 filename16 = UTF8ToUTF16(filename); + base::string16 filename16 = UTF8ToUTF16(filename); if ((filename != NULL) && (desired_access != 0)) { file = CreateFile(filename16.c_str(), desired_access, share_mode, NULL, creation_disposition, flags_and_attributes, NULL); |