Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5494)

Unified Diff: chrome/renderer/form_manager.h

Issue 2348001: AutoFill: Refactor the code used to fill a form. Don't fill autocomplete=off (Closed)
Patch Set: Fix compile. Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/renderer/form_manager.cc » ('j') | chrome/renderer/form_manager_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/form_manager.h
diff --git a/chrome/renderer/form_manager.h b/chrome/renderer/form_manager.h
index 67d50a993c75f4a641c9524036dc427f56cf703d..57ed5af9c257e5b4fbc08f94d7dd5e6b1b6ce4ca 100644
--- a/chrome/renderer/form_manager.h
+++ b/chrome/renderer/form_manager.h
@@ -8,6 +8,7 @@
#include <map>
#include <vector>
+#include "base/callback.h"
#include "base/string16.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h"
@@ -111,6 +112,10 @@ class FormManager {
typedef std::map<const WebKit::WebFrame*, std::vector<FormElement*> >
WebFrameFormElementMap;
+ // The callback type used by ForEachMatchingFormField().
+ typedef Callback2<WebKit::WebFormControlElement*,
+ const webkit_glue::FormField*>::Type Callback;
+
// Converts a FormElement to FormData storage. Returns false if the form does
// not meet all the requirements in the requirements mask.
// TODO(jhawkins): Modify FormElement so we don't need |frame|.
@@ -120,11 +125,27 @@ class FormManager {
webkit_glue::FormData* form);
// Infers corresponding label for |element| from surrounding context in the
- // DOM. Contents of preceeding <p> tag or preceeding text element found in
+ // DOM. Contents of preceding <p> tag or preceding text element found in
// the form.
static string16 InferLabelForElement(
const WebKit::WebFormControlElement& element);
+ // Uses the data in |form| to find the cached FormElement.
+ bool FindCachedFormElement(const webkit_glue::FormData& form,
+ FormElement** form_element);
+
+ // For each field in |form| that matches the corresponding field in the cached
+ // FormElement, |callback| is called with the actual WebFormControlElement and
+ // the FormField data from |form|. This method owns |callback|.
+ void ForEachMatchingFormField(FormElement* form,
+ const webkit_glue::FormData& data,
+ Callback* callback);
dhollowa 2010/05/28 02:07:07 Curious, why the need to parameterize the callback
James Hawkins 2010/05/28 02:17:27 You seem to have forgotten the CL this code came f
+
+ // A ForEachMatchingFormField() callback that sets |field|'s value using the
+ // value in |data|.
+ void FillFormField(WebKit::WebFormControlElement* field,
+ const webkit_glue::FormField* data);
+
// The map of form elements.
WebFrameFormElementMap form_elements_map_;
« no previous file with comments | « no previous file | chrome/renderer/form_manager.cc » ('j') | chrome/renderer/form_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698