diff options
author | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 18:46:04 +0000 |
---|---|---|
committer | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 18:46:04 +0000 |
commit | e2aaa812cbc54389409ca9363d11497d49f69f2f (patch) | |
tree | 6fd3282047ade50bd02a37a5b6b35f645ead739e /chrome | |
parent | f353bede76468b89fc69f3b823e567e6da87d3f7 (diff) | |
download | chromium_src-e2aaa812cbc54389409ca9363d11497d49f69f2f.zip chromium_src-e2aaa812cbc54389409ca9363d11497d49f69f2f.tar.gz chromium_src-e2aaa812cbc54389409ca9363d11497d49f69f2f.tar.bz2 |
Make FormField be a struct rather than a class per c++ standards.
This makes automatic generation of IPC messages much easier.
Convert autofill messsage to automatic generation in the process.
Attempt #2: fix build on chromeos, see http://codereview.chromium.org/6633001
for original CL.
Review URL: http://codereview.chromium.org/6625087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
33 files changed, 255 insertions, 370 deletions
diff --git a/chrome/browser/autocomplete_history_manager.cc b/chrome/browser/autocomplete_history_manager.cc index e93bd8c..bbc3387 100644 --- a/chrome/browser/autocomplete_history_manager.cc +++ b/chrome/browser/autocomplete_history_manager.cc @@ -119,11 +119,11 @@ void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) { for (std::vector<webkit_glue::FormField>::const_iterator iter = form.fields.begin(); iter != form.fields.end(); ++iter) { - if (!iter->value().empty() && - !iter->name().empty() && - iter->form_control_type() == ASCIIToUTF16("text") && - !CreditCard::IsCreditCardNumber(iter->value()) && - !IsSSN(iter->value())) + if (!iter->value.empty() && + !iter->name.empty() && + iter->form_control_type == ASCIIToUTF16("text") && + !CreditCard::IsCreditCardNumber(iter->value) && + !IsSSN(iter->value)) values.push_back(*iter); } diff --git a/chrome/browser/autofill/address_field.cc b/chrome/browser/autofill/address_field.cc index 06fb859..5d4d0cc 100644 --- a/chrome/browser/autofill/address_field.cc +++ b/chrome/browser/autofill/address_field.cc @@ -148,7 +148,7 @@ AddressType AddressField::FindType() const { // "bill" or "ship". We could check for the ECML type prefixes // here, but there's no need to since ECML's prefixes Ecom_BillTo // and Ecom_ShipTo contain "bill" and "ship" anyway. - string16 name = StringToLowerASCII(address1_->name()); + string16 name = StringToLowerASCII(address1_->name); return AddressTypeFromText(name); } @@ -294,7 +294,7 @@ bool AddressField::ParseZipCode( } AddressType tempType; - string16 name = (**iter)->name(); + string16 name = (**iter)->name; // Note: comparisons using the ecml compliant name as a prefix must be used in // order to accommodate Google Checkout. See FormFieldSet::GetEcmlPattern for diff --git a/chrome/browser/autofill/autofill_common_test.h b/chrome/browser/autofill/autofill_common_test.h index 0a1dcfc..72f0a14 100644 --- a/chrome/browser/autofill/autofill_common_test.h +++ b/chrome/browser/autofill/autofill_common_test.h @@ -11,7 +11,7 @@ class CreditCard; class Profile; namespace webkit_glue { -class FormField; +struct FormField; } // namespace webkit_glue // Common utilities shared amongst AutoFill tests. diff --git a/chrome/browser/autofill/autofill_field.cc b/chrome/browser/autofill/autofill_field.cc index 1127031..ce5fc83 100644 --- a/chrome/browser/autofill/autofill_field.cc +++ b/chrome/browser/autofill/autofill_field.cc @@ -59,12 +59,12 @@ AutofillFieldType AutofillField::type() const { } bool AutofillField::IsEmpty() const { - return value().empty(); + return value.empty(); } std::string AutofillField::FieldSignature() const { - std::string field_name = UTF16ToUTF8(name()); - std::string type = UTF16ToUTF8(form_control_type()); + std::string field_name = UTF16ToUTF8(name); + std::string type = UTF16ToUTF8(form_control_type); std::string field_string = field_name + "&" + type; return Hash32Bit(field_string); } diff --git a/chrome/browser/autofill/autofill_field_unittest.cc b/chrome/browser/autofill/autofill_field_unittest.cc index 7723551..697e86c 100644 --- a/chrome/browser/autofill/autofill_field_unittest.cc +++ b/chrome/browser/autofill/autofill_field_unittest.cc @@ -33,30 +33,30 @@ TEST(AutofillFieldTest, Type) { TEST(AutofillFieldTest, IsEmpty) { AutofillField field; - ASSERT_EQ(string16(), field.value()); + ASSERT_EQ(string16(), field.value); // Field value is empty. EXPECT_TRUE(field.IsEmpty()); // Field value is non-empty. - field.set_value(ASCIIToUTF16("Value")); + field.value = ASCIIToUTF16("Value"); EXPECT_FALSE(field.IsEmpty()); } TEST(AutofillFieldTest, FieldSignature) { AutofillField field; - ASSERT_EQ(string16(), field.name()); - ASSERT_EQ(string16(), field.form_control_type()); + ASSERT_EQ(string16(), field.name); + ASSERT_EQ(string16(), field.form_control_type); // Signature is empty. EXPECT_EQ("2085434232", field.FieldSignature()); // Field name is set. - field.set_name(ASCIIToUTF16("Name")); + field.name = ASCIIToUTF16("Name"); EXPECT_EQ("1606968241", field.FieldSignature()); // Field form control type is set. - field.set_form_control_type(ASCIIToUTF16("Text")); + field.form_control_type = ASCIIToUTF16("Text"); EXPECT_EQ("4246049809", field.FieldSignature()); // Heuristic type does not affect FieldSignature. diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 8d46c84..b7752fb 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -193,7 +193,7 @@ bool SectionIsAutoFilled(const FormStructure* form_structure, continue; AutofillType autofill_type(form_structure->field(k)->type()); - if (form.fields[j].is_autofilled()) + if (form.fields[j].is_autofilled) return true; // We found a matching field in the |form_structure| so we @@ -382,7 +382,7 @@ void AutofillManager::OnQueryFormFieldAutoFill( // hand off what we generated and they will send the results back to the // renderer. tab_contents()->autocomplete_history_manager()->OnGetAutocompleteSuggestions( - query_id, field.name(), field.value(), values, labels, icons, unique_ids); + query_id, field.name, field.value, values, labels, icons, unique_ids); } void AutofillManager::OnFillAutoFillFormData(int query_id, @@ -577,7 +577,7 @@ void AutofillManager::DeterminePossibleFieldTypesForUpload( for (size_t i = 0; i < submitted_form->field_count(); i++) { const AutofillField* field = submitted_form->field(i); FieldTypeSet field_types; - personal_data_->GetPossibleFieldTypes(field->value(), &field_types); + personal_data_->GetPossibleFieldTypes(field->value, &field_types); DCHECK(!field_types.empty()); submitted_form->set_possible_types(i, field_types); @@ -604,11 +604,11 @@ void AutofillManager::LogMetricsAboutSubmittedForm( for (size_t i = 0; i < submitted_form->field_count(); ++i) { const AutofillField* field = submitted_form->field(i); FieldTypeSet field_types; - personal_data_->GetPossibleFieldTypes(field->value(), &field_types); + personal_data_->GetPossibleFieldTypes(field->value, &field_types); DCHECK(!field_types.empty()); - if (field->form_control_type() == ASCIIToUTF16("select-one")) { - // TODO(isherman): <select> fields don't support |is_autofilled()|. Since + if (field->form_control_type == ASCIIToUTF16("select-one")) { + // TODO(isherman): <select> fields don't support |is_autofilled|. Since // this is heavily relied upon by our metrics, we just don't log anything // for all <select> fields. Better to have less data than misleading data. continue; @@ -618,7 +618,7 @@ void AutofillManager::LogMetricsAboutSubmittedForm( metric_logger_->Log(AutofillMetrics::FIELD_SUBMITTED, experiment_id); if (field_types.find(EMPTY_TYPE) == field_types.end() && field_types.find(UNKNOWN_TYPE) == field_types.end()) { - if (field->is_autofilled()) { + if (field->is_autofilled) { metric_logger_->Log(AutofillMetrics::FIELD_AUTOFILLED, experiment_id); } else { metric_logger_->Log(AutofillMetrics::FIELD_AUTOFILL_FAILED, @@ -817,7 +817,7 @@ void AutofillManager::GetProfileSuggestions(FormStructure* form, string16 profile_field_value = profile->GetFieldText(type); if (!profile_field_value.empty() && - StartsWith(profile_field_value, field.value(), false)) { + StartsWith(profile_field_value, field.value, false)) { matched_profiles.push_back(profile); values->push_back(profile_field_value); unique_ids->push_back(PackGUIDs(std::string(), profile->guid())); @@ -857,7 +857,7 @@ void AutofillManager::GetCreditCardSuggestions(FormStructure* form, // The value of the stored data for this field type in the |credit_card|. string16 creditcard_field_value = credit_card->GetFieldText(type); if (!creditcard_field_value.empty() && - StartsWith(creditcard_field_value, field.value(), false)) { + StartsWith(creditcard_field_value, field.value, false)) { if (type.field_type() == CREDIT_CARD_NUMBER) creditcard_field_value = credit_card->ObfuscatedNumber(); @@ -876,9 +876,9 @@ void AutofillManager::FillCreditCardFormField(const CreditCard* credit_card, DCHECK_EQ(AutofillType::CREDIT_CARD, type.group()); DCHECK(field); - if (field->form_control_type() == ASCIIToUTF16("select-one")) { + if (field->form_control_type == ASCIIToUTF16("select-one")) { autofill::FillSelectControl(*credit_card, type, field); - } else if (field->form_control_type() == ASCIIToUTF16("month")) { + } else if (field->form_control_type == ASCIIToUTF16("month")) { // HTML5 input="month" consists of year-month. string16 year = credit_card->GetFieldText( AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); @@ -887,10 +887,10 @@ void AutofillManager::FillCreditCardFormField(const CreditCard* credit_card, if (!year.empty() && !month.empty()) { // Fill the value only if |credit_card| includes both year and month // information. - field->set_value(year + ASCIIToUTF16("-") + month); + field->value = year + ASCIIToUTF16("-") + month; } } else { - field->set_value(credit_card->GetFieldText(type)); + field->value = credit_card->GetFieldText(type); } } @@ -904,10 +904,10 @@ void AutofillManager::FillFormField(const AutoFillProfile* profile, if (type.subgroup() == AutofillType::PHONE_NUMBER) { FillPhoneNumberField(profile, type, field); } else { - if (field->form_control_type() == ASCIIToUTF16("select-one")) + if (field->form_control_type == ASCIIToUTF16("select-one")) autofill::FillSelectControl(*profile, type, field); else - field->set_value(profile->GetFieldText(type)); + field->value = profile->GetFieldText(type); } } @@ -921,17 +921,17 @@ void AutofillManager::FillPhoneNumberField(const AutoFillProfile* profile, static_cast<size_t>(PhoneNumber::kPrefixLength + PhoneNumber::kSuffixLength)); if (has_valid_suffix_and_prefix && - field->max_length() == PhoneNumber::kPrefixLength) { + field->max_length == PhoneNumber::kPrefixLength) { number = number.substr(PhoneNumber::kPrefixOffset, PhoneNumber::kPrefixLength); - field->set_value(number); + field->value = number; } else if (has_valid_suffix_and_prefix && - field->max_length() == PhoneNumber::kSuffixLength) { + field->max_length == PhoneNumber::kSuffixLength) { number = number.substr(PhoneNumber::kSuffixOffset, PhoneNumber::kSuffixLength); - field->set_value(number); + field->value = number; } else { - field->set_value(number); + field->value = number; } } diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index c9697c3..c2d93d7 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -28,7 +28,7 @@ class RenderViewHost; namespace webkit_glue { struct FormData; -class FormField; +struct FormField; } // namespace webkit_glue // Manages saving and restoring the user's personal information entered into web diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index 422f676..e3d912b 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -1178,7 +1178,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsWhenFormIsAutoFilled) { FormsSeen(forms); // Mark one of the fields as filled. - form.fields[2].set_autofilled(true); + form.fields[2].is_autofilled = true; const FormField& field = form.fields[0]; GetAutoFillSuggestions(form, field); @@ -1266,7 +1266,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsWithDuplicateValues) { autofill_manager_->AddProfile(profile); FormField& field = form.fields[0]; - field.set_autofilled(true); + field.is_autofilled = true; GetAutoFillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1477,7 +1477,7 @@ TEST_F(AutofillManagerTest, FillFormWithMultipleSections) { CreateTestAddressFormData(&form); for (size_t i = kAddressFormSize; i < form.fields.size(); ++i) { // Make sure the fields have distinct names. - form.fields[i].set_name(form.fields[i].name() + ASCIIToUTF16("_")); + form.fields[i].name = form.fields[i].name + ASCIIToUTF16("_"); } std::vector<FormData> forms(1, form); FormsSeen(forms); @@ -1496,7 +1496,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(string16(), results.fields[i].value); } // The first address section should be filled with Elvis's data. @@ -1521,7 +1521,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(string16(), results.fields[i].value); } // The second address section should be filled with Elvis's data. @@ -1530,9 +1530,9 @@ 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 name = secondSection.fields[i].name; string16 original_name = name.substr(0, name.size() - 1); - secondSection.fields[i].set_name(original_name); + secondSection.fields[i].name = original_name; } ExpectFilledAddressFormElvis(page_id, secondSection, kPageID2, false); } @@ -1544,7 +1544,7 @@ TEST_F(AutofillManagerTest, FillAutoFilledForm) { FormData form; CreateTestAddressFormData(&form); // Mark one of the address fields as autofilled. - form.fields[4].set_autofilled(true); + form.fields[4].is_autofilled = true; CreateTestCreditCardFormData(&form, true, false); std::vector<FormData> forms(1, form); FormsSeen(forms); @@ -1584,7 +1584,7 @@ TEST_F(AutofillManagerTest, FillAutoFilledForm) { for (std::vector<FormField>::iterator iter = form.fields.begin(); iter != form.fields.end(); ++iter) { - iter->set_autofilled(true); + iter->is_autofilled = true; } const int kPageID3 = 3; @@ -1615,23 +1615,23 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { FormField field; autofill_test::CreateTestFormField( "country code", "country code", "", "text", &field); - field.set_max_length(1); + field.max_length = 1; form.fields.push_back(field); autofill_test::CreateTestFormField( "area code", "area code", "", "text", &field); - field.set_max_length(3); + field.max_length = 3; form.fields.push_back(field); autofill_test::CreateTestFormField( "phone", "phone prefix", "1", "text", &field); - field.set_max_length(3); + field.max_length = 3; form.fields.push_back(field); autofill_test::CreateTestFormField( "-", "phone suffix", "", "text", &field); - field.set_max_length(4); + field.max_length = 4; form.fields.push_back(field); autofill_test::CreateTestFormField( "Phone Extension", "ext", "", "text", &field); - field.set_max_length(3); + field.max_length = 3; form.fields.push_back(field); std::vector<FormData> forms(1, form); @@ -1659,12 +1659,12 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { EXPECT_TRUE(GetAutoFillFormDataFilledMessage(&page_id, &results)); if (i != 7) { - EXPECT_EQ(ASCIIToUTF16(test_data), results.fields[2].value()); - EXPECT_EQ(ASCIIToUTF16(test_data), results.fields[3].value()); + EXPECT_EQ(ASCIIToUTF16(test_data), results.fields[2].value); + EXPECT_EQ(ASCIIToUTF16(test_data), results.fields[3].value); } else { // The only size that is parsed and split, right now is 7: - EXPECT_EQ(ASCIIToUTF16("123"), results.fields[2].value()); - EXPECT_EQ(ASCIIToUTF16("4567"), results.fields[3].value()); + EXPECT_EQ(ASCIIToUTF16("123"), results.fields[2].value); + EXPECT_EQ(ASCIIToUTF16("4567"), results.fields[3].value); } } diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc index 0ce01b2..b5897f2 100644 --- a/chrome/browser/autofill/autofill_merge_unittest.cc +++ b/chrome/browser/autofill/autofill_merge_unittest.cc @@ -198,7 +198,7 @@ void AutoFillMergeTest::MergeProfiles(const std::string& profiles, AutofillField* field = const_cast<AutofillField*>(form_structure.field(i)); AutofillFieldType type = - AutofillType::StringToFieldType(UTF16ToUTF8(field->name())); + AutofillType::StringToFieldType(UTF16ToUTF8(field->name)); field->set_heuristic_type(type); } std::vector<const FormStructure*> form_structures(1, &form_structure); diff --git a/chrome/browser/autofill/autofill_metrics_unittest.cc b/chrome/browser/autofill/autofill_metrics_unittest.cc index ce12e4f..44f0db5 100644 --- a/chrome/browser/autofill/autofill_metrics_unittest.cc +++ b/chrome/browser/autofill/autofill_metrics_unittest.cc @@ -225,7 +225,7 @@ TEST_F(AutofillMetricsTest, QualityMetrics) { FormField field; autofill_test::CreateTestFormField( "Autofilled", "autofilled", "Elvis Presley", "text", &field); - field.set_autofilled(true); + field.is_autofilled = true; form.fields.push_back(field); autofill_test::CreateTestFormField( "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field); @@ -395,7 +395,7 @@ TEST_F(AutofillMetricsTest, SaneMetricsWithCacheMismatch) { FormField field; autofill_test::CreateTestFormField( "Both match", "match", "Elvis Presley", "text", &field); - field.set_autofilled(true); + field.is_autofilled = true; form.fields.push_back(field); heuristic_types.push_back(NAME_FULL); server_types.push_back(NAME_FULL); @@ -484,7 +484,7 @@ TEST_F(AutofillMetricsTest, NoQualityMetricsForNonAutofillableForms) { FormField field; autofill_test::CreateTestFormField( "Autofilled", "autofilled", "Elvis Presley", "text", &field); - field.set_autofilled(true); + field.is_autofilled = true; form.fields.push_back(field); autofill_test::CreateTestFormField( "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field); @@ -520,7 +520,7 @@ TEST_F(AutofillMetricsTest, QualityMetricsWithExperimentId) { FormField field; autofill_test::CreateTestFormField( "Autofilled", "autofilled", "Elvis Presley", "text", &field); - field.set_autofilled(true); + field.is_autofilled = true; form.fields.push_back(field); autofill_test::CreateTestFormField( "Autofill Failed", "autofillfailed", "buddy@gmail.com", "text", &field); diff --git a/chrome/browser/autofill/credit_card_field.cc b/chrome/browser/autofill/credit_card_field.cc index 0a0ac43..79bf1fb 100644 --- a/chrome/browser/autofill/credit_card_field.cc +++ b/chrome/browser/autofill/credit_card_field.cc @@ -118,7 +118,7 @@ CreditCardField* CreditCardField::Parse( &credit_card_field->number_)) continue; - if ((*q) && LowerCaseEqualsASCII((*q)->form_control_type(), "month")) { + if ((*q) && LowerCaseEqualsASCII((*q)->form_control_type, "month")) { credit_card_field->expiration_month_ = *q++; } else { // "Expiration date" is the most common label here, but some pages have @@ -187,7 +187,7 @@ CreditCardField* CreditCardField::Parse( credit_card_field->expiration_month_ && (credit_card_field->expiration_year_ || (LowerCaseEqualsASCII( - credit_card_field->expiration_month_->form_control_type(), + credit_card_field->expiration_month_->form_control_type, "month")))) { *iter = q; return credit_card_field.release(); diff --git a/chrome/browser/autofill/form_field.cc b/chrome/browser/autofill/form_field.cc index c34e27d..1126fad 100644 --- a/chrome/browser/autofill/form_field.cc +++ b/chrome/browser/autofill/form_field.cc @@ -124,7 +124,7 @@ bool FormField::MatchName(AutofillField* field, const string16& pattern) { WebKit::WebRegularExpression re(WebKit::WebString(pattern), WebKit::WebTextCaseInsensitive); bool match = re.match( - WebKit::WebString(StringToLowerASCII(field->name()))) != -1; + WebKit::WebString(StringToLowerASCII(field->name))) != -1; return match; } @@ -135,7 +135,7 @@ bool FormField::MatchLabel(AutofillField* field, const string16& pattern) { WebKit::WebRegularExpression re(WebKit::WebString(pattern), WebKit::WebTextCaseInsensitive); bool match = re.match( - WebKit::WebString(StringToLowerASCII(field->label()))) != -1; + WebKit::WebString(StringToLowerASCII(field->label))) != -1; return match; } @@ -350,7 +350,7 @@ bool FormFieldSet::CheckECML(FormStructure* fields) { const string16 ecom(ASCIIToUTF16("ecom")); for (size_t index = 0; index < num_fields; ++index) { - const string16& utf16_name = fields->field(index)->name(); + const string16& utf16_name = fields->field(index)->name; if (StartsWith(utf16_name, ecom, true)) { std::string name(UTF16ToASCII(utf16_name)); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(form_fields); ++i) { diff --git a/chrome/browser/autofill/form_field_unittest.cc b/chrome/browser/autofill/form_field_unittest.cc index ef68eb8..9a0e291 100644 --- a/chrome/browser/autofill/form_field_unittest.cc +++ b/chrome/browser/autofill/form_field_unittest.cc @@ -15,68 +15,68 @@ TEST(FormFieldTest, Match) { EXPECT_TRUE(FormField::Match(&field, string16(), true)); // Empty pattern matches non-empty string. - field.set_label(ASCIIToUTF16("a")); + field.label = ASCIIToUTF16("a"); EXPECT_TRUE(FormField::Match(&field, string16(), true)); // Strictly empty pattern matches empty string. - field.set_label(ASCIIToUTF16("")); + field.label = ASCIIToUTF16(""); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("^$"), true)); // Strictly empty pattern does not match non-empty string. - field.set_label(ASCIIToUTF16("a")); + field.label = ASCIIToUTF16("a"); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("^$"), true)); // Non-empty pattern doesn't match empty string. - field.set_label(string16()); + field.label = string16(); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("a"), true)); // Beginning of line. - field.set_label(ASCIIToUTF16("head_tail")); + field.label = ASCIIToUTF16("head_tail"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("^head"), true)); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("^tail"), true)); // End of line. - field.set_label(ASCIIToUTF16("head_tail")); + field.label = ASCIIToUTF16("head_tail"); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("head$"), true)); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("tail$"), true)); // Exact. - field.set_label(ASCIIToUTF16("head_tail")); + field.label = ASCIIToUTF16("head_tail"); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("^head$"), true)); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("^tail$"), true)); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("^head_tail$"), true)); // Escaped dots. - field.set_label(ASCIIToUTF16("m.i.")); + field.label = ASCIIToUTF16("m.i."); // Note: This pattern is misleading as the "." characters are wild cards. EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("m.i."), true)); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("m\\.i\\."), true)); - field.set_label(ASCIIToUTF16("mXiX")); + field.label = ASCIIToUTF16("mXiX"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("m.i."), true)); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("m\\.i\\."), true)); // Repetition. - field.set_label(ASCIIToUTF16("headtail")); + field.label = ASCIIToUTF16("headtail"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("head.*tail"), true)); - field.set_label(ASCIIToUTF16("headXtail")); + field.label = ASCIIToUTF16("headXtail"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("head.*tail"), true)); - field.set_label(ASCIIToUTF16("headXXXtail")); + field.label = ASCIIToUTF16("headXXXtail"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("head.*tail"), true)); - field.set_label(ASCIIToUTF16("headtail")); + field.label = ASCIIToUTF16("headtail"); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("head.+tail"), true)); - field.set_label(ASCIIToUTF16("headXtail")); + field.label = ASCIIToUTF16("headXtail"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("head.+tail"), true)); - field.set_label(ASCIIToUTF16("headXXXtail")); + field.label = ASCIIToUTF16("headXXXtail"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("head.+tail"), true)); // Alternation. - field.set_label(ASCIIToUTF16("head_tail")); + field.label = ASCIIToUTF16("head_tail"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("head|other"), true)); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("tail|other"), true)); EXPECT_FALSE(FormField::Match(&field, ASCIIToUTF16("bad|good"), true)); // Case sensitivity. - field.set_label(ASCIIToUTF16("xxxHeAd_tAiLxxx")); + field.label = ASCIIToUTF16("xxxHeAd_tAiLxxx"); EXPECT_TRUE(FormField::Match(&field, ASCIIToUTF16("head_tail"), true)); } diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index cef629d..a6a64dd 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -58,10 +58,10 @@ FormStructure::FormStructure(const FormData& form) // Add all supported form fields (including with empty names) to the // signature. This is a requirement for AutoFill servers. form_signature_field_names_.append("&"); - form_signature_field_names_.append(UTF16ToUTF8(field->name())); + form_signature_field_names_.append(UTF16ToUTF8(field->name)); // Generate a unique name for this field by appending a counter to the name. - string16 unique_name = field->name() + + string16 unique_name = field->name + base::IntToString16(fields_.size() + 1); fields_.push_back(new AutofillField(*field, unique_name)); } diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc index 7962529..392507a 100644 --- a/chrome/browser/autofill/personal_data_manager.cc +++ b/chrome/browser/autofill/personal_data_manager.cc @@ -182,7 +182,7 @@ bool PersonalDataManager::ImportFormData( const FormStructure* form = *iter; for (size_t i = 0; i < form->field_count(); ++i) { const AutofillField* field = form->field(i); - string16 value = CollapseWhitespace(field->value(), false); + 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. @@ -196,7 +196,7 @@ bool PersonalDataManager::ImportFormData( // If the user has a password set, we have no way of setting credit // card numbers. if (!HasPassword()) { - if (LowerCaseEqualsASCII(field->form_control_type(), "month")) { + if (LowerCaseEqualsASCII(field->form_control_type, "month")) { DCHECK_EQ(CREDIT_CARD_EXP_MONTH, field_type.field_type()); local_imported_credit_card->SetInfoForMonthInputType(value); } else { diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc index a075abc..9eca163 100644 --- a/chrome/browser/autofill/personal_data_manager_unittest.cc +++ b/chrome/browser/autofill/personal_data_manager_unittest.cc @@ -651,15 +651,15 @@ TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) { form.fields.push_back(field); autofill_test::CreateTestFormField( "Phone #:", "home_phone_area_code", "650", "text", &field); - field.set_max_length(3); + field.max_length = 3; form.fields.push_back(field); autofill_test::CreateTestFormField( "Phone #:", "home_phone_prefix", "555", "text", &field); - field.set_max_length(3); + field.max_length = 3; form.fields.push_back(field); autofill_test::CreateTestFormField( "Phone #:", "home_phone_suffix", "0000", "text", &field); - field.set_max_length(4); + field.max_length = 4; form.fields.push_back(field); autofill_test::CreateTestFormField( "Address:", "address1", "21 Laussat St", "text", &field); diff --git a/chrome/browser/autofill/phone_field.cc b/chrome/browser/autofill/phone_field.cc index cd7e493..8b59203 100644 --- a/chrome/browser/autofill/phone_field.cc +++ b/chrome/browser/autofill/phone_field.cc @@ -281,9 +281,9 @@ bool PhoneField::ParseInternal( &parsed_fields[phone_field_grammars_[i].phone_part])) break; if (phone_field_grammars_[i].max_size && - (!parsed_fields[phone_field_grammars_[i].phone_part]->max_length() || + (!parsed_fields[phone_field_grammars_[i].phone_part]->max_length || phone_field_grammars_[i].max_size < - parsed_fields[phone_field_grammars_[i].phone_part]->max_length())) { + parsed_fields[phone_field_grammars_[i].phone_part]->max_length)) { break; } } diff --git a/chrome/browser/autofill/select_control_handler.cc b/chrome/browser/autofill/select_control_handler.cc index cf1ed31..b92433a 100644 --- a/chrome/browser/autofill/select_control_handler.cc +++ b/chrome/browser/autofill/select_control_handler.cc @@ -125,10 +125,10 @@ bool SetSelectControlValue(const string16& value, string16 value_lowercase = StringToLowerASCII(value); for (std::vector<string16>::const_iterator iter = - field->option_strings().begin(); - iter != field->option_strings().end(); ++iter) { + field->option_strings.begin(); + iter != field->option_strings.end(); ++iter) { if (value_lowercase == StringToLowerASCII(*iter)) { - field->set_value(*iter); + field->value = *iter; return true; } } @@ -165,13 +165,13 @@ bool FillCountrySelectControl(const FormGroup& form_group, std::string app_locale = AutofillCountry::ApplicationLocale(); for (std::vector<string16>::const_iterator iter = - field->option_strings().begin(); - iter != field->option_strings().end(); + field->option_strings.begin(); + iter != field->option_strings.end(); ++iter) { // Canonicalize each <option> value to a country code, and compare to the // target country code. if (country_code == AutofillCountry::GetCountryCode(*iter, app_locale)) { - field->set_value(*iter); + field->value = *iter; return true; } } @@ -202,30 +202,30 @@ void FillSelectControl(const FormGroup& form_group, AutofillType type, webkit_glue::FormField* field) { DCHECK(field); - DCHECK_EQ(ASCIIToUTF16("select-one"), field->form_control_type()); + DCHECK_EQ(ASCIIToUTF16("select-one"), field->form_control_type); string16 field_text = form_group.GetFieldText(type); if (field_text.empty()) return; string16 value; - for (size_t i = 0; i < field->option_strings().size(); ++i) { - if (field_text == field->option_strings()[i]) { + for (size_t i = 0; i < field->option_strings.size(); ++i) { + if (field_text == field->option_strings[i]) { // An exact match, use it. value = field_text; break; } - if (StringToLowerASCII(field->option_strings()[i]) == + if (StringToLowerASCII(field->option_strings[i]) == StringToLowerASCII(field_text)) { // A match, but not in the same case. Save it in case an exact match is // not found. - value = field->option_strings()[i]; + value = field->option_strings[i]; } } if (!value.empty()) { - field->set_value(value); + field->value = value; return; } diff --git a/chrome/browser/autofill/select_control_handler.h b/chrome/browser/autofill/select_control_handler.h index bb27148..f920af8 100644 --- a/chrome/browser/autofill/select_control_handler.h +++ b/chrome/browser/autofill/select_control_handler.h @@ -11,7 +11,7 @@ class FormGroup; namespace webkit_glue { -class FormField; +struct FormField; } // namespace webkit_glue namespace autofill { diff --git a/chrome/browser/autofill/select_control_handler_unittest.cc b/chrome/browser/autofill/select_control_handler_unittest.cc index c2edd8c..a11859b 100644 --- a/chrome/browser/autofill/select_control_handler_unittest.cc +++ b/chrome/browser/autofill/select_control_handler_unittest.cc @@ -19,15 +19,15 @@ TEST(SelectControlHandlerTest, CreditCardMonthExact) { options[i] = ASCIIToUTF16(kMonthsNumeric[i]); webkit_glue::FormField field; - field.set_form_control_type(ASCIIToUTF16("select-one")); - field.set_option_strings(options); + field.form_control_type = ASCIIToUTF16("select-one"); + field.option_strings = options; CreditCard credit_card; credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); autofill::FillSelectControl(credit_card, AutofillType(CREDIT_CARD_EXP_MONTH), &field); - EXPECT_EQ(ASCIIToUTF16("01"), field.value()); + EXPECT_EQ(ASCIIToUTF16("01"), field.value); } TEST(SelectControlHandlerTest, CreditCardMonthAbbreviated) { @@ -40,15 +40,15 @@ TEST(SelectControlHandlerTest, CreditCardMonthAbbreviated) { options[i] = ASCIIToUTF16(kMonthsAbbreviated[i]); webkit_glue::FormField field; - field.set_form_control_type(ASCIIToUTF16("select-one")); - field.set_option_strings(options); + field.form_control_type = ASCIIToUTF16("select-one"); + field.option_strings = options; CreditCard credit_card; credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); autofill::FillSelectControl(credit_card, AutofillType(CREDIT_CARD_EXP_MONTH), &field); - EXPECT_EQ(ASCIIToUTF16("Jan"), field.value()); + EXPECT_EQ(ASCIIToUTF16("Jan"), field.value); } TEST(SelectControlHandlerTest, CreditCardMonthFull) { @@ -61,15 +61,15 @@ TEST(SelectControlHandlerTest, CreditCardMonthFull) { options[i] = ASCIIToUTF16(kMonthsFull[i]); webkit_glue::FormField field; - field.set_form_control_type(ASCIIToUTF16("select-one")); - field.set_option_strings(options); + field.form_control_type = ASCIIToUTF16("select-one"); + field.option_strings = options; CreditCard credit_card; credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); autofill::FillSelectControl(credit_card, AutofillType(CREDIT_CARD_EXP_MONTH), &field); - EXPECT_EQ(ASCIIToUTF16("January"), field.value()); + EXPECT_EQ(ASCIIToUTF16("January"), field.value); } TEST(SelectControlHandlerTest, CreditCardMonthNumeric) { @@ -81,15 +81,15 @@ TEST(SelectControlHandlerTest, CreditCardMonthNumeric) { options[i] = ASCIIToUTF16(kMonthsNumeric[i]); webkit_glue::FormField field; - field.set_form_control_type(ASCIIToUTF16("select-one")); - field.set_option_strings(options); + field.form_control_type = ASCIIToUTF16("select-one"); + field.option_strings = options; CreditCard credit_card; credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); autofill::FillSelectControl(credit_card, AutofillType(CREDIT_CARD_EXP_MONTH), &field); - EXPECT_EQ(ASCIIToUTF16("1"), field.value()); + EXPECT_EQ(ASCIIToUTF16("1"), field.value); } TEST(SelectControlHandlerTest, AddressCountryFull) { @@ -101,15 +101,15 @@ TEST(SelectControlHandlerTest, AddressCountryFull) { options[i] = ASCIIToUTF16(kCountries[i]); webkit_glue::FormField field; - field.set_form_control_type(ASCIIToUTF16("select-one")); - field.set_option_strings(options); + field.form_control_type = ASCIIToUTF16("select-one"); + field.option_strings = options; AutoFillProfile profile; profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("CA")); autofill::FillSelectControl(profile, AutofillType(ADDRESS_HOME_COUNTRY), &field); - EXPECT_EQ(ASCIIToUTF16("Canada"), field.value()); + EXPECT_EQ(ASCIIToUTF16("Canada"), field.value); } TEST(SelectControlHandlerTest, AddressCountryAbbrev) { @@ -121,15 +121,15 @@ TEST(SelectControlHandlerTest, AddressCountryAbbrev) { options[i] = ASCIIToUTF16(kCountries[i]); webkit_glue::FormField field; - field.set_form_control_type(ASCIIToUTF16("select-one")); - field.set_option_strings(options); + field.form_control_type = ASCIIToUTF16("select-one"); + field.option_strings = options; AutoFillProfile profile; profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("Canada")); autofill::FillSelectControl(profile, AutofillType(ADDRESS_HOME_COUNTRY), &field); - EXPECT_EQ(ASCIIToUTF16("CA"), field.value()); + EXPECT_EQ(ASCIIToUTF16("CA"), field.value); } TEST(SelectControlHandlerTest, AddressStateFull) { @@ -141,15 +141,15 @@ TEST(SelectControlHandlerTest, AddressStateFull) { options[i] = ASCIIToUTF16(kStates[i]); webkit_glue::FormField field; - field.set_form_control_type(ASCIIToUTF16("select-one")); - field.set_option_strings(options); + field.form_control_type = ASCIIToUTF16("select-one"); + field.option_strings = options; AutoFillProfile profile; profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("CA")); autofill::FillSelectControl(profile, AutofillType(ADDRESS_HOME_STATE), &field); - EXPECT_EQ(ASCIIToUTF16("California"), field.value()); + EXPECT_EQ(ASCIIToUTF16("California"), field.value); } TEST(SelectControlHandlerTest, AddressStateAbbrev) { @@ -161,13 +161,13 @@ TEST(SelectControlHandlerTest, AddressStateAbbrev) { options[i] = ASCIIToUTF16(kStates[i]); webkit_glue::FormField field; - field.set_form_control_type(ASCIIToUTF16("select-one")); - field.set_option_strings(options); + field.form_control_type = ASCIIToUTF16("select-one"); + field.option_strings = options; AutoFillProfile profile; profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), ASCIIToUTF16("California")); autofill::FillSelectControl(profile, AutofillType(ADDRESS_HOME_STATE), &field); - EXPECT_EQ(ASCIIToUTF16("CA"), field.value()); + EXPECT_EQ(ASCIIToUTF16("CA"), field.value); } diff --git a/chrome/browser/chromeos/login/account_creation_view.cc b/chrome/browser/chromeos/login/account_creation_view.cc index d9d5124..1f0a3a6 100644 --- a/chrome/browser/chromeos/login/account_creation_view.cc +++ b/chrome/browser/chromeos/login/account_creation_view.cc @@ -51,11 +51,11 @@ class AccountCreationTabContents : public WizardWebPageViewTabContents { std::string user_name; std::string domain; for (size_t i = 0; i < form.fields.size(); i++) { - std::string name = UTF16ToASCII(form.fields[i].name()); + std::string name = UTF16ToASCII(form.fields[i].name); if (name == kEmailFieldName) { - user_name = UTF16ToASCII(form.fields[i].value()); + user_name = UTF16ToASCII(form.fields[i].value); } else if (name == kDomainFieldName) { - domain = UTF16ToASCII(form.fields[i].value()); + domain = UTF16ToASCII(form.fields[i].value); } } if (!user_name.empty()) { diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index 5ec1cb0..167c830d 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -1401,10 +1401,10 @@ bool WebDatabase::AddFormFieldValuesTime(const std::vector<FormField>& elements, itr++) { if (seen_names.size() >= kMaximumUniqueNames) break; - if (seen_names.find(itr->name()) != seen_names.end()) + if (seen_names.find(itr->name) != seen_names.end()) continue; result = result && AddFormFieldValueTime(*itr, changes, time); - seen_names.insert(itr->name()); + seen_names.insert(itr->name); } return result; } @@ -1443,8 +1443,8 @@ bool WebDatabase::GetIDAndCountOfFormElement( return false; } - s.BindString16(0, element.name()); - s.BindString16(1, element.value()); + s.BindString16(0, element.name); + s.BindString16(1, element.value); *pair_id = 0; *count = 0; @@ -1622,9 +1622,9 @@ bool WebDatabase::InsertFormElement(const FormField& element, return false; } - s.BindString16(0, element.name()); - s.BindString16(1, element.value()); - s.BindString16(2, l10n_util::ToLower(element.value())); + s.BindString16(0, element.name); + s.BindString16(1, element.value); + s.BindString16(2, l10n_util::ToLower(element.value)); if (!s.Run()) { NOTREACHED(); @@ -1701,7 +1701,7 @@ bool WebDatabase::AddFormFieldValueTime(const FormField& element, count == 0 ? AutofillChange::ADD : AutofillChange::UPDATE; changes->push_back( AutofillChange(change_type, - AutofillKey(element.name(), element.value()))); + AutofillKey(element.name, element.value))); return true; } diff --git a/chrome/browser/webdata/web_database.h b/chrome/browser/webdata/web_database.h index 7e315bc..6aeca08 100644 --- a/chrome/browser/webdata/web_database.h +++ b/chrome/browser/webdata/web_database.h @@ -32,7 +32,7 @@ class Time; } namespace webkit_glue { -class FormField; +struct FormField; struct PasswordForm; } diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index d2e6f9d..f1a6c1c 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -29,7 +29,6 @@ 'common/app_mode_common_mac.mm', 'common/auto_start_linux.cc', 'common/auto_start_linux.h', - 'common/autofill_messages.cc', 'common/autofill_messages.h', 'common/bindings_policy.h', 'common/child_process_info.cc', diff --git a/chrome/common/autofill_messages.cc b/chrome/common/autofill_messages.cc deleted file mode 100644 index 1243f1f..0000000 --- a/chrome/common/autofill_messages.cc +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/common_param_traits.h" -#include "content/common/common_param_traits.h" -#include "webkit/glue/form_data.h" -#include "webkit/glue/form_field.h" -#include "webkit/glue/password_form.h" -#include "webkit/glue/password_form_dom_manager.h" - -#define IPC_MESSAGE_IMPL -#include "chrome/common/autofill_messages.h" - -namespace IPC { - -void ParamTraits<webkit_glue::FormField>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.label()); - WriteParam(m, p.name()); - WriteParam(m, p.value()); - WriteParam(m, p.form_control_type()); - WriteParam(m, p.max_length()); - WriteParam(m, p.is_autofilled()); - WriteParam(m, p.option_strings()); -} - -bool ParamTraits<webkit_glue::FormField>::Read(const Message* m, void** iter, - param_type* p) { - string16 label, name, value, form_control_type; - int max_length = 0; - bool is_autofilled; - std::vector<string16> options; - bool result = ReadParam(m, iter, &label); - result = result && ReadParam(m, iter, &name); - result = result && ReadParam(m, iter, &value); - result = result && ReadParam(m, iter, &form_control_type); - result = result && ReadParam(m, iter, &max_length); - result = result && ReadParam(m, iter, &is_autofilled); - result = result && ReadParam(m, iter, &options); - if (!result) - return false; - - p->set_label(label); - p->set_name(name); - p->set_value(value); - p->set_form_control_type(form_control_type); - p->set_max_length(max_length); - p->set_autofilled(is_autofilled); - p->set_option_strings(options); - return true; -} - -void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, - std::string* l) { - l->append("<FormField>"); -} - -void ParamTraits<webkit_glue::FormData>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.name); - WriteParam(m, p.method); - WriteParam(m, p.origin); - WriteParam(m, p.action); - WriteParam(m, p.user_submitted); - WriteParam(m, p.fields); -} - -bool ParamTraits<webkit_glue::FormData>::Read(const Message* m, void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->name) && - ReadParam(m, iter, &p->method) && - ReadParam(m, iter, &p->origin) && - ReadParam(m, iter, &p->action) && - ReadParam(m, iter, &p->user_submitted) && - ReadParam(m, iter, &p->fields); -} - -void ParamTraits<webkit_glue::FormData>::Log(const param_type& p, - std::string* l) { - l->append("<FormData>"); -} - -void ParamTraits<webkit_glue::PasswordFormFillData>::Write( - Message* m, const param_type& p) { - WriteParam(m, p.basic_data); - WriteParam(m, p.additional_logins); - WriteParam(m, p.wait_for_username); -} - -bool ParamTraits<webkit_glue::PasswordFormFillData>::Read( - const Message* m, void** iter, param_type* r) { - return - ReadParam(m, iter, &r->basic_data) && - ReadParam(m, iter, &r->additional_logins) && - ReadParam(m, iter, &r->wait_for_username); -} - -void ParamTraits<webkit_glue::PasswordFormFillData>::Log(const param_type& p, - std::string* l) { - l->append("<PasswordFormFillData>"); -} - -} // namespace IPC diff --git a/chrome/common/autofill_messages.h b/chrome/common/autofill_messages.h index dd1776f..cd86d75 100644 --- a/chrome/common/autofill_messages.h +++ b/chrome/common/autofill_messages.h @@ -2,52 +2,43 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_AUTOFILL_MESSAGES_H_ -#define CHROME_COMMON_AUTOFILL_MESSAGES_H_ -#pragma once +// Multiply-included message file, hence no include guard. #include <string> +#include "chrome/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" +#include "webkit/glue/form_data.h" +#include "webkit/glue/form_field.h" +#include "webkit/glue/password_form.h" +#include "webkit/glue/password_form_dom_manager.h" #define IPC_MESSAGE_START AutoFillMsgStart -namespace webkit_glue { -class FormField; -struct FormData; -struct PasswordForm; -struct PasswordFormFillData; -} - -namespace IPC { - -template <> -struct ParamTraits<webkit_glue::FormField> { - typedef webkit_glue::FormField param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - - -// Traits for FormData structure to pack/unpack. -template <> -struct ParamTraits<webkit_glue::FormData> { - typedef webkit_glue::FormData param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<webkit_glue::PasswordFormFillData> { - typedef webkit_glue::PasswordFormFillData param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -} // namespace IPC +IPC_STRUCT_TRAITS_BEGIN(webkit_glue::FormField) + IPC_STRUCT_TRAITS_MEMBER(label) + IPC_STRUCT_TRAITS_MEMBER(name) + IPC_STRUCT_TRAITS_MEMBER(value) + IPC_STRUCT_TRAITS_MEMBER(form_control_type) + IPC_STRUCT_TRAITS_MEMBER(max_length) + IPC_STRUCT_TRAITS_MEMBER(is_autofilled) + IPC_STRUCT_TRAITS_MEMBER(option_strings) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(webkit_glue::FormData) + IPC_STRUCT_TRAITS_MEMBER(name) + IPC_STRUCT_TRAITS_MEMBER(method) + IPC_STRUCT_TRAITS_MEMBER(origin) + IPC_STRUCT_TRAITS_MEMBER(action) + IPC_STRUCT_TRAITS_MEMBER(user_submitted) + IPC_STRUCT_TRAITS_MEMBER(fields) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(webkit_glue::PasswordFormFillData) + IPC_STRUCT_TRAITS_MEMBER(basic_data) + IPC_STRUCT_TRAITS_MEMBER(additional_logins) + IPC_STRUCT_TRAITS_MEMBER(wait_for_username) +IPC_STRUCT_TRAITS_END() // AutoFill messages sent from the browser to the renderer. @@ -122,4 +113,4 @@ IPC_MESSAGE_ROUTED2(AutoFillHostMsg_RemoveAutocompleteEntry, // Instructs the browser to show the AutoFill dialog. IPC_MESSAGE_ROUTED0(AutoFillHostMsg_ShowAutoFillDialog) -#endif // CHROME_COMMON_AUTOFILL_MESSAGES_H_ + diff --git a/chrome/common/common_message_generator.h b/chrome/common/common_message_generator.h index a59e82e..c8abe08 100644 --- a/chrome/common/common_message_generator.h +++ b/chrome/common/common_message_generator.h @@ -4,6 +4,7 @@ // Multiply-included file, hence no include guard. +#include "chrome/common/autofill_messages.h" #include "chrome/common/database_messages.h" #include "chrome/common/file_utilities_messages.h" #include "chrome/common/indexed_db_messages.h" @@ -15,7 +16,6 @@ #if 0 // This feature is not yet enabled for these files. -#include "chrome/common/autofill_messages.h" #include "chrome/common/automation_messages.h" #include "chrome/common/devtools_messages.h" #include "chrome/common/dom_storage_messages.h" diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc index da8e2c3..2c087a6 100644 --- a/chrome/renderer/autofill/autofill_agent.cc +++ b/chrome/renderer/autofill/autofill_agent.cc @@ -351,7 +351,7 @@ void AutoFillAgent::FillAutoFillFormData(const WebNode& node, return; autofill_action_ = action; - was_query_node_autofilled_ = field.is_autofilled(); + was_query_node_autofilled_ = field.is_autofilled; Send(new AutoFillHostMsg_FillAutoFillFormData( routing_id(), autofill_query_id_, form, field, unique_id)); } @@ -381,7 +381,7 @@ bool AutoFillAgent::FindFormAndFieldForNode(const WebNode& node, // label, so find the label here. // TODO(jhawkins): Add form and field identities so we can use the cached form // data in FormManager. - field->set_label(FormManager::LabelForElement(element)); + field->label = FormManager::LabelForElement(element); return true; } diff --git a/chrome/renderer/autofill/form_autocomplete_browsertest.cc b/chrome/renderer/autofill/form_autocomplete_browsertest.cc index 1041e76..15b4c92 100644 --- a/chrome/renderer/autofill/form_autocomplete_browsertest.cc +++ b/chrome/renderer/autofill/form_autocomplete_browsertest.cc @@ -40,12 +40,12 @@ TEST_F(FormAutocompleteTest, NormalFormSubmit) { ASSERT_EQ(2U, forms.a.fields.size()); webkit_glue::FormField& form_field = forms.a.fields[0]; - EXPECT_EQ(WebString("fname"), form_field.name()); - EXPECT_EQ(WebString("Rick"), form_field.value()); + EXPECT_EQ(WebString("fname"), form_field.name); + EXPECT_EQ(WebString("Rick"), form_field.value); form_field = forms.a.fields[1]; - EXPECT_EQ(WebString("lname"), form_field.name()); - EXPECT_EQ(WebString("Deckard"), form_field.value()); + EXPECT_EQ(WebString("lname"), form_field.name); + EXPECT_EQ(WebString("Deckard"), form_field.value); } // Tests that submitting a form that has autocomplete="off" does not generate a @@ -88,8 +88,8 @@ TEST_F(FormAutocompleteTest, AutoCompleteOffInputSubmit) { ASSERT_EQ(1U, forms.a.fields.size()); webkit_glue::FormField& form_field = forms.a.fields[0]; - EXPECT_EQ(WebString("fname"), form_field.name()); - EXPECT_EQ(WebString("Rick"), form_field.value()); + EXPECT_EQ(WebString("fname"), form_field.name); + EXPECT_EQ(WebString("Rick"), form_field.value); } // Tests that submitting a form that has been dynamically set as autocomplete diff --git a/chrome/renderer/autofill/form_manager.cc b/chrome/renderer/autofill/form_manager.cc index 5c41eb6..889b4cc 100644 --- a/chrome/renderer/autofill/form_manager.cc +++ b/chrome/renderer/autofill/form_manager.cc @@ -334,23 +334,23 @@ void FormManager::WebFormControlElementToFormField( // The label is not officially part of a WebFormControlElement; however, the // labels for all form control elements are scraped from the DOM and set in // WebFormElementToFormData. - field->set_name(element.nameForAutofill()); - field->set_form_control_type(element.formControlType()); + field->name = element.nameForAutofill(); + field->form_control_type = element.formControlType(); if (!IsAutoFillableElement(element)) return; const WebInputElement* input_element = toWebInputElement(&element); if (IsTextInput(input_element)) { - field->set_max_length(input_element->maxLength()); - field->set_autofilled(input_element->isAutofilled()); + field->max_length = input_element->maxLength(); + field->is_autofilled = input_element->isAutofilled(); } else if (extract_mask & EXTRACT_OPTIONS) { // Set option strings on the field if available. DCHECK(IsSelectElement(element)); const WebSelectElement select_element = element.toConst<WebSelectElement>(); std::vector<string16> option_strings; GetOptionStringsFromElement(select_element, &option_strings); - field->set_option_strings(option_strings); + field->option_strings = option_strings; } if (!(extract_mask & EXTRACT_VALUE)) @@ -387,7 +387,7 @@ void FormManager::WebFormControlElementToFormField( if (value.size() > kMaxDataLength) value = value.substr(0, kMaxDataLength); - field->set_value(value); + field->value = value; } // static @@ -468,7 +468,7 @@ bool FormManager::WebFormElementToFormData(const WebFormElement& element, // TODO(jhawkins): A label element is mapped to a form control element's id. // field->name() will contain the id only if the name does not exist. Add // an id() method to WebFormControlElement and use that here. - name_map[field->name()] = field; + name_map[field->name] = field; fields_extracted[i] = true; } @@ -494,7 +494,7 @@ bool FormManager::WebFormElementToFormData(const WebFormElement& element, std::map<string16, FormField*>::iterator iter = name_map.find(field_element.nameForAutofill()); if (iter != name_map.end()) - iter->second->set_label(FindChildText(label)); + iter->second->label = FindChildText(label); } // Loop through the form control elements, extracting the label text from the @@ -509,8 +509,8 @@ bool FormManager::WebFormElementToFormData(const WebFormElement& element, continue; const WebFormControlElement& control_element = control_elements[i]; - if (form_fields[field_idx]->label().empty()) - form_fields[field_idx]->set_label(InferLabelForElement(control_element)); + if (form_fields[field_idx]->label.empty()) + form_fields[field_idx]->label = InferLabelForElement(control_element); ++field_idx; } @@ -833,13 +833,13 @@ void FormManager::ForEachMatchingFormField(FormElement* form, // Search forward in the |form| for a corresponding field. size_t k = j; - while (k < data.fields.size() && element_name != data.fields[k].name()) + while (k < data.fields.size() && element_name != data.fields[k].name) k++; if (k >= data.fields.size()) continue; - DCHECK_EQ(data.fields[k].name(), element_name); + DCHECK_EQ(data.fields[k].name, element_name); bool is_initiating_node = false; @@ -880,7 +880,7 @@ void FormManager::FillFormField(WebFormControlElement* field, const FormField* data, bool is_initiating_node) { // Nothing to fill. - if (data->value().empty()) + if (data->value.empty()) return; WebInputElement* input_element = toWebInputElement(field); @@ -888,7 +888,7 @@ void FormManager::FillFormField(WebFormControlElement* field, // If the maxlength attribute contains a negative value, maxLength() // returns the default maxlength value. input_element->setValue( - data->value().substr(0, input_element->maxLength())); + data->value.substr(0, input_element->maxLength())); input_element->setAutofilled(true); if (is_initiating_node) { int length = input_element->value().length(); @@ -897,7 +897,7 @@ void FormManager::FillFormField(WebFormControlElement* field, } else { DCHECK(IsSelectElement(*field)); WebSelectElement select_element = field->to<WebSelectElement>(); - select_element.setValue(data->value()); + select_element.setValue(data->value); } } @@ -905,7 +905,7 @@ void FormManager::PreviewFormField(WebFormControlElement* field, const FormField* data, bool is_initiating_node) { // Nothing to preview. - if (data->value().empty()) + if (data->value.empty()) return; // Only preview input fields. @@ -916,7 +916,7 @@ void FormManager::PreviewFormField(WebFormControlElement* field, // If the maxlength attribute contains a negative value, maxLength() // returns the default maxlength value. input_element->setSuggestedValue( - data->value().substr(0, input_element->maxLength())); + data->value.substr(0, input_element->maxLength())); input_element->setAutofilled(true); if (is_initiating_node) { // Select the part of the text that the user didn't type. diff --git a/chrome/renderer/autofill/form_manager.h b/chrome/renderer/autofill/form_manager.h index 18110c3..0558bbb 100644 --- a/chrome/renderer/autofill/form_manager.h +++ b/chrome/renderer/autofill/form_manager.h @@ -16,7 +16,7 @@ namespace webkit_glue { struct FormData; -class FormField; +struct FormField; } // namespace webkit_glue namespace WebKit { diff --git a/chrome/renderer/autofill/form_manager_browsertest.cc b/chrome/renderer/autofill/form_manager_browsertest.cc index a89b6ba..d8e18ba 100644 --- a/chrome/renderer/autofill/form_manager_browsertest.cc +++ b/chrome/renderer/autofill/form_manager_browsertest.cc @@ -249,9 +249,9 @@ TEST_F(FormManagerTest, WebFormControlElementToFormFieldSelect) { ASCIIToUTF16("select-one"), 0, false))); - ASSERT_EQ(2U, result3.option_strings().size()); - EXPECT_EQ(ASCIIToUTF16("CA"), result3.option_strings()[0]); - EXPECT_EQ(ASCIIToUTF16("TX"), result3.option_strings()[1]); + ASSERT_EQ(2U, result3.option_strings.size()); + EXPECT_EQ(ASCIIToUTF16("CA"), result3.option_strings[0]); + EXPECT_EQ(ASCIIToUTF16("TX"), result3.option_strings[1]); } // We should be not extract the value for non-text and non-select fields. @@ -793,11 +793,11 @@ TEST_F(FormManagerTest, FillForm) { fields[4]); // Fill the form. - form.fields[0].set_value(ASCIIToUTF16("Wyatt")); - form.fields[1].set_value(ASCIIToUTF16("Earp")); - form.fields[2].set_value(ASCIIToUTF16("Alpha")); - form.fields[3].set_value(ASCIIToUTF16("Beta")); - form.fields[4].set_value(ASCIIToUTF16("Gamma")); + form.fields[0].value = ASCIIToUTF16("Wyatt"); + form.fields[1].value = ASCIIToUTF16("Earp"); + form.fields[2].value = ASCIIToUTF16("Alpha"); + form.fields[3].value = ASCIIToUTF16("Beta"); + form.fields[4].value = ASCIIToUTF16("Gamma"); EXPECT_TRUE(form_manager.FillForm(form, input_element)); // Verify the filled elements. @@ -905,11 +905,11 @@ TEST_F(FormManagerTest, PreviewForm) { fields[4]); // Preview the form. - form.fields[0].set_value(ASCIIToUTF16("Wyatt")); - form.fields[1].set_value(ASCIIToUTF16("Earp")); - form.fields[2].set_value(ASCIIToUTF16("Alpha")); - form.fields[3].set_value(ASCIIToUTF16("Beta")); - form.fields[4].set_value(ASCIIToUTF16("Gamma")); + form.fields[0].value = ASCIIToUTF16("Wyatt"); + form.fields[1].value = ASCIIToUTF16("Earp"); + form.fields[2].value = ASCIIToUTF16("Alpha"); + form.fields[3].value = ASCIIToUTF16("Beta"); + form.fields[4].value = ASCIIToUTF16("Gamma"); EXPECT_TRUE(form_manager.PreviewForm(form, input_element)); // Verify the previewed elements. @@ -1484,9 +1484,9 @@ TEST_F(FormManagerTest, FillFormMaxLength) { fields[2]); // Fill the form. - form.fields[0].set_value(ASCIIToUTF16("Brother")); - form.fields[1].set_value(ASCIIToUTF16("Jonathan")); - form.fields[2].set_value(ASCIIToUTF16("brotherj@example.com")); + form.fields[0].value = ASCIIToUTF16("Brother"); + form.fields[1].value = ASCIIToUTF16("Jonathan"); + form.fields[2].value = ASCIIToUTF16("brotherj@example.com"); EXPECT_TRUE(form_manager.FillForm(form, WebNode())); // Find the newly-filled form that contains the input element. @@ -1578,9 +1578,9 @@ TEST_F(FormManagerTest, FillFormNegativeMaxLength) { fields[2]); // Fill the form. - form.fields[0].set_value(ASCIIToUTF16("Brother")); - form.fields[1].set_value(ASCIIToUTF16("Jonathan")); - form.fields[2].set_value(ASCIIToUTF16("brotherj@example.com")); + form.fields[0].value = ASCIIToUTF16("Brother"); + form.fields[1].value = ASCIIToUTF16("Jonathan"); + form.fields[2].value = ASCIIToUTF16("brotherj@example.com"); EXPECT_TRUE(form_manager.FillForm(form, WebNode())); // Find the newly-filled form that contains the input element. @@ -1681,13 +1681,13 @@ TEST_F(FormManagerTest, FillFormMoreFormDataFields) { form->fields.insert(form->fields.begin() + 6, field4); // Fill the form. - form->fields[0].set_value(ASCIIToUTF16("Alpha")); - form->fields[1].set_value(ASCIIToUTF16("Brother")); - form->fields[2].set_value(ASCIIToUTF16("Abracadabra")); - form->fields[3].set_value(ASCIIToUTF16("Joseph")); - form->fields[4].set_value(ASCIIToUTF16("Beta")); - form->fields[5].set_value(ASCIIToUTF16("Jonathan")); - form->fields[6].set_value(ASCIIToUTF16("Omega")); + form->fields[0].value = ASCIIToUTF16("Alpha"); + form->fields[1].value = ASCIIToUTF16("Brother"); + form->fields[2].value = ASCIIToUTF16("Abracadabra"); + form->fields[3].value = ASCIIToUTF16("Joseph"); + form->fields[4].value = ASCIIToUTF16("Beta"); + form->fields[5].value = ASCIIToUTF16("Jonathan"); + form->fields[6].value = ASCIIToUTF16("Omega"); EXPECT_TRUE(form_manager.FillForm(*form, WebNode())); // Get the input element we want to find. @@ -1764,9 +1764,9 @@ TEST_F(FormManagerTest, FillFormFewerFormDataFields) { form->fields.erase(form->fields.begin() + 3); // Fill the form. - form->fields[0].set_value(ASCIIToUTF16("Brother")); - form->fields[1].set_value(ASCIIToUTF16("Joseph")); - form->fields[2].set_value(ASCIIToUTF16("Jonathan")); + form->fields[0].value = ASCIIToUTF16("Brother"); + form->fields[1].value = ASCIIToUTF16("Joseph"); + form->fields[2].value = ASCIIToUTF16("Jonathan"); EXPECT_TRUE(form_manager.FillForm(*form, WebNode())); // Get the input element we want to find. @@ -1863,13 +1863,13 @@ TEST_F(FormManagerTest, FillFormChangedFormDataFields) { FormData* form = &forms[0]; // Fill the form. - form->fields[0].set_value(ASCIIToUTF16("Brother")); - form->fields[1].set_value(ASCIIToUTF16("Joseph")); - form->fields[2].set_value(ASCIIToUTF16("Jonathan")); + form->fields[0].value = ASCIIToUTF16("Brother"); + form->fields[1].value = ASCIIToUTF16("Joseph"); + form->fields[2].value = ASCIIToUTF16("Jonathan"); // Alter the label and name used for matching. - form->fields[1].set_label(ASCIIToUTF16("bogus")); - form->fields[1].set_name(ASCIIToUTF16("bogus")); + form->fields[1].label = ASCIIToUTF16("bogus"); + form->fields[1].name = ASCIIToUTF16("bogus"); EXPECT_TRUE(form_manager.FillForm(*form, WebNode())); @@ -1938,9 +1938,9 @@ TEST_F(FormManagerTest, FillFormExtraFieldInCache) { form->fields.pop_back(); // Fill the form. - form->fields[0].set_value(ASCIIToUTF16("Brother")); - form->fields[1].set_value(ASCIIToUTF16("Joseph")); - form->fields[2].set_value(ASCIIToUTF16("Jonathan")); + form->fields[0].value = ASCIIToUTF16("Brother"); + form->fields[1].value = ASCIIToUTF16("Joseph"); + form->fields[2].value = ASCIIToUTF16("Jonathan"); EXPECT_TRUE(form_manager.FillForm(*form, WebNode())); // Get the input element we want to find. @@ -2043,9 +2043,9 @@ TEST_F(FormManagerTest, FillFormEmptyName) { fields[2]); // Fill the form. - form.fields[0].set_value(ASCIIToUTF16("Wyatt")); - form.fields[1].set_value(ASCIIToUTF16("Earp")); - form.fields[2].set_value(ASCIIToUTF16("wyatt@example.com")); + form.fields[0].value = ASCIIToUTF16("Wyatt"); + form.fields[1].value = ASCIIToUTF16("Earp"); + form.fields[2].value = ASCIIToUTF16("wyatt@example.com"); EXPECT_TRUE(form_manager.FillForm(form, WebNode())); // Find the newly-filled form that contains the input element. @@ -2143,9 +2143,9 @@ TEST_F(FormManagerTest, FillFormEmptyFormNames) { fields[2]); // Fill the form. - form.fields[0].set_value(ASCIIToUTF16("Red")); - form.fields[1].set_value(ASCIIToUTF16("Yellow")); - form.fields[2].set_value(ASCIIToUTF16("Also Yellow")); + form.fields[0].value = ASCIIToUTF16("Red"); + form.fields[1].value = ASCIIToUTF16("Yellow"); + form.fields[2].value = ASCIIToUTF16("Also Yellow"); EXPECT_TRUE(form_manager.FillForm(form, WebNode())); // Find the newly-filled form that contains the input element. @@ -2386,9 +2386,9 @@ TEST_F(FormManagerTest, FillFormNonEmptyField) { fields[2]); // Preview the form and verify that the cursor position has been updated. - form.fields[0].set_value(ASCIIToUTF16("Wyatt")); - form.fields[1].set_value(ASCIIToUTF16("Earp")); - form.fields[2].set_value(ASCIIToUTF16("wyatt@example.com")); + form.fields[0].value = ASCIIToUTF16("Wyatt"); + form.fields[1].value = ASCIIToUTF16("Earp"); + form.fields[2].value = ASCIIToUTF16("wyatt@example.com"); EXPECT_TRUE(form_manager.PreviewForm(form, input_element)); EXPECT_EQ(2, input_element.selectionStart()); EXPECT_EQ(5, input_element.selectionEnd()); diff --git a/chrome/renderer/autofill/password_autofill_manager.cc b/chrome/renderer/autofill/password_autofill_manager.cc index 7b397fb..a7e03fb 100644 --- a/chrome/renderer/autofill/password_autofill_manager.cc +++ b/chrome/renderer/autofill/password_autofill_manager.cc @@ -52,7 +52,7 @@ static bool FindFormInputElements(WebKit::WebFormElement* fe, // form; it can't be the right one. for (size_t j = 0; j < data.fields.size(); j++) { WebKit::WebVector<WebKit::WebNode> temp_elements; - fe->getNamedElements(data.fields[j].name(), temp_elements); + fe->getNamedElements(data.fields[j].name, temp_elements); // Match the first input element, if any. // |getNamedElements| may return non-input elements where the names match, @@ -73,7 +73,7 @@ static bool FindFormInputElements(WebKit::WebFormElement* fe, // one suffices and if some function needs to deal with multiple // matching elements it can get at them through the FormElement*. // Note: This assignment adds a reference to the InputElement. - result->input_elements[data.fields[j].name()] = + result->input_elements[data.fields[j].name] = temp_elements[i].to<WebKit::WebInputElement>(); found_input = true; } @@ -143,7 +143,7 @@ bool FillForm(FormElements* fe, const webkit_glue::FormData& data) { std::map<string16, string16> data_map; for (size_t i = 0; i < data.fields.size(); i++) - data_map[data.fields[i].name()] = data.fields[i].value(); + data_map[data.fields[i].name] = data.fields[i].value; for (FormInputElementMap::iterator it = fe->input_elements.begin(); it != fe->input_elements.end(); ++it) { @@ -409,12 +409,12 @@ void PasswordAutofillManager::OnFillPasswordForm( // Attach autocomplete listener to enable selecting alternate logins. // First, get pointers to username element. WebKit::WebInputElement username_element = - form_elements->input_elements[form_data.basic_data.fields[0].name()]; + form_elements->input_elements[form_data.basic_data.fields[0].name]; // Get pointer to password element. (We currently only support single // password forms). WebKit::WebInputElement password_element = - form_elements->input_elements[form_data.basic_data.fields[1].name()]; + form_elements->input_elements[form_data.basic_data.fields[1].name]; DCHECK(login_to_password_info_.find(username_element) == login_to_password_info_.end()); @@ -432,8 +432,8 @@ void PasswordAutofillManager::GetSuggestions( const webkit_glue::PasswordFormFillData& fill_data, const string16& input, std::vector<string16>* suggestions) { - if (StartsWith(fill_data.basic_data.fields[0].value(), input, false)) - suggestions->push_back(fill_data.basic_data.fields[0].value()); + if (StartsWith(fill_data.basic_data.fields[0].value, input, false)) + suggestions->push_back(fill_data.basic_data.fields[0].value); webkit_glue::PasswordFormFillData::LoginCollection::const_iterator iter; for (iter = fill_data.additional_logins.begin(); @@ -477,10 +477,10 @@ bool PasswordAutofillManager::FillUserNameAndPassword( string16 password; // Look for any suitable matches to current field text. - if (DoUsernamesMatch(fill_data.basic_data.fields[0].value(), current_username, + if (DoUsernamesMatch(fill_data.basic_data.fields[0].value, current_username, exact_username_match)) { - username = fill_data.basic_data.fields[0].value(); - password = fill_data.basic_data.fields[1].value(); + username = fill_data.basic_data.fields[0].value; + password = fill_data.basic_data.fields[1].value; } else { // Scan additional logins for a match. webkit_glue::PasswordFormFillData::LoginCollection::const_iterator iter; |