Index: chrome/renderer/autofill/form_autofill_util.cc |
diff --git a/chrome/renderer/autofill/form_autofill_util.cc b/chrome/renderer/autofill/form_autofill_util.cc |
index 105c89dec33683700874f1617ebe65f87acd9fd7..42d6ffa5b521a393d0f92fd8303cb1236552ea29 100644 |
--- a/chrome/renderer/autofill/form_autofill_util.cc |
+++ b/chrome/renderer/autofill/form_autofill_util.cc |
@@ -10,6 +10,8 @@ |
#include "base/memory/scoped_vector.h" |
#include "base/string_util.h" |
#include "base/utf_string_conversions.h" |
+#include "chrome/common/form_data.h" |
+#include "chrome/common/form_field_data.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" |
@@ -23,8 +25,6 @@ |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
-#include "webkit/forms/form_data.h" |
-#include "webkit/forms/form_field.h" |
using WebKit::WebElement; |
using WebKit::WebFormControlElement; |
@@ -38,8 +38,6 @@ using WebKit::WebOptionElement; |
using WebKit::WebSelectElement; |
using WebKit::WebString; |
using WebKit::WebVector; |
-using webkit::forms::FormData; |
-using webkit::forms::FormField; |
namespace { |
@@ -416,7 +414,7 @@ void GetOptionStringsFromElement(const WebSelectElement& select_element, |
// The callback type used by |ForEachMatchingFormField()|. |
typedef void (*Callback)(WebKit::WebFormControlElement*, |
- const webkit::forms::FormField*, |
+ const FormFieldData*, |
bool); |
// For each autofillable field in |data| that matches a field in the |form|, |
@@ -478,7 +476,7 @@ void ForEachMatchingFormField(const WebFormElement& form_element, |
// Sets the |field|'s value to the value in |data|. |
// Also sets the "autofilled" attribute, causing the background to be yellow. |
void FillFormField(WebKit::WebFormControlElement* field, |
- const webkit::forms::FormField* data, |
+ const FormFieldData* data, |
bool is_initiating_node) { |
// Nothing to fill. |
if (data->value.empty()) |
@@ -508,7 +506,7 @@ void FillFormField(WebKit::WebFormControlElement* field, |
// Sets the |field|'s "suggested" (non JS visible) value to the value in |data|. |
// Also sets the "autofilled" attribute, causing the background to be yellow. |
void PreviewFormField(WebKit::WebFormControlElement* field, |
- const webkit::forms::FormField* data, |
+ const FormFieldData* data, |
bool is_initiating_node) { |
// Nothing to preview. |
if (data->value.empty()) |
@@ -587,7 +585,7 @@ void ExtractAutofillableElements( |
void WebFormControlElementToFormField(const WebFormControlElement& element, |
ExtractMask extract_mask, |
- FormField* field) { |
+ FormFieldData* field) { |
DCHECK(field); |
DCHECK(!element.isNull()); |
@@ -663,8 +661,8 @@ bool WebFormElementToFormData( |
const WebKit::WebFormControlElement& form_control_element, |
RequirementsMask requirements, |
ExtractMask extract_mask, |
- webkit::forms::FormData* form, |
- webkit::forms::FormField* field) { |
+ FormData* form, |
+ FormFieldData* field) { |
const WebFrame* frame = form_element.document().frame(); |
if (!frame) |
return false; |
@@ -683,12 +681,12 @@ bool WebFormElementToFormData( |
if (!form->action.is_valid()) |
form->action = GURL(form_element.action()); |
- // A map from a FormField's name to the FormField itself. |
- std::map<string16, FormField*> name_map; |
+ // A map from a FormFieldData's name to the FormFieldData itself. |
+ std::map<string16, FormFieldData*> name_map; |
// The extracted FormFields. We use pointers so we can store them in |
// |name_map|. |
- ScopedVector<FormField> form_fields; |
+ ScopedVector<FormFieldData> form_fields; |
WebVector<WebFormControlElement> control_elements; |
form_element.getFormControlElements(control_elements); |
@@ -708,8 +706,8 @@ bool WebFormElementToFormData( |
!input_element->autoComplete()) |
continue; |
- // Create a new FormField, fill it out and map it to the field's name. |
- FormField* form_field = new FormField; |
+ // Create a new FormFieldData, fill it out and map it to the field's name. |
+ FormFieldData* form_field = new FormFieldData; |
WebFormControlElementToFormField(control_element, extract_mask, form_field); |
form_fields.push_back(form_field); |
// TODO(jhawkins): A label element is mapped to a form control element's id. |
@@ -726,8 +724,8 @@ bool WebFormElementToFormData( |
// Loop through the label elements inside the form element. For each label |
// element, get the corresponding form control element, use the form control |
- // element's name as a key into the <name, FormField> map to find the |
- // previously created FormField and set the FormField's label to the |
+ // element's name as a key into the <name, FormFieldData> map to find the |
+ // previously created FormFieldData and set the FormFieldData's label to the |
// label.firstChild().nodeValue() of the label element. |
WebNodeList labels = form_element.getElementsByTagName("label"); |
for (unsigned i = 0; i < labels.length(); ++i) { |
@@ -748,7 +746,8 @@ bool WebFormElementToFormData( |
element_name = field_element.nameForAutofill(); |
} |
- std::map<string16, FormField*>::iterator iter = name_map.find(element_name); |
+ std::map<string16, FormFieldData*>::iterator iter = |
+ name_map.find(element_name); |
if (iter != name_map.end()) { |
string16 label_text = FindChildText(label); |
@@ -782,7 +781,7 @@ bool WebFormElementToFormData( |
} |
// Copy the created FormFields into the resulting FormData object. |
- for (ScopedVector<FormField>::const_iterator iter = form_fields.begin(); |
+ for (ScopedVector<FormFieldData>::const_iterator iter = form_fields.begin(); |
iter != form_fields.end(); ++iter) { |
form->fields.push_back(**iter); |
} |
@@ -792,7 +791,7 @@ bool WebFormElementToFormData( |
bool FindFormAndFieldForInputElement(const WebInputElement& element, |
FormData* form, |
- webkit::forms::FormField* field, |
+ FormFieldData* field, |
RequirementsMask requirements) { |
if (!IsAutofillableElement(element)) |
return false; |