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