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

Side by Side Diff: chrome/renderer/autofill/form_autofill_util.h

Issue 11348273: [autofill] Fill in values on a successful run of interactive autocomplete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: isherman@ review Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_ 5 #ifndef CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_
6 #define CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_ 6 #define CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string16.h" 10 #include "base/string16.h"
11 11
12 struct FormData; 12 struct FormData;
13 struct FormFieldData; 13 struct FormFieldData;
14 14
15 namespace WebKit { 15 namespace WebKit {
16 class WebFormElement; 16 class WebFormElement;
17 class WebFormControlElement; 17 class WebFormControlElement;
18 class WebInputElement; 18 class WebInputElement;
19 } 19 }
20 20
21 namespace autofill { 21 namespace autofill {
22 22
23 // A bit field mask for form requirements. 23 // A bit field mask for form or form element requirements.
24 enum RequirementsMask { 24 enum RequirementsMask {
25 REQUIRE_NONE = 0, // No requirements. 25 REQUIRE_NONE = 0, // No requirements.
26 REQUIRE_AUTOCOMPLETE = 1, // Require that autocomplete != off. 26 REQUIRE_AUTOCOMPLETE = 1 << 0, // Require that autocomplete != off.
27 REQUIRE_FOCUSABLE = 1 << 1, // Require that a form element be focusable.
Ilya Sherman 2012/11/30 04:04:54 Please add this to a separate enum, as it doesn't
Dan Beam 2012/11/30 04:13:33 changed to bool
27 }; 28 };
28 29
29 // A bit field mask to extract data from WebFormControlElement. 30 // A bit field mask to extract data from WebFormControlElement.
30 enum ExtractMask { 31 enum ExtractMask {
31 EXTRACT_NONE = 0, 32 EXTRACT_NONE = 0,
32 EXTRACT_VALUE = 1 << 0, // Extract value from WebFormControlElement. 33 EXTRACT_VALUE = 1 << 0, // Extract value from WebFormControlElement.
33 EXTRACT_OPTION_TEXT = 1 << 1, // Extract option text from 34 EXTRACT_OPTION_TEXT = 1 << 1, // Extract option text from
34 // WebFormSelectElement. Only valid when 35 // WebFormSelectElement. Only valid when
35 // |EXTRACT_VALUE| is set. 36 // |EXTRACT_VALUE| is set.
36 // This is used for form submission where 37 // This is used for form submission where
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 bool FindFormAndFieldForInputElement(const WebKit::WebInputElement& element, 92 bool FindFormAndFieldForInputElement(const WebKit::WebInputElement& element,
92 FormData* form, 93 FormData* form,
93 FormFieldData* field, 94 FormFieldData* field,
94 RequirementsMask requirements); 95 RequirementsMask requirements);
95 96
96 // Fills the form represented by |form|. |element| is the input element that 97 // Fills the form represented by |form|. |element| is the input element that
97 // initiated the auto-fill process. 98 // initiated the auto-fill process.
98 void FillForm(const FormData& form, 99 void FillForm(const FormData& form,
99 const WebKit::WebInputElement& element); 100 const WebKit::WebInputElement& element);
100 101
102 // Fills focusable and non-focusable form control elements within |form_element|
103 // with field data from |form_data|.
104 void FillFormAndNonFocusableElements(
Ilya Sherman 2012/11/30 04:04:54 nit: Perhaps "including" rather than "and"? The n
Dan Beam 2012/11/30 04:13:33 Done.
105 const FormData& form_data,
106 const WebKit::WebFormElement& form_element);
107
101 // Previews the form represented by |form|. |element| is the input element that 108 // Previews the form represented by |form|. |element| is the input element that
102 // initiated the preview process. 109 // initiated the preview process.
103 void PreviewForm(const FormData& form, 110 void PreviewForm(const FormData& form,
104 const WebKit::WebInputElement& element); 111 const WebKit::WebInputElement& element);
105 112
106 // Clears the placeholder values and the auto-filled background for any fields 113 // Clears the placeholder values and the auto-filled background for any fields
107 // in the form containing |node| that have been previewed. Resets the 114 // in the form containing |node| that have been previewed. Resets the
108 // autofilled state of |node| to |was_autofilled|. Returns false if the form is 115 // autofilled state of |node| to |was_autofilled|. Returns false if the form is
109 // not found. 116 // not found.
110 bool ClearPreviewedFormWithElement(const WebKit::WebInputElement& element, 117 bool ClearPreviewedFormWithElement(const WebKit::WebInputElement& element,
111 bool was_autofilled); 118 bool was_autofilled);
112 119
113 // Returns true if |form| has any auto-filled fields. 120 // Returns true if |form| has any auto-filled fields.
114 bool FormWithElementIsAutofilled(const WebKit::WebInputElement& element); 121 bool FormWithElementIsAutofilled(const WebKit::WebInputElement& element);
115 122
116 } // namespace autofill 123 } // namespace autofill
117 124
118 #endif // CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_ 125 #endif // CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698