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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // This is used when we receive server data for form fields. At that time, | 98 // This is used when we receive server data for form fields. At that time, |
99 // we may have more known fields than just the number of fields we matched | 99 // we may have more known fields than just the number of fields we matched |
100 // heuristically. | 100 // heuristically. |
101 void UpdateAutofillCount(); | 101 void UpdateAutofillCount(); |
102 | 102 |
103 // Returns true if this form matches the structural requirements for Autofill. | 103 // Returns true if this form matches the structural requirements for Autofill. |
104 bool ShouldBeParsed() const; | 104 bool ShouldBeParsed() const; |
105 | 105 |
106 // Returns true if we should query the crowdsourcing server to determine this | 106 // Returns true if we should query the crowdsourcing server to determine this |
107 // form's field types. If the form includes author-specified types, this will | 107 // form's field types. If the form includes author-specified types, this will |
108 // return false. | 108 // return false unless there are password fields in the form. If there are no |
| 109 // password fields the assumption is that the author has expressed their |
| 110 // intent and crowdsourced data should not be used to override this. Password |
| 111 // fields are different because there is no way to specify password generation |
| 112 // directly. |
109 bool ShouldBeCrowdsourced() const; | 113 bool ShouldBeCrowdsourced() const; |
110 | 114 |
111 // Sets the field types to be those set for |cached_form|. | 115 // Sets the field types to be those set for |cached_form|. |
112 void UpdateFromCache(const FormStructure& cached_form); | 116 void UpdateFromCache(const FormStructure& cached_form); |
113 | 117 |
114 // Logs quality metrics for |this|, which should be a user-submitted form. | 118 // Logs quality metrics for |this|, which should be a user-submitted form. |
115 // This method should only be called after the possible field types have been | 119 // This method should only be called after the possible field types have been |
116 // set for each field. |interaction_time| should be a timestamp corresponding | 120 // set for each field. |interaction_time| should be a timestamp corresponding |
117 // to the user's first interaction with the form. |submission_time| should be | 121 // to the user's first interaction with the form. |submission_time| should be |
118 // a timestamp corresponding to the form's submission. | 122 // a timestamp corresponding to the form's submission. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // include multiple fields of the same autofill type (with some exceptions, as | 215 // include multiple fields of the same autofill type (with some exceptions, as |
212 // described in the implementation). Sections are furthermore distinguished | 216 // described in the implementation). Sections are furthermore distinguished |
213 // as either credit card or non-credit card sections. | 217 // as either credit card or non-credit card sections. |
214 // If |has_author_specified_sections| is true, only the second pass -- | 218 // If |has_author_specified_sections| is true, only the second pass -- |
215 // distinguishing credit card sections from non-credit card ones -- is made. | 219 // distinguishing credit card sections from non-credit card ones -- is made. |
216 void IdentifySections(bool has_author_specified_sections); | 220 void IdentifySections(bool has_author_specified_sections); |
217 | 221 |
218 // Returns true if field should be skipped when talking to Autofill server. | 222 // Returns true if field should be skipped when talking to Autofill server. |
219 bool ShouldSkipField(const FormFieldData& field) const; | 223 bool ShouldSkipField(const FormFieldData& field) const; |
220 | 224 |
| 225 // Returns true if the request was made for passwords only, and non-password |
| 226 // fields should respect the autofill values set by the user. |
| 227 bool ShouldSkipProcessingNonPasswordFields() const; |
| 228 |
221 size_t active_field_count() const; | 229 size_t active_field_count() const; |
222 | 230 |
223 // The name of the form. | 231 // The name of the form. |
224 base::string16 form_name_; | 232 base::string16 form_name_; |
225 | 233 |
226 // The source URL. | 234 // The source URL. |
227 GURL source_url_; | 235 GURL source_url_; |
228 | 236 |
229 // The target URL. | 237 // The target URL. |
230 GURL target_url_; | 238 GURL target_url_; |
(...skipping 14 matching lines...) Expand all Loading... |
245 std::string form_signature_field_names_; | 253 std::string form_signature_field_names_; |
246 | 254 |
247 // Whether the server expects us to always upload, never upload, or default | 255 // Whether the server expects us to always upload, never upload, or default |
248 // to the stored upload rates. | 256 // to the stored upload rates. |
249 UploadRequired upload_required_; | 257 UploadRequired upload_required_; |
250 | 258 |
251 // Whether the form includes any field types explicitly specified by the site | 259 // Whether the form includes any field types explicitly specified by the site |
252 // author, via the |autocompletetype| attribute. | 260 // author, via the |autocompletetype| attribute. |
253 bool has_author_specified_types_; | 261 bool has_author_specified_types_; |
254 | 262 |
| 263 // True if the form contains at least one password field. |
| 264 bool has_password_field_; |
| 265 |
255 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 266 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
256 }; | 267 }; |
257 | 268 |
258 } // namespace autofill | 269 } // namespace autofill |
259 | 270 |
260 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 271 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
OLD | NEW |