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

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

Issue 11000016: Move forms/ out of webkit/. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Response to review Created 8 years, 2 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 unified diff | Download patch
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 namespace webkit {
13 namespace forms {
14 struct FormData; 12 struct FormData;
15 struct FormField; 13 struct FormFieldData;
16 }
17 }
18 14
19 namespace WebKit { 15 namespace WebKit {
20 class WebFormElement; 16 class WebFormElement;
21 class WebFormControlElement; 17 class WebFormControlElement;
22 class WebInputElement; 18 class WebInputElement;
23 } 19 }
24 20
25 namespace autofill { 21 namespace autofill {
26 22
27 // A bit field mask for form requirements. 23 // A bit field mask for form requirements.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 void ExtractAutofillableElements( 61 void ExtractAutofillableElements(
66 const WebKit::WebFormElement& form_element, 62 const WebKit::WebFormElement& form_element,
67 RequirementsMask requirements, 63 RequirementsMask requirements,
68 std::vector<WebKit::WebFormControlElement>* autofillable_elements); 64 std::vector<WebKit::WebFormControlElement>* autofillable_elements);
69 65
70 // Fills out a FormField object from a given WebFormControlElement. 66 // Fills out a FormField object from a given WebFormControlElement.
71 // |extract_mask|: See the enum ExtractMask above for details. 67 // |extract_mask|: See the enum ExtractMask above for details.
72 void WebFormControlElementToFormField( 68 void WebFormControlElementToFormField(
73 const WebKit::WebFormControlElement& element, 69 const WebKit::WebFormControlElement& element,
74 ExtractMask extract_mask, 70 ExtractMask extract_mask,
75 webkit::forms::FormField* field); 71 FormFieldData* field);
76 72
77 // Fills |form| with the FormData object corresponding to the |form_element|. 73 // Fills |form| with the FormData object corresponding to the |form_element|.
78 // If |field| is non-NULL, also fills |field| with the FormField object 74 // If |field| is non-NULL, also fills |field| with the FormField object
79 // corresponding to the |form_control_element|. 75 // corresponding to the |form_control_element|.
80 // |extract_mask| controls what data is extracted. 76 // |extract_mask| controls what data is extracted.
81 // Returns true if |form| is filled out; it's possible that the |form_element| 77 // Returns true if |form| is filled out; it's possible that the |form_element|
82 // won't meet the |requirements|. Also returns false if there are no fields or 78 // won't meet the |requirements|. Also returns false if there are no fields or
83 // too many fields in the |form|. 79 // too many fields in the |form|.
84 bool WebFormElementToFormData( 80 bool WebFormElementToFormData(
85 const WebKit::WebFormElement& form_element, 81 const WebKit::WebFormElement& form_element,
86 const WebKit::WebFormControlElement& form_control_element, 82 const WebKit::WebFormControlElement& form_control_element,
87 RequirementsMask requirements, 83 RequirementsMask requirements,
88 ExtractMask extract_mask, 84 ExtractMask extract_mask,
89 webkit::forms::FormData* form, 85 FormData* form,
90 webkit::forms::FormField* field); 86 FormFieldData* field);
91 87
92 // Finds the form that contains |element| and returns it in |form|. Fills 88 // Finds the form that contains |element| and returns it in |form|. Fills
93 // |field| with the |FormField| representation for element. 89 // |field| with the |FormField| representation for element.
94 // Returns false if the form is not found or cannot be serialized. 90 // Returns false if the form is not found or cannot be serialized.
95 bool FindFormAndFieldForInputElement(const WebKit::WebInputElement& element, 91 bool FindFormAndFieldForInputElement(const WebKit::WebInputElement& element,
96 webkit::forms::FormData* form, 92 FormData* form,
97 webkit::forms::FormField* field, 93 FormFieldData* field,
98 RequirementsMask requirements); 94 RequirementsMask requirements);
99 95
100 // 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
101 // initiated the auto-fill process. 97 // initiated the auto-fill process.
102 void FillForm(const webkit::forms::FormData& form, 98 void FillForm(const FormData& form,
103 const WebKit::WebInputElement& element); 99 const WebKit::WebInputElement& element);
104 100
105 // Previews the form represented by |form|. |element| is the input element that 101 // Previews the form represented by |form|. |element| is the input element that
106 // initiated the preview process. 102 // initiated the preview process.
107 void PreviewForm(const webkit::forms::FormData& form, 103 void PreviewForm(const FormData& form,
108 const WebKit::WebInputElement& element); 104 const WebKit::WebInputElement& element);
109 105
110 // Clears the placeholder values and the auto-filled background for any fields 106 // Clears the placeholder values and the auto-filled background for any fields
111 // in the form containing |node| that have been previewed. Resets the 107 // in the form containing |node| that have been previewed. Resets the
112 // autofilled state of |node| to |was_autofilled|. Returns false if the form is 108 // autofilled state of |node| to |was_autofilled|. Returns false if the form is
113 // not found. 109 // not found.
114 bool ClearPreviewedFormWithElement(const WebKit::WebInputElement& element, 110 bool ClearPreviewedFormWithElement(const WebKit::WebInputElement& element,
115 bool was_autofilled); 111 bool was_autofilled);
116 112
117 // Returns true if |form| has any auto-filled fields. 113 // Returns true if |form| has any auto-filled fields.
118 bool FormWithElementIsAutofilled(const WebKit::WebInputElement& element); 114 bool FormWithElementIsAutofilled(const WebKit::WebInputElement& element);
119 115
120 } // namespace autofill 116 } // namespace autofill
121 117
122 #endif // CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_ 118 #endif // CHROME_RENDERER_AUTOFILL_FORM_AUTOFILL_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/form_autofill_browsertest.cc ('k') | chrome/renderer/autofill/form_autofill_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698