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

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

Powered by Google App Engine
This is Rietveld 408576698