OLD | NEW |
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_CORE_BROWSER_FORM_STRUCTURE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // to the user's first interaction with the form. |submission_time| should be | 125 // to the user's first interaction with the form. |submission_time| should be |
126 // a timestamp corresponding to the form's submission. | 126 // a timestamp corresponding to the form's submission. |
127 void LogQualityMetrics(const base::TimeTicks& load_time, | 127 void LogQualityMetrics(const base::TimeTicks& load_time, |
128 const base::TimeTicks& interaction_time, | 128 const base::TimeTicks& interaction_time, |
129 const base::TimeTicks& submission_time, | 129 const base::TimeTicks& submission_time, |
130 rappor::RapporService* rappor_service) const; | 130 rappor::RapporService* rappor_service) const; |
131 | 131 |
132 // Classifies each field in |fields_| based upon its |autocomplete| attribute, | 132 // Classifies each field in |fields_| based upon its |autocomplete| attribute, |
133 // if the attribute is available. The association is stored into the field's | 133 // if the attribute is available. The association is stored into the field's |
134 // |heuristic_type|. | 134 // |heuristic_type|. |
135 // Fills |found_types| with |true| if the attribute is available and neither | 135 // Fills |has_author_specified_types_| with |true| if the attribute is |
136 // empty nor set to the special values "on" or "off" for at least one field. | 136 // available and neither empty nor set to the special values "on" or "off" for |
137 // Fills |found_sections| with |true| if the attribute specifies a section for | |
138 // at least one field. | 137 // at least one field. |
139 void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, | 138 // Fills |has_author_specified_sections_| with |true| if the attribute |
140 bool* found_sections); | 139 // specifies a section for at least one field. |
| 140 void ParseFieldTypesFromAutocompleteAttributes(); |
141 | 141 |
142 // Determines whether |type| and |field| match. | 142 // Determines whether |type| and |field| match. |
143 typedef base::Callback<bool(ServerFieldType type, | 143 typedef base::Callback<bool(ServerFieldType type, |
144 const AutofillField& field)> | 144 const AutofillField& field)> |
145 InputFieldComparator; | 145 InputFieldComparator; |
146 | 146 |
147 // Fills in |fields_| that match |types| (via |matches|) with info from | 147 // Fills in |fields_| that match |types| (via |matches|) with info from |
148 // |get_info|. Uses |address_language_code| to determine line separators when | 148 // |get_info|. Uses |address_language_code| to determine line separators when |
149 // collapsing street address lines into a single-line input text field. | 149 // collapsing street address lines into a single-line input text field. |
150 bool FillFields( | 150 bool FillFields( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 std::vector<AutofillField*>::const_iterator end() const { | 185 std::vector<AutofillField*>::const_iterator end() const { |
186 return fields_.end(); | 186 return fields_.end(); |
187 } | 187 } |
188 | 188 |
189 const base::string16& form_name() const { return form_name_; } | 189 const base::string16& form_name() const { return form_name_; } |
190 | 190 |
191 const GURL& source_url() const { return source_url_; } | 191 const GURL& source_url() const { return source_url_; } |
192 | 192 |
193 bool has_password_field() const { return has_password_field_; } | 193 bool has_password_field() const { return has_password_field_; } |
194 | 194 |
| 195 bool has_author_specified_types() { return has_author_specified_types_; } |
| 196 |
| 197 bool has_author_specified_sections() { |
| 198 return has_author_specified_sections_; |
| 199 } |
| 200 |
195 void set_upload_required(UploadRequired required) { | 201 void set_upload_required(UploadRequired required) { |
196 upload_required_ = required; | 202 upload_required_ = required; |
197 } | 203 } |
198 UploadRequired upload_required() const { return upload_required_; } | 204 UploadRequired upload_required() const { return upload_required_; } |
199 | 205 |
200 // Returns a FormData containing the data this form structure knows about. | 206 // Returns a FormData containing the data this form structure knows about. |
201 FormData ToFormData() const; | 207 FormData ToFormData() const; |
202 | 208 |
203 bool operator==(const FormData& form) const; | 209 bool operator==(const FormData& form) const; |
204 bool operator!=(const FormData& form) const; | 210 bool operator!=(const FormData& form) const; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 std::string form_signature_field_names_; | 264 std::string form_signature_field_names_; |
259 | 265 |
260 // Whether the server expects us to always upload, never upload, or default | 266 // Whether the server expects us to always upload, never upload, or default |
261 // to the stored upload rates. | 267 // to the stored upload rates. |
262 UploadRequired upload_required_; | 268 UploadRequired upload_required_; |
263 | 269 |
264 // Whether the form includes any field types explicitly specified by the site | 270 // Whether the form includes any field types explicitly specified by the site |
265 // author, via the |autocompletetype| attribute. | 271 // author, via the |autocompletetype| attribute. |
266 bool has_author_specified_types_; | 272 bool has_author_specified_types_; |
267 | 273 |
| 274 // Whether the form includes any sections explicitly specified by the site |
| 275 // author, via the autocomplete attribute. |
| 276 bool has_author_specified_sections_; |
| 277 |
| 278 // Whether the form was parsed for autocomplete attribute, thus assigning |
| 279 // the real values of |has_author_specified_types_| and |
| 280 // |has_author_specified_sections_|. |
| 281 bool was_parsed_for_autocomplete_attributes_; |
| 282 |
268 // True if the form contains at least one password field. | 283 // True if the form contains at least one password field. |
269 bool has_password_field_; | 284 bool has_password_field_; |
270 | 285 |
271 // True if the form is a <form>. | 286 // True if the form is a <form>. |
272 bool is_form_tag_; | 287 bool is_form_tag_; |
273 | 288 |
274 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 289 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
275 }; | 290 }; |
276 | 291 |
277 } // namespace autofill | 292 } // namespace autofill |
278 | 293 |
279 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 294 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
OLD | NEW |