diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-03 00:30:59 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-03 00:30:59 +0000 |
commit | b143821ab651df119648c0a201b6ab4bf616a500 (patch) | |
tree | bb9946d52d2d1937bbfc3d2de641a0fabca80c3f /webkit | |
parent | 89098b14454bd3e9ec38c98084e1e0488de67fb3 (diff) | |
download | chromium_src-b143821ab651df119648c0a201b6ab4bf616a500.zip chromium_src-b143821ab651df119648c0a201b6ab4bf616a500.tar.gz chromium_src-b143821ab651df119648c0a201b6ab4bf616a500.tar.bz2 |
AutoFill: Use the FormManager cache to send forms to the AutoFillManager.
Remove the FormFieldValues class and replace its usage with FormData.
BUG=38325,33032
TEST=none
Review URL: http://codereview.chromium.org/1606005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/form_data.h | 4 | ||||
-rw-r--r-- | webkit/glue/form_field_values.cc | 68 | ||||
-rw-r--r-- | webkit/glue/form_field_values.h | 48 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 2 |
4 files changed, 2 insertions, 120 deletions
diff --git a/webkit/glue/form_data.h b/webkit/glue/form_data.h index 9d9061d..6af9b28 100644 --- a/webkit/glue/form_data.h +++ b/webkit/glue/form_data.h @@ -18,9 +18,9 @@ struct FormData { string16 name; // GET or POST. string16 method; - // The URL (minus query parameters) containing the form + // The URL (minus query parameters) containing the form. GURL origin; - // The action target of the form + // The action target of the form. GURL action; // A vector of all the input fields in the form. std::vector<FormField> fields; diff --git a/webkit/glue/form_field_values.cc b/webkit/glue/form_field_values.cc deleted file mode 100644 index a4db5b9..0000000 --- a/webkit/glue/form_field_values.cc +++ /dev/null @@ -1,68 +0,0 @@ -// 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 "base/basictypes.h" -#include "base/logging.h" -#include "base/string16.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" -#include "webkit/glue/form_field_values.h" - -using WebKit::WebFormControlElement; -using WebKit::WebFormElement; -using WebKit::WebFrame; -using WebKit::WebInputElement; -using WebKit::WebVector; - -namespace webkit_glue { - -FormFieldValues* FormFieldValues::Create(const WebFormElement& form) { - DCHECK(!form.isNull()); - - WebFrame* frame = form.frame(); - if (!frame) - return NULL; - - // Construct a new FormFieldValues. - FormFieldValues* result = new FormFieldValues(); - - result->form_name = form.name(); - result->method = form.method(); - result->source_url = frame->url(); - result->target_url = frame->completeURL(form.action()); - result->ExtractFormFieldValues(form); - - return result; -} - -void FormFieldValues::ExtractFormFieldValues(const WebFormElement& form) { - WebVector<WebFormControlElement> input_elements; - form.getFormControlElements(input_elements); - - for (size_t i = 0; i < input_elements.size(); i++) { - const WebFormControlElement& element = input_elements[i]; - - // TODO(jhawkins): Remove the check nameForAutofill().isEmpty() when we have - // labels. - if (!element.isEnabled() || element.nameForAutofill().isEmpty()) - continue; - - // We don't want to track password fields. We also have to check for - // autoComplete() here, because only input elements can have the - // autocomplete attribute. - if (element.hasTagName("input")) { - const WebInputElement& input_element = - element.toConstElement<WebInputElement>(); - if (input_element.inputType() == WebInputElement::Password || - !input_element.autoComplete()) - continue; - } - - elements.push_back(FormField(element)); - } -} - -} // namespace webkit_glue diff --git a/webkit/glue/form_field_values.h b/webkit/glue/form_field_values.h deleted file mode 100644 index aca45de..0000000 --- a/webkit/glue/form_field_values.h +++ /dev/null @@ -1,48 +0,0 @@ -// 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_VALUES_H_ -#define WEBKIT_GLUE_FORM_FIELD_VALUES_H_ - -#include <vector> - -#include "base/string16.h" -#include "googleurl/src/gurl.h" -#include "webkit/glue/form_field.h" - -namespace WebKit { -class WebFormElement; -class WebInputElement; -} - -namespace webkit_glue { - -// The FormFieldValues class represents a single HTML form together with the -// values entered in the fields. -class FormFieldValues { - public: - static FormFieldValues* Create(const WebKit::WebFormElement&); - - // The name of the form. - string16 form_name; - - // GET or POST. - string16 method; - - // The source URL. - GURL source_url; - - // The target URL. - GURL target_url; - - // A vector of all the input fields in the form. - std::vector<FormField> elements; - - private: - void ExtractFormFieldValues(const WebKit::WebFormElement&); -}; - -} // namespace webkit_glue - -#endif // WEBKIT_GLUE_FORM_FIELD_VALUES_H_ diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 55066f7..765a642 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -211,8 +211,6 @@ 'form_data.h', 'form_field.cc', 'form_field.h', - 'form_field_values.cc', - 'form_field_values.h', 'ftp_directory_listing_response_delegate.cc', 'ftp_directory_listing_response_delegate.h', 'glue_serialize.cc', |