summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/form_manager.h
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 19:05:18 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 19:05:18 +0000
commit18ca9a6b5204d915324ea5a8903593e06e81562b (patch)
treedec993bd8ca4c5138b3c1cf8c737512bb341863e /chrome/renderer/form_manager.h
parent286e660b3175cf308d0c76e38392aa05b9b21c9a (diff)
downloadchromium_src-18ca9a6b5204d915324ea5a8903593e06e81562b.zip
chromium_src-18ca9a6b5204d915324ea5a8903593e06e81562b.tar.gz
chromium_src-18ca9a6b5204d915324ea5a8903593e06e81562b.tar.bz2
AutoFill: Preview form field values when the user changes the AutoFill dropdown
selection. Refactor form field enumeration into ForEachMatchingFormField(). BUG=38582 TEST=FormManagerTest.PreviewForm Review URL: http://codereview.chromium.org/2138005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/form_manager.h')
-rw-r--r--chrome/renderer/form_manager.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/chrome/renderer/form_manager.h b/chrome/renderer/form_manager.h
index 57ed5af..ad4dee7 100644
--- a/chrome/renderer/form_manager.h
+++ b/chrome/renderer/form_manager.h
@@ -29,7 +29,8 @@ class FormManager {
enum RequirementsMask {
REQUIRE_NONE = 0x0, // No requirements.
REQUIRE_AUTOCOMPLETE = 0x1, // Require that autocomplete != off.
- REQUIRE_ELEMENTS_ENABLED = 0x2 // Require that disabled attribute is off.
+ REQUIRE_ENABLED = 0x2, // Require that disabled attribute is off.
+ REQUIRE_EMPTY = 0x4, // Require that the fields are empty.
};
FormManager();
@@ -91,6 +92,13 @@ class FormManager {
// store multiple forms with the same names from different frames.
bool FillForm(const webkit_glue::FormData& form);
+ // Previews the form represented by |form|. Same conditions as FillForm.
+ bool PreviewForm(const webkit_glue::FormData& form);
+
+ // Clears the placeholder values and the auto-filled background for any fields
+ // in |form| that have been previewed.
+ void ClearPreviewedForm(const webkit_glue::FormData& form);
+
// Fills all of the forms in the cache with form data from |forms|.
void FillForms(const std::vector<webkit_glue::FormData>& forms);
@@ -134,18 +142,27 @@ class FormManager {
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|.
+ // For each field in |data| that matches the corresponding field in |form|
+ // and meets the |requirements|, |callback| is called with the actual
+ // WebFormControlElement and the FormField data from |form|. This method owns
+ // |callback|.
void ForEachMatchingFormField(FormElement* form,
+ RequirementsMask requirements,
const webkit_glue::FormData& data,
Callback* callback);
// A ForEachMatchingFormField() callback that sets |field|'s value using the
- // value in |data|.
+ // value in |data|. This method also sets the autofill attribute, causing the
+ // background to be yellow.
void FillFormField(WebKit::WebFormControlElement* field,
const webkit_glue::FormField* data);
+ // A ForEachMatchingFormField() callback that sets |field|'s placeholder value
+ // using the value in |data|, causing the test to be greyed-out. This method
+ // also sets the autofill attribute, causing the background to be yellow.
+ void PreviewFormField(WebKit::WebFormControlElement* field,
+ const webkit_glue::FormField* data);
+
// The map of form elements.
WebFrameFormElementMap form_elements_map_;