summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 18:31:32 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 18:31:32 +0000
commit4c79e3e70d798f8b7d44db141500f42592470790 (patch)
tree51959a6e9f22bd43071c4819ba2f013eb17db9ef /webkit
parent98d7127b558c6de8121ed9ff8c299b30afb6143b (diff)
downloadchromium_src-4c79e3e70d798f8b7d44db141500f42592470790.zip
chromium_src-4c79e3e70d798f8b7d44db141500f42592470790.tar.gz
chromium_src-4c79e3e70d798f8b7d44db141500f42592470790.tar.bz2
Break out FormFieldValues::Element into FormField, which will eventually hold more autofill data about each form field.
BUG=none TEST=none Review URL: http://codereview.chromium.org/306061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29913 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/form_field.cc21
-rw-r--r--webkit/glue/form_field.h41
-rw-r--r--webkit/glue/form_field_values.cc6
-rw-r--r--webkit/glue/form_field_values.h20
-rw-r--r--webkit/webkit.gyp2
5 files changed, 74 insertions, 16 deletions
diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc
new file mode 100644
index 0000000..76992f5
--- /dev/null
+++ b/webkit/glue/form_field.cc
@@ -0,0 +1,21 @@
+// 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 "webkit/glue/form_field.h"
+
+namespace webkit_glue {
+
+FormField::FormField()
+ : element_(NULL) {
+}
+
+FormField::FormField(WebCore::HTMLFormControlElement* element,
+ const string16& name,
+ const string16& value)
+ : element_(element),
+ name_(name),
+ value_(value) {
+}
+
+} // namespace webkit_glue
diff --git a/webkit/glue/form_field.h b/webkit/glue/form_field.h
new file mode 100644
index 0000000..3871881
--- /dev/null
+++ b/webkit/glue/form_field.h
@@ -0,0 +1,41 @@
+// 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 WEBKIT_GLUE_FORM_FIELD_H_
+#define WEBKIT_GLUE_FORM_FIELD_H_
+
+#include "base/string16.h"
+
+namespace WebCore {
+class HTMLFormControlElement;
+}
+
+namespace webkit_glue {
+
+// Stores information about a field in a form.
+class FormField {
+ public:
+ FormField();
+ FormField(WebCore::HTMLFormControlElement* element,
+ const string16& name,
+ const string16& value);
+
+ WebCore::HTMLFormControlElement* element() const { return element_; }
+ string16 name() const { return name_; }
+ string16 value() const { return value_; }
+
+ void set_element(WebCore::HTMLFormControlElement* element) {
+ element_ = element;
+ }
+ void set_value(const string16& value) { value_ = value; }
+
+ private:
+ WebCore::HTMLFormControlElement* element_;
+ string16 name_;
+ string16 value_;
+};
+
+} // namespace webkit_glue
+
+#endif // WEBKIT_GLUE_FORM_FIELD_H_
diff --git a/webkit/glue/form_field_values.cc b/webkit/glue/form_field_values.cc
index 3a57fad..3afdedd 100644
--- a/webkit/glue/form_field_values.cc
+++ b/webkit/glue/form_field_values.cc
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/string16.h"
#include "base/string_util.h"
#include "webkit/api/public/WebForm.h"
#include "webkit/glue/form_field_values.h"
@@ -64,12 +65,11 @@ FormFieldValues* FormFieldValues::Create(const WebForm& webform) {
if (value.length() == 0)
continue;
- string16 name = StringToString16(
- WebKit::nameOfInputElement(input_element));
+ string16 name = StringToString16(WebKit::nameOfInputElement(input_element));
if (name.length() == 0)
continue; // If we have no name, there is nothing to store.
- result->elements.push_back(FormFieldValues::Element(name, value));
+ result->elements.push_back(FormField(form_element, name, value));
}
return result;
diff --git a/webkit/glue/form_field_values.h b/webkit/glue/form_field_values.h
index 7b7ee69..5c2ea62c 100644
--- a/webkit/glue/form_field_values.h
+++ b/webkit/glue/form_field_values.h
@@ -5,9 +5,14 @@
#ifndef WEBKIT_GLUE_FORM_FIELD_VALUES_H_
#define WEBKIT_GLUE_FORM_FIELD_VALUES_H_
-#include <string>
#include <vector>
+#include "webkit/glue/form_field.h"
+
+namespace WebCore {
+class HTMLInputElement;
+}
+
namespace WebKit {
class WebForm;
}
@@ -18,21 +23,10 @@ namespace webkit_glue {
// values entered in the fields.
class FormFieldValues {
public:
- // Struct for storing name/value pairs.
- struct Element {
- Element() {}
- Element(const string16& in_name, const string16& in_value) {
- name = in_name;
- value = in_value;
- }
- string16 name;
- string16 value;
- };
-
static FormFieldValues* Create(const WebKit::WebForm& form);
// A vector of all the input fields in the form.
- std::vector<Element> elements;
+ std::vector<FormField> elements;
};
} // namespace webkit_glue
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 82a713f..f7846c6 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -574,6 +574,8 @@
'glue/entity_map.cc',
'glue/entity_map.h',
'glue/form_data.h',
+ 'glue/form_field.cc',
+ 'glue/form_field.h',
'glue/form_field_values.cc',
'glue/form_field_values.h',
'glue/ftp_directory_listing_response_delegate.cc',