diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 19:29:58 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 19:29:58 +0000 |
commit | c2ad1e38df308c29d87f949fd9117341bbd6a96f (patch) | |
tree | 406cd61303883e99f63ec44b8cf4435e37b3e353 /chrome | |
parent | 667d357e93f2dcc8afbbac71051dfedcc91daba3 (diff) | |
download | chromium_src-c2ad1e38df308c29d87f949fd9117341bbd6a96f.zip chromium_src-c2ad1e38df308c29d87f949fd9117341bbd6a96f.tar.gz chromium_src-c2ad1e38df308c29d87f949fd9117341bbd6a96f.tar.bz2 |
Implement FormStructure and an initial method, EncodeUploadRequest. This also adds SHA1HashString, a utility method to get the SHA-1 hash of an input string, with appropriate unit tests.
BUG=18201
TEST=none
Review URL: http://codereview.chromium.org/355003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30980 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/DEPS | 3 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_field.cc | 37 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_field.h | 25 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.cc | 20 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.h | 6 | ||||
-rw-r--r-- | chrome/browser/autofill/field_types.h | 85 | ||||
-rw-r--r-- | chrome/browser/autofill/form_structure.cc | 154 | ||||
-rw-r--r-- | chrome/browser/autofill/form_structure.h | 63 | ||||
-rw-r--r-- | chrome/browser/webdata/web_database_unittest.cc | 28 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 6 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 8 |
11 files changed, 422 insertions, 13 deletions
diff --git a/chrome/DEPS b/chrome/DEPS index c1fb4b8..ca6752e 100644 --- a/chrome/DEPS +++ b/chrome/DEPS @@ -30,6 +30,9 @@ include_rules = [ # Allow usage of Google Toolbox for Mac. "+third_party/GTM", + # Allow usage of the libjingle library. + "+third_party/libjingle", + # Our Skia extensions. "+skia/ext", diff --git a/chrome/browser/autofill/autofill_field.cc b/chrome/browser/autofill/autofill_field.cc new file mode 100644 index 0000000..fba28a0 --- /dev/null +++ b/chrome/browser/autofill/autofill_field.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2009 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/browser/autofill/autofill_field.h" + +#include "base/logging.h" +#include "base/sha1.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" + +namespace { + +static std::string Hash32Bit(const std::string& str) { + std::string hash_bin = base::SHA1HashString(str); + DCHECK(hash_bin.length() == 20); + + uint32 hash32 = ((hash_bin[0] & 0xFF) << 24) | + ((hash_bin[1] & 0xFF) << 16) | + ((hash_bin[2] & 0xFF) << 8) | + (hash_bin[3] & 0xFF); + + return UintToString(hash32); +} + +} // namespace + +AutoFillField::AutoFillField(const webkit_glue::FormField& field) + : webkit_glue::FormField(field) { +} + +std::string AutoFillField::FieldSignature() const { + std::string field_name = UTF16ToUTF8(name()); + std::string type = UTF16ToUTF8(html_input_type()); + std::string field_string = field_name + "&" + type; + return Hash32Bit(field_string); +} diff --git a/chrome/browser/autofill/autofill_field.h b/chrome/browser/autofill/autofill_field.h new file mode 100644 index 0000000..670fd14 --- /dev/null +++ b/chrome/browser/autofill/autofill_field.h @@ -0,0 +1,25 @@ +// Copyright (c) 2009 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. + +#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_ +#define CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_ + +#include "chrome/browser/autofill/field_types.h" +#include "webkit/glue/form_field.h" + +class AutoFillField : public webkit_glue::FormField { + public: + AutoFillField(const webkit_glue::FormField& field); + + const FieldTypeSet& possible_types() const { return possible_types_; } + + // The unique signature of this field, composed of the field name and the html + // input type in a 32-bit hash. + std::string FieldSignature() const; + + private: + FieldTypeSet possible_types_; +}; + +#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_ diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 6b78a3d..2a9d3f3 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -4,8 +4,11 @@ #include "chrome/browser/autofill/autofill_manager.h" +#include <string> + #include "base/command_line.h" #include "chrome/browser/autofill/autofill_infobar_delegate.h" +#include "chrome/browser/autofill/form_structure.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_switches.h" #include "webkit/glue/form_field_values.h" @@ -26,16 +29,29 @@ void AutoFillManager::FormFieldValuesSubmitted( return; // Grab a copy of the form data. - form_data_.reset(new webkit_glue::FormFieldValues(form)); + form_structure_.reset(new FormStructure(form)); + + if (!form_structure_->IsAutoFillable()) + return; // Ask the user for permission to save form information. infobar_.reset(new AutoFillInfoBarDelegate(tab_contents_, this)); } void AutoFillManager::SaveFormData() { + UploadFormData(); + // TODO(jhawkins): Save the form data to the web database. } +void AutoFillManager::UploadFormData() { + std::string xml; + bool ok = form_structure_->EncodeUploadRequest(false, &xml); + DCHECK(ok); + + // TODO(jhawkins): Initiate the upload request thread. +} + void AutoFillManager::Reset() { - form_data_.reset(); + form_structure_.reset(); } diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 6e09e6f..521d48b 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -13,6 +13,7 @@ class FormFieldValues; } class AutoFillInfoBarDelegate; +class FormStructure; class TabContents; // Manages saving and restoring the user's personal information entered into web @@ -29,6 +30,9 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill { // Saves the form data to the web database. void SaveFormData(); + // Uploads the form data to the autofill server. + void UploadFormData(); + // Resets the stored form data. void Reset(); @@ -37,7 +41,7 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill { TabContents* tab_contents_; // Our copy of the form data. - scoped_ptr<webkit_glue::FormFieldValues> form_data_; + scoped_ptr<FormStructure> form_structure_; // The infobar asking for permission to store form information. scoped_ptr<AutoFillInfoBarDelegate> infobar_; diff --git a/chrome/browser/autofill/field_types.h b/chrome/browser/autofill/field_types.h new file mode 100644 index 0000000..903af7e --- /dev/null +++ b/chrome/browser/autofill/field_types.h @@ -0,0 +1,85 @@ +// Copyright (c) 2009 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. + +#ifndef CHROME_BROWSER_AUTOFILL_FIELD_TYPES_H_ +#define CHROME_BROWSER_AUTOFILL_FIELD_TYPES_H_ + +#include <set> + +// NOTE: This list MUST not be modified. The server aggregates and stores these +// types over several versions, so we must remain fully compatible with the +// autofill server, which is itself backward-compatible. The list must be kept +// up to date with the autofill server list. +// +// This is the list of all valid field types. +typedef enum _FieldType { + // Server indication that it has no data for the requested field. + NO_SERVER_DATA = 0, + // Client indication that the text entered did not match anything in the + // personal data. + UNKNOWN_TYPE = 1, + // The "empty" type indicates that the user hasn't entered anything + // in this field. + EMPTY_TYPE = 2, + // Personal Information categorization types. + NAME_FIRST = 3, + NAME_MIDDLE = 4, + NAME_LAST = 5, + NAME_MIDDLE_INITIAL = 6, + NAME_FULL = 7, + NAME_SUFFIX = 8, + EMAIL_ADDRESS = 9, + PHONE_HOME_NUMBER = 10, + PHONE_HOME_CITY_CODE = 11, + PHONE_HOME_COUNTRY_CODE = 12, + PHONE_HOME_CITY_AND_NUMBER = 13, + PHONE_HOME_WHOLE_NUMBER = 14, + + // Work phone numbers (values [15,19]) are deprecated. + + PHONE_FAX_NUMBER = 20, + PHONE_FAX_CITY_CODE = 21, + PHONE_FAX_COUNTRY_CODE = 22, + PHONE_FAX_CITY_AND_NUMBER = 23, + PHONE_FAX_WHOLE_NUMBER = 24, + + // Cell phone numbers (values [25, 29]) are deprecated. + + ADDRESS_HOME_LINE1 = 30, + ADDRESS_HOME_LINE2 = 31, + ADDRESS_HOME_APPT_NUM = 32, + ADDRESS_HOME_CITY = 33, + ADDRESS_HOME_STATE = 34, + ADDRESS_HOME_ZIP = 35, + ADDRESS_HOME_COUNTRY = 36, + ADDRESS_BILLING_LINE1 = 37, + ADDRESS_BILLING_LINE2 = 38, + ADDRESS_BILLING_APPT_NUM = 39, + ADDRESS_BILLING_CITY = 40, + ADDRESS_BILLING_STATE = 41, + ADDRESS_BILLING_ZIP = 42, + ADDRESS_BILLING_COUNTRY = 43, + + // ADDRESS_SHIPPING values [44,50] are deprecated. + + CREDIT_CARD_NAME = 51, + CREDIT_CARD_NUMBER = 52, + CREDIT_CARD_EXP_MONTH = 53, + CREDIT_CARD_EXP_2_DIGIT_YEAR = 54, + CREDIT_CARD_EXP_4_DIGIT_YEAR = 55, + CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR = 56, + CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR = 57, + CREDIT_CARD_TYPE = 58, + CREDIT_CARD_VERIFICATION_CODE = 59, + + COMPANY_NAME = 60, + + // No new types can be added. + + MAX_VALID_FIELD_TYPE = 61, +} AutoFillFieldType; + +typedef std::set<AutoFillFieldType> FieldTypeSet; + +#endif // CHROME_BROWSER_AUTOFILL_FIELD_TYPES_H_ diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc new file mode 100644 index 0000000..354a36c --- /dev/null +++ b/chrome/browser/autofill/form_structure.cc @@ -0,0 +1,154 @@ +// Copyright (c) 2009 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/browser/autofill/form_structure.h" + +#include "base/basictypes.h" +#include "base/logging.h" +#include "base/sha1.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" +#include "chrome/browser/autofill/field_types.h" +#include "third_party/libjingle/files/talk/xmllite/xmlelement.h" +#include "webkit/glue/form_field.h" +#include "webkit/glue/form_field_values.h" + +const char* kFormMethodGet = "get"; +const char* kFormMethodPost = "post"; + +// XML attribute names +const char* const kAttributeClientVersion = "clientversion"; +const char* const kAttributeAutoFillUsed = "autofillused"; +const char* const kAttributeSignature = "signature"; +const char* const kAttributeFormSignature = "formsignature"; +const char* const kAttributeDataPresent = "datapresent"; + +const char* const kXMLElementForm = "form"; +const char* const kXMLElementField = "field"; +const char* const kAttributeAutoFillType = "autofilltype"; + +namespace { + +static std::string Hash64Bit(const std::string& str) { + std::string hash_bin = base::SHA1HashString(str); + DCHECK(hash_bin.length() == 20); + + uint64 hash64 = (((static_cast<uint64>(hash_bin[0])) & 0xFF) << 56) | + (((static_cast<uint64>(hash_bin[1])) & 0xFF) << 48) | + (((static_cast<uint64>(hash_bin[2])) & 0xFF) << 40) | + (((static_cast<uint64>(hash_bin[3])) & 0xFF) << 32) | + (((static_cast<uint64>(hash_bin[4])) & 0xFF) << 24) | + (((static_cast<uint64>(hash_bin[5])) & 0xFF) << 16) | + (((static_cast<uint64>(hash_bin[6])) & 0xFF) << 8) | + ((static_cast<uint64>(hash_bin[7])) & 0xFF); + + return Uint64ToString(hash64); +} + +} // namespace + +FormStructure::FormStructure(const webkit_glue::FormFieldValues& values) + : form_name_(UTF16ToUTF8(values.form_name)), + source_url_(values.source_url), + target_url_(values.target_url) { + // Copy the form fields. + std::vector<webkit_glue::FormField>::const_iterator field; + for (field = values.elements.begin(); + field != values.elements.end(); field++) { + fields_.push_back(AutoFillField(*field)); + } + + std::string method = UTF16ToUTF8(values.method); + if (method == kFormMethodPost) { + method_ = POST; + } else { + // Either the method is 'get', or we don't know. In this case we default + // to GET. + method_ = GET; + } +} + +bool FormStructure::EncodeUploadRequest(bool auto_fill_used, + std::string* encoded_xml) const { + bool auto_fillable = IsAutoFillable(); + DCHECK(auto_fillable); // Caller should've checked for search pages. + if (!auto_fillable) + return false; + + buzz::XmlElement autofill_upload(buzz::QName("autofillupload")); + + // Attributes for the <autofillupload> element. + // + // TODO(jhawkins): Work with toolbar devs to make a spec for autofill clients. + // For now these values are hacked from the toolbar code. + autofill_upload.SetAttr(buzz::QName(kAttributeClientVersion), + "6.1.1715.1442/en (GGLL)"); + + autofill_upload.SetAttr(buzz::QName(kAttributeFormSignature), + FormSignature()); + + autofill_upload.SetAttr(buzz::QName(kAttributeAutoFillUsed), + auto_fill_used ? "true" : "false"); + + // TODO(jhawkins): Hook this up to the personal data manager. + // personaldata_manager_->GetDataPresent(); + autofill_upload.SetAttr(buzz::QName(kAttributeDataPresent), ""); + + // Add the child nodes for the form fields. + std::vector<AutoFillField>::const_iterator field; + for (field = fields_.begin(); field != fields_.end(); field++) { + FieldTypeSet types = field->possible_types(); + for (FieldTypeSet::const_iterator type = types.begin(); + type != types.end(); type++) { + buzz::XmlElement *field_element = new buzz::XmlElement( + buzz::QName(kXMLElementField)); + + field_element->SetAttr(buzz::QName(kAttributeSignature), + field->FieldSignature()); + + field_element->SetAttr(buzz::QName(kAttributeAutoFillType), + IntToString(*type)); + + autofill_upload.AddElement(field_element); + } + } + + // Obtain the XML structure as a string. + *encoded_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; + *encoded_xml += autofill_upload.Str().c_str(); + + return true; +} + +std::string FormStructure::FormSignature() const { + std::string form_string = target_url_.host() + + "&" + + form_name_ + + form_signature_field_names_; + + return Hash64Bit(form_string); +} + +bool FormStructure::IsAutoFillable() const { + if (fields_.size() == 0) + return false; + + // Rule out http(s)://*/search?... + // e.g. http://www.google.com/search?q=... + // http://search.yahoo.com/search?p=... + if (target_url_.path() == "/search") + return false; + + // Disqualify all forms that are likely to be search boxes (like google.com). + if (fields_.size() == 1) { + std::string name = UTF16ToUTF8(fields_[0].name()); + if (name == "q") + return false; + } + + if (method_ == GET) + return false; + + return true; +} diff --git a/chrome/browser/autofill/form_structure.h b/chrome/browser/autofill/form_structure.h new file mode 100644 index 0000000..c0d178d9 --- /dev/null +++ b/chrome/browser/autofill/form_structure.h @@ -0,0 +1,63 @@ +// Copyright (c) 2009 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. + +#ifndef CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ +#define CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ + +#include <string> +#include <vector> + +#include "base/scoped_ptr.h" +#include "chrome/browser/autofill/autofill_field.h" +#include "googleurl/src/gurl.h" + +namespace webkit_glue { +class FormFieldValues; +} + +enum RequestMethod { + GET, + POST +}; + +// FormStructure stores a single HTML form together with the values entered +// in the fields along with additional information needed by AutoFill. +class FormStructure { + public: + explicit FormStructure(const webkit_glue::FormFieldValues& values); + + // Encodes the XML upload request from this FormStructure. + bool EncodeUploadRequest(bool auto_fill_used, std::string* encoded_xml) const; + + // The unique signature for this form, composed of the target url domain, + // the form name, and the form field names in a 64-bit hash. + std::string FormSignature() const; + + // Runs a quick heuristic to rule out pages but obviously not auto-fillable, + // like google/yahoo/msn search, etc. + bool IsAutoFillable() const; + + private: + // The name of the form. + std::string form_name_; + + // The source URL. + GURL source_url_; + + // The target URL. + GURL target_url_; + + // A vector of all the input fields in the form. + std::vector<AutoFillField> fields_; + + // The names of the form input elements, that are part of the form signature. + // The string starts with "&" and the names are also separated by the "&" + // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" + std::string form_signature_field_names_; + + // GET or POST. + RequestMethod method_; +}; + +#endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index 0a6d6c5..14f52e1 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -392,19 +392,25 @@ TEST_F(WebDatabaseTest, Autofill) { // Simulate the submission of a handful of entries in a field called "Name", // some more often than others. EXPECT_TRUE(db.AddFormFieldValue( - FormField(ASCIIToUTF16("Name"), ASCIIToUTF16("Superman")))); + FormField(ASCIIToUTF16("Name"), string16(), ASCIIToUTF16("Superman")))); std::vector<string16> v; for (int i = 0; i < 5; i++) { EXPECT_TRUE(db.AddFormFieldValue( - FormField(ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Kent")))); + FormField(ASCIIToUTF16("Name"), + string16(), + ASCIIToUTF16("Clark Kent")))); } for (int i = 0; i < 3; i++) { EXPECT_TRUE(db.AddFormFieldValue( - FormField(ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Sutter")))); + FormField(ASCIIToUTF16("Name"), + string16(), + ASCIIToUTF16("Clark Sutter")))); } for (int i = 0; i < 2; i++) { EXPECT_TRUE(db.AddFormFieldValue( - FormField(ASCIIToUTF16("Favorite Color"), ASCIIToUTF16("Green")))); + FormField(ASCIIToUTF16("Favorite Color"), + string16(), + ASCIIToUTF16("Green")))); } int count = 0; @@ -413,7 +419,7 @@ TEST_F(WebDatabaseTest, Autofill) { // We have added the name Clark Kent 5 times, so count should be 5 and pair_id // should be somthing non-zero. EXPECT_TRUE(db.GetIDAndCountOfFormElement( - FormField(ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Kent")), + FormField(ASCIIToUTF16("Name"), string16(), ASCIIToUTF16("Clark Kent")), &pair_id, &count)); EXPECT_EQ(5, count); EXPECT_NE(0, pair_id); @@ -421,12 +427,14 @@ TEST_F(WebDatabaseTest, Autofill) { // Storing in the data base should be case sensitive, so there should be no // database entry for clark kent lowercase. EXPECT_TRUE(db.GetIDAndCountOfFormElement( - FormField(ASCIIToUTF16("Name"), ASCIIToUTF16("clark kent")), + FormField(ASCIIToUTF16("Name"), string16(), ASCIIToUTF16("clark kent")), &pair_id, &count)); EXPECT_EQ(0, count); EXPECT_TRUE(db.GetIDAndCountOfFormElement( - FormField(ASCIIToUTF16("Favorite Color"), ASCIIToUTF16("Green")), + FormField(ASCIIToUTF16("Favorite Color"), + string16(), + ASCIIToUTF16("Green")), &pair_id, &count)); EXPECT_EQ(2, count); @@ -467,7 +475,7 @@ TEST_F(WebDatabaseTest, Autofill) { EXPECT_TRUE(db.RemoveFormElementsAddedBetween(t1, Time())); EXPECT_TRUE(db.GetIDAndCountOfFormElement( - FormField(ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Kent")), + FormField(ASCIIToUTF16("Name"), string16(), ASCIIToUTF16("Clark Kent")), &pair_id, &count)); EXPECT_EQ(0, count); @@ -478,12 +486,16 @@ TEST_F(WebDatabaseTest, Autofill) { // Now add some values with empty strings. const string16 kValue = ASCIIToUTF16(" toto "); EXPECT_TRUE(db.AddFormFieldValue(FormField(ASCIIToUTF16("blank"), + string16(), string16()))); EXPECT_TRUE(db.AddFormFieldValue(FormField(ASCIIToUTF16("blank"), + string16(), ASCIIToUTF16(" ")))); EXPECT_TRUE(db.AddFormFieldValue(FormField(ASCIIToUTF16("blank"), + string16(), ASCIIToUTF16(" ")))); EXPECT_TRUE(db.AddFormFieldValue(FormField(ASCIIToUTF16("blank"), + string16(), kValue))); // They should be stored normally as the DB layer does not check for empty diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 02c8668..de12db9 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -786,6 +786,7 @@ '../third_party/bzip2/bzip2.gyp:bzip2', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', + '../third_party/libjingle/libjingle.gyp:libjingle', '../third_party/libxml/libxml.gyp:libxml', '../third_party/npapi/npapi.gyp:npapi', '../third_party/hunspell/hunspell.gyp:hunspell', @@ -842,10 +843,15 @@ 'browser/autocomplete/keyword_provider.h', 'browser/autocomplete/search_provider.cc', 'browser/autocomplete/search_provider.h', + 'browser/autofill/autofill_field.cc', + 'browser/autofill/autofill_field.h', 'browser/autofill/autofill_infobar_delegate.cc', 'browser/autofill/autofill_infobar_delegate.h', 'browser/autofill/autofill_manager.cc', 'browser/autofill/autofill_manager.h', + 'browser/autofill/field_types.h', + 'browser/autofill/form_structure.cc', + 'browser/autofill/form_structure.h', 'browser/automation/automation_autocomplete_edit_tracker.h', 'browser/automation/automation_browser_tracker.h', 'browser/automation/extension_automation_constants.h', diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 2e4bd89..37f7e23 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -819,12 +819,14 @@ struct ParamTraits<webkit_glue::FormFieldValues> { typedef webkit_glue::FormFieldValues param_type; static void Write(Message* m, const param_type& p) { WriteParam(m, p.form_name); + WriteParam(m, p.method); WriteParam(m, p.source_url); WriteParam(m, p.target_url); WriteParam(m, p.elements.size()); std::vector<webkit_glue::FormField>::const_iterator itr; for (itr = p.elements.begin(); itr != p.elements.end(); itr++) { WriteParam(m, itr->name()); + WriteParam(m, itr->html_input_type()); WriteParam(m, itr->value()); } } @@ -832,16 +834,18 @@ struct ParamTraits<webkit_glue::FormFieldValues> { bool result = true; result = result && ReadParam(m, iter, &p->form_name) && + ReadParam(m, iter, &p->method) && ReadParam(m, iter, &p->source_url) && ReadParam(m, iter, &p->target_url); size_t elements_size = 0; result = result && ReadParam(m, iter, &elements_size); p->elements.resize(elements_size); for (size_t i = 0; i < elements_size; i++) { - string16 name, value; + string16 name, type, value; result = result && ReadParam(m, iter, &name); + result = result && ReadParam(m, iter, &type); result = result && ReadParam(m, iter, &value); - p->elements[i] = webkit_glue::FormField(name, value); + p->elements[i] = webkit_glue::FormField(name, type, value); } return result; } |