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

Side by Side Diff: components/autofill/content/renderer/form_autofill_util.h

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 11
12 namespace WebKit { 12 namespace blink {
13 class WebDocument; 13 class WebDocument;
14 class WebElement; 14 class WebElement;
15 class WebFormElement; 15 class WebFormElement;
16 class WebFormControlElement; 16 class WebFormControlElement;
17 class WebFrame; 17 class WebFrame;
18 class WebInputElement; 18 class WebInputElement;
19 class WebNode; 19 class WebNode;
20 } 20 }
21 21
22 namespace autofill { 22 namespace autofill {
(...skipping 22 matching lines...) Expand all
45 }; 45 };
46 46
47 // The maximum number of form fields we are willing to parse, due to 47 // The maximum number of form fields we are willing to parse, due to
48 // computational costs. Several examples of forms with lots of fields that are 48 // computational costs. Several examples of forms with lots of fields that are
49 // not relevant to Autofill: (1) the Netflix queue; (2) the Amazon wishlist; 49 // not relevant to Autofill: (1) the Netflix queue; (2) the Amazon wishlist;
50 // (3) router configuration pages; and (4) other configuration pages, e.g. for 50 // (3) router configuration pages; and (4) other configuration pages, e.g. for
51 // Google code project settings. 51 // Google code project settings.
52 extern const size_t kMaxParseableFields; 52 extern const size_t kMaxParseableFields;
53 53
54 // Returns true if |element| is a month input element. 54 // Returns true if |element| is a month input element.
55 bool IsMonthInput(const WebKit::WebInputElement* element); 55 bool IsMonthInput(const blink::WebInputElement* element);
56 56
57 // Returns true if |element| is a text input element. 57 // Returns true if |element| is a text input element.
58 bool IsTextInput(const WebKit::WebInputElement* element); 58 bool IsTextInput(const blink::WebInputElement* element);
59 59
60 // Returns true if |element| is a select element. 60 // Returns true if |element| is a select element.
61 bool IsSelectElement(const WebKit::WebFormControlElement& element); 61 bool IsSelectElement(const blink::WebFormControlElement& element);
62 62
63 // Returns true if |element| is a textarea element. 63 // Returns true if |element| is a textarea element.
64 bool IsTextAreaElement(const WebKit::WebFormControlElement& element); 64 bool IsTextAreaElement(const blink::WebFormControlElement& element);
65 65
66 // Returns true if |element| is a checkbox or a radio button element. 66 // Returns true if |element| is a checkbox or a radio button element.
67 bool IsCheckableElement(const WebKit::WebInputElement* element); 67 bool IsCheckableElement(const blink::WebInputElement* element);
68 68
69 // Returns true if |element| is one of the input element types that can be 69 // Returns true if |element| is one of the input element types that can be
70 // autofilled. {Text, Radiobutton, Checkbox}. 70 // autofilled. {Text, Radiobutton, Checkbox}.
71 bool IsAutofillableInputElement(const WebKit::WebInputElement* element); 71 bool IsAutofillableInputElement(const blink::WebInputElement* element);
72 72
73 // Recursively checks whether |node| or any of its children have a non-empty 73 // Recursively checks whether |node| or any of its children have a non-empty
74 // bounding box. 74 // bounding box.
75 bool IsWebNodeVisible(const WebKit::WebNode& node); 75 bool IsWebNodeVisible(const blink::WebNode& node);
76 76
77 // Returns the form's |name| attribute if non-empty; otherwise the form's |id| 77 // Returns the form's |name| attribute if non-empty; otherwise the form's |id|
78 // attribute. 78 // attribute.
79 const base::string16 GetFormIdentifier(const WebKit::WebFormElement& form); 79 const base::string16 GetFormIdentifier(const blink::WebFormElement& form);
80 80
81 // Returns true if the element specified by |click_element| was successfully 81 // Returns true if the element specified by |click_element| was successfully
82 // clicked. 82 // clicked.
83 bool ClickElement(const WebKit::WebDocument& document, 83 bool ClickElement(const blink::WebDocument& document,
84 const WebElementDescriptor& element_descriptor); 84 const WebElementDescriptor& element_descriptor);
85 85
86 // Fills |autofillable_elements| with all the auto-fillable form control 86 // Fills |autofillable_elements| with all the auto-fillable form control
87 // elements in |form_element|. 87 // elements in |form_element|.
88 void ExtractAutofillableElements( 88 void ExtractAutofillableElements(
89 const WebKit::WebFormElement& form_element, 89 const blink::WebFormElement& form_element,
90 RequirementsMask requirements, 90 RequirementsMask requirements,
91 std::vector<WebKit::WebFormControlElement>* autofillable_elements); 91 std::vector<blink::WebFormControlElement>* autofillable_elements);
92 92
93 // Fills out a FormField object from a given WebFormControlElement. 93 // Fills out a FormField object from a given WebFormControlElement.
94 // |extract_mask|: See the enum ExtractMask above for details. 94 // |extract_mask|: See the enum ExtractMask above for details.
95 void WebFormControlElementToFormField( 95 void WebFormControlElementToFormField(
96 const WebKit::WebFormControlElement& element, 96 const blink::WebFormControlElement& element,
97 ExtractMask extract_mask, 97 ExtractMask extract_mask,
98 FormFieldData* field); 98 FormFieldData* field);
99 99
100 // Fills |form| with the FormData object corresponding to the |form_element|. 100 // Fills |form| with the FormData object corresponding to the |form_element|.
101 // If |field| is non-NULL, also fills |field| with the FormField object 101 // If |field| is non-NULL, also fills |field| with the FormField object
102 // corresponding to the |form_control_element|. 102 // corresponding to the |form_control_element|.
103 // |extract_mask| controls what data is extracted. 103 // |extract_mask| controls what data is extracted.
104 // Returns true if |form| is filled out; it's possible that the |form_element| 104 // Returns true if |form| is filled out; it's possible that the |form_element|
105 // won't meet the |requirements|. Also returns false if there are no fields or 105 // won't meet the |requirements|. Also returns false if there are no fields or
106 // too many fields in the |form|. 106 // too many fields in the |form|.
107 bool WebFormElementToFormData( 107 bool WebFormElementToFormData(
108 const WebKit::WebFormElement& form_element, 108 const blink::WebFormElement& form_element,
109 const WebKit::WebFormControlElement& form_control_element, 109 const blink::WebFormControlElement& form_control_element,
110 RequirementsMask requirements, 110 RequirementsMask requirements,
111 ExtractMask extract_mask, 111 ExtractMask extract_mask,
112 FormData* form, 112 FormData* form,
113 FormFieldData* field); 113 FormFieldData* field);
114 114
115 // Finds the form that contains |element| and returns it in |form|. Fills 115 // Finds the form that contains |element| and returns it in |form|. Fills
116 // |field| with the |FormField| representation for element. 116 // |field| with the |FormField| representation for element.
117 // Returns false if the form is not found or cannot be serialized. 117 // Returns false if the form is not found or cannot be serialized.
118 bool FindFormAndFieldForInputElement(const WebKit::WebInputElement& element, 118 bool FindFormAndFieldForInputElement(const blink::WebInputElement& element,
119 FormData* form, 119 FormData* form,
120 FormFieldData* field, 120 FormFieldData* field,
121 RequirementsMask requirements); 121 RequirementsMask requirements);
122 122
123 // Fills the form represented by |form|. |element| is the input element that 123 // Fills the form represented by |form|. |element| is the input element that
124 // initiated the auto-fill process. 124 // initiated the auto-fill process.
125 void FillForm(const FormData& form, 125 void FillForm(const FormData& form,
126 const WebKit::WebInputElement& element); 126 const blink::WebInputElement& element);
127 127
128 // Fills focusable and non-focusable form control elements within |form_element| 128 // Fills focusable and non-focusable form control elements within |form_element|
129 // with field data from |form_data|. 129 // with field data from |form_data|.
130 void FillFormIncludingNonFocusableElements( 130 void FillFormIncludingNonFocusableElements(
131 const FormData& form_data, 131 const FormData& form_data,
132 const WebKit::WebFormElement& form_element); 132 const blink::WebFormElement& form_element);
133 133
134 // Fills all (including disabled, read-only and non-focusable) form control 134 // Fills all (including disabled, read-only and non-focusable) form control
135 // elements within |form_element| with field data from |form_data|. 135 // elements within |form_element| with field data from |form_data|.
136 void FillFormForAllElements( 136 void FillFormForAllElements(
137 const FormData& form_data, 137 const FormData& form_data,
138 const WebKit::WebFormElement& form_element); 138 const blink::WebFormElement& form_element);
139 139
140 // Previews the form represented by |form|. |element| is the input element that 140 // Previews the form represented by |form|. |element| is the input element that
141 // initiated the preview process. 141 // initiated the preview process.
142 void PreviewForm(const FormData& form, 142 void PreviewForm(const FormData& form,
143 const WebKit::WebInputElement& element); 143 const blink::WebInputElement& element);
144 144
145 // Clears the placeholder values and the auto-filled background for any fields 145 // Clears the placeholder values and the auto-filled background for any fields
146 // in the form containing |node| that have been previewed. Resets the 146 // in the form containing |node| that have been previewed. Resets the
147 // autofilled state of |node| to |was_autofilled|. Returns false if the form is 147 // autofilled state of |node| to |was_autofilled|. Returns false if the form is
148 // not found. 148 // not found.
149 bool ClearPreviewedFormWithElement(const WebKit::WebInputElement& element, 149 bool ClearPreviewedFormWithElement(const blink::WebInputElement& element,
150 bool was_autofilled); 150 bool was_autofilled);
151 151
152 // Returns true if |form| has any auto-filled fields. 152 // Returns true if |form| has any auto-filled fields.
153 bool FormWithElementIsAutofilled(const WebKit::WebInputElement& element); 153 bool FormWithElementIsAutofilled(const blink::WebInputElement& element);
154 154
155 // Checks if the webpage is empty. 155 // Checks if the webpage is empty.
156 // This kind of webpage is considered as empty: 156 // This kind of webpage is considered as empty:
157 // <html> 157 // <html>
158 // <head> 158 // <head>
159 // <head/> 159 // <head/>
160 // <body> 160 // <body>
161 // <body/> 161 // <body/>
162 // <html/> 162 // <html/>
163 // Meta, script and title tags don't influence the emptiness of a webpage. 163 // Meta, script and title tags don't influence the emptiness of a webpage.
164 bool IsWebpageEmpty(const WebKit::WebFrame* frame); 164 bool IsWebpageEmpty(const blink::WebFrame* frame);
165 165
166 // This function checks whether the children of |element| 166 // This function checks whether the children of |element|
167 // are of the type <script>, <meta>, or <title>. 167 // are of the type <script>, <meta>, or <title>.
168 bool IsWebElementEmpty(const WebKit::WebElement& element); 168 bool IsWebElementEmpty(const blink::WebElement& element);
169 169
170 } // namespace autofill 170 } // namespace autofill
171 171
172 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ 172 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.cc ('k') | components/autofill/content/renderer/form_autofill_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698