OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_FORM_STRUCTURE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_FORM_STRUCTURE_H_ |
6 #define COMPONENTS_AUTOFILL_BROWSER_FORM_STRUCTURE_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_FORM_STRUCTURE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Fills |found_types| with |true| if the attribute is available and neither | 129 // Fills |found_types| with |true| if the attribute is available and neither |
130 // empty nor set to the special values "on" or "off" for at least one field. | 130 // empty nor set to the special values "on" or "off" for at least one field. |
131 // Fills |found_sections| with |true| if the attribute specifies a section for | 131 // Fills |found_sections| with |true| if the attribute specifies a section for |
132 // at least one field. | 132 // at least one field. |
133 void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, | 133 void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, |
134 bool* found_sections); | 134 bool* found_sections); |
135 | 135 |
136 const AutofillField* field(size_t index) const; | 136 const AutofillField* field(size_t index) const; |
137 AutofillField* field(size_t index); | 137 AutofillField* field(size_t index); |
138 size_t field_count() const; | 138 size_t field_count() const; |
139 size_t checkable_field_count() const; | |
140 | 139 |
141 // Returns the number of fields that are able to be autofilled. | 140 // Returns the number of fields that are able to be autofilled. |
142 size_t autofill_count() const { return autofill_count_; } | 141 size_t autofill_count() const { return autofill_count_; } |
143 | 142 |
144 // Used for iterating over the fields. | 143 // Used for iterating over the fields. |
145 std::vector<AutofillField*>::const_iterator begin() const { | 144 std::vector<AutofillField*>::const_iterator begin() const { |
146 return fields_.begin(); | 145 return fields_.begin(); |
147 } | 146 } |
148 std::vector<AutofillField*>::const_iterator end() const { | 147 std::vector<AutofillField*>::const_iterator end() const { |
149 return fields_.end(); | 148 return fields_.end(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // described in the implementation). Sections are furthermore distinguished | 184 // described in the implementation). Sections are furthermore distinguished |
186 // as either credit card or non-credit card sections. | 185 // as either credit card or non-credit card sections. |
187 // If |has_author_specified_sections| is true, only the second pass -- | 186 // If |has_author_specified_sections| is true, only the second pass -- |
188 // distinguishing credit card sections from non-credit card ones -- is made. | 187 // distinguishing credit card sections from non-credit card ones -- is made. |
189 void IdentifySections(bool has_author_specified_sections); | 188 void IdentifySections(bool has_author_specified_sections); |
190 | 189 |
191 bool IsAutocheckoutEnabled() const; | 190 bool IsAutocheckoutEnabled() const; |
192 | 191 |
193 // Returns the minimal number of fillable fields required to start autofill. | 192 // Returns the minimal number of fillable fields required to start autofill. |
194 size_t RequiredFillableFields() const; | 193 size_t RequiredFillableFields() const; |
| 194 size_t active_field_count() const; |
195 | 195 |
196 // The name of the form. | 196 // The name of the form. |
197 string16 form_name_; | 197 string16 form_name_; |
198 | 198 |
199 // The source URL. | 199 // The source URL. |
200 GURL source_url_; | 200 GURL source_url_; |
201 | 201 |
202 // The target URL. | 202 // The target URL. |
203 GURL target_url_; | 203 GURL target_url_; |
204 | 204 |
205 // The number of fields able to be auto-filled. | 205 // The number of fields able to be auto-filled. |
206 size_t autofill_count_; | 206 size_t autofill_count_; |
207 | 207 |
208 // A vector of all the input fields in the form. | 208 // A vector of all the input fields in the form. |
209 ScopedVector<AutofillField> fields_; | 209 ScopedVector<AutofillField> fields_; |
210 | 210 |
211 // The number of fields able to be checked. | 211 // The number of fields counted towards form signature and request to Autofill |
212 size_t checkable_field_count_; | 212 // server. |
| 213 size_t active_field_count_; |
213 | 214 |
214 // The names of the form input elements, that are part of the form signature. | 215 // The names of the form input elements, that are part of the form signature. |
215 // The string starts with "&" and the names are also separated by the "&" | 216 // The string starts with "&" and the names are also separated by the "&" |
216 // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" | 217 // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" |
217 std::string form_signature_field_names_; | 218 std::string form_signature_field_names_; |
218 | 219 |
219 // Whether the server expects us to always upload, never upload, or default | 220 // Whether the server expects us to always upload, never upload, or default |
220 // to the stored upload rates. | 221 // to the stored upload rates. |
221 UploadRequired upload_required_; | 222 UploadRequired upload_required_; |
222 | 223 |
223 // The server experiment corresponding to the server types returned for this | 224 // The server experiment corresponding to the server types returned for this |
224 // form. | 225 // form. |
225 std::string server_experiment_id_; | 226 std::string server_experiment_id_; |
226 | 227 |
227 // GET or POST. | 228 // GET or POST. |
228 RequestMethod method_; | 229 RequestMethod method_; |
229 | 230 |
230 // Whether the form includes any field types explicitly specified by the site | 231 // Whether the form includes any field types explicitly specified by the site |
231 // author, via the |autocompletetype| attribute. | 232 // author, via the |autocompletetype| attribute. |
232 bool has_author_specified_types_; | 233 bool has_author_specified_types_; |
233 | 234 |
234 // The URL prefix matched in autocheckout whitelist. An empty string implies | 235 // The URL prefix matched in autocheckout whitelist. An empty string implies |
235 // autocheckout is not enabled for this form. | 236 // autocheckout is not enabled for this form. |
236 std::string autocheckout_url_prefix_; | 237 std::string autocheckout_url_prefix_; |
237 | 238 |
238 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 239 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
239 }; | 240 }; |
240 | 241 |
241 #endif // COMPONENTS_AUTOFILL_BROWSER_FORM_STRUCTURE_H_ | 242 #endif // COMPONENTS_AUTOFILL_BROWSER_FORM_STRUCTURE_H_ |
OLD | NEW |