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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 std::string form_signature_field_names_; | 249 std::string form_signature_field_names_; |
246 | 250 |
247 // Whether the server expects us to always upload, never upload, or default | 251 // Whether the server expects us to always upload, never upload, or default |
248 // to the stored upload rates. | 252 // to the stored upload rates. |
249 UploadRequired upload_required_; | 253 UploadRequired upload_required_; |
250 | 254 |
251 // Whether the form includes any field types explicitly specified by the site | 255 // Whether the form includes any field types explicitly specified by the site |
252 // author, via the |autocompletetype| attribute. | 256 // author, via the |autocompletetype| attribute. |
253 bool has_author_specified_types_; | 257 bool has_author_specified_types_; |
254 | 258 |
| 259 // True if the form contains at least one password field. |
| 260 bool has_password_field_; |
| 261 |
255 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 262 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
256 }; | 263 }; |
257 | 264 |
258 } // namespace autofill | 265 } // namespace autofill |
259 | 266 |
260 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 267 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
OLD | NEW |