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 /webkit | |
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 'webkit')
-rw-r--r-- | webkit/glue/form_field.cc | 2 | ||||
-rw-r--r-- | webkit/glue/form_field.h | 3 | ||||
-rw-r--r-- | webkit/glue/form_field_values.cc | 11 | ||||
-rw-r--r-- | webkit/glue/form_field_values.h | 3 |
4 files changed, 16 insertions, 3 deletions
diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc index 665f498..6d49054 100644 --- a/webkit/glue/form_field.cc +++ b/webkit/glue/form_field.cc @@ -10,8 +10,10 @@ FormField::FormField() { } FormField::FormField(const string16& name, + const string16& html_input_type, const string16& value) : name_(name), + html_input_type_(html_input_type), value_(value) { } diff --git a/webkit/glue/form_field.h b/webkit/glue/form_field.h index 224934d..92e8faea 100644 --- a/webkit/glue/form_field.h +++ b/webkit/glue/form_field.h @@ -14,15 +14,18 @@ class FormField { public: FormField(); FormField(const string16& name, + const string16& html_input_type, const string16& value); string16 name() const { return name_; } + string16 html_input_type() const { return html_input_type_; } string16 value() const { return value_; } void set_value(const string16& value) { value_ = value; } private: string16 name_; + string16 html_input_type_; string16 value_; }; diff --git a/webkit/glue/form_field_values.cc b/webkit/glue/form_field_values.cc index 1f9603f..5e2e32f 100644 --- a/webkit/glue/form_field_values.cc +++ b/webkit/glue/form_field_values.cc @@ -42,6 +42,7 @@ FormFieldValues* FormFieldValues::Create(const WebForm& webform) { FormFieldValues* result = new FormFieldValues(); result->form_name = StringToString16(form->name()); + result->method = StringToString16(form->method()); result->source_url = KURLToGURL(document->url()); result->target_url = KURLToGURL(document->completeURL(form->action())); result->ExtractFormFieldValues(webform); @@ -74,14 +75,18 @@ void FormFieldValues::ExtractFormFieldValues(const WebKit::WebForm& webform) { // For each TEXT input field, store the name and value string16 value = StringToString16(input_element->value()); TrimWhitespace(value, TRIM_LEADING, &value); - if (value.length() == 0) + if (value.empty()) continue; string16 name = StringToString16(WebKit::nameOfInputElement(input_element)); - if (name.length() == 0) + if (name.empty()) continue; // If we have no name, there is nothing to store. - elements.push_back(FormField(name, value)); + string16 type = StringToString16(input_element->formControlType()); + if (type.empty()) + continue; + + elements.push_back(FormField(name, type, value)); } } diff --git a/webkit/glue/form_field_values.h b/webkit/glue/form_field_values.h index c67f1e2..bd45499 100644 --- a/webkit/glue/form_field_values.h +++ b/webkit/glue/form_field_values.h @@ -26,6 +26,9 @@ class FormFieldValues { // The name of the form. string16 form_name; + // GET or POST. + string16 method; + // The source URL. GURL source_url; |