OLD | NEW |
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, // Require that autocomplete != off. |
27 }; | 27 }; |
28 | 28 |
29 // A bit field mask to extract data from WebFormControlElement. | 29 // A bit field mask to extract data from WebFormControlElement. |
30 enum ExtractMask { | 30 enum ExtractMask { |
31 EXTRACT_NONE = 0, | 31 EXTRACT_NONE = 0, |
32 EXTRACT_VALUE = 1 << 0, // Extract value from WebFormControlElement. | 32 EXTRACT_VALUE = 1 << 0, // Extract value from WebFormControlElement. |
33 EXTRACT_OPTION_TEXT = 1 << 1, // Extract option text from | 33 EXTRACT_OPTION_TEXT = 1 << 1, // Extract option text from |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 bool FindFormAndFieldForInputElement(const WebKit::WebInputElement& element, | 91 bool FindFormAndFieldForInputElement(const WebKit::WebInputElement& element, |
92 FormData* form, | 92 FormData* form, |
93 FormFieldData* field, | 93 FormFieldData* field, |
94 RequirementsMask requirements); | 94 RequirementsMask requirements); |
95 | 95 |
96 // Fills the form represented by |form|. |element| is the input element that | 96 // Fills the form represented by |form|. |element| is the input element that |
97 // initiated the auto-fill process. | 97 // initiated the auto-fill process. |
98 void FillForm(const FormData& form, | 98 void FillForm(const FormData& form, |
99 const WebKit::WebInputElement& element); | 99 const WebKit::WebInputElement& element); |
100 | 100 |
| 101 // Fills focusable and non-focusable form control elements within |form_element| |
| 102 // with field data from |form_data|. |
| 103 void FillFormIncludingNonFocusableElements( |
| 104 const FormData& form_data, |
| 105 const WebKit::WebFormElement& form_element); |
| 106 |
101 // Previews the form represented by |form|. |element| is the input element that | 107 // Previews the form represented by |form|. |element| is the input element that |
102 // initiated the preview process. | 108 // initiated the preview process. |
103 void PreviewForm(const FormData& form, | 109 void PreviewForm(const FormData& form, |
104 const WebKit::WebInputElement& element); | 110 const WebKit::WebInputElement& element); |
105 | 111 |
106 // Clears the placeholder values and the auto-filled background for any fields | 112 // Clears the placeholder values and the auto-filled background for any fields |
107 // in the form containing |node| that have been previewed. Resets the | 113 // 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 | 114 // autofilled state of |node| to |was_autofilled|. Returns false if the form is |
109 // not found. | 115 // not found. |
110 bool ClearPreviewedFormWithElement(const WebKit::WebInputElement& element, | 116 bool ClearPreviewedFormWithElement(const WebKit::WebInputElement& element, |
111 bool was_autofilled); | 117 bool was_autofilled); |
112 | 118 |
113 // Returns true if |form| has any auto-filled fields. | 119 // Returns true if |form| has any auto-filled fields. |
114 bool FormWithElementIsAutofilled(const WebKit::WebInputElement& element); | 120 bool FormWithElementIsAutofilled(const WebKit::WebInputElement& element); |
115 | 121 |
116 } // namespace autofill | 122 } // namespace autofill |
117 | 123 |
118 #endif // CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_ | 124 #endif // CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_ |
OLD | NEW |