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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 16 matching lines...) Expand all Loading... |
27 UPLOAD_NOT_REQUIRED, | 27 UPLOAD_NOT_REQUIRED, |
28 UPLOAD_REQUIRED, | 28 UPLOAD_REQUIRED, |
29 USE_UPLOAD_RATES | 29 USE_UPLOAD_RATES |
30 }; | 30 }; |
31 | 31 |
32 namespace base { | 32 namespace base { |
33 class TimeTicks; | 33 class TimeTicks; |
34 } | 34 } |
35 | 35 |
36 namespace rappor { | 36 namespace rappor { |
37 class RapporService; | 37 class RapporServiceImpl; |
38 } | 38 } |
39 | 39 |
40 namespace autofill { | 40 namespace autofill { |
41 | 41 |
42 struct FormData; | 42 struct FormData; |
43 struct FormDataPredictions; | 43 struct FormDataPredictions; |
44 | 44 |
45 // FormStructure stores a single HTML form together with the values entered | 45 // FormStructure stores a single HTML form together with the values entered |
46 // in the fields along with additional information needed by Autofill. | 46 // in the fields along with additional information needed by Autofill. |
47 class FormStructure { | 47 class FormStructure { |
(...skipping 20 matching lines...) Expand all Loading... |
68 // |encoded_signatures|. All valid fields are encoded in |query|. | 68 // |encoded_signatures|. All valid fields are encoded in |query|. |
69 static bool EncodeQueryRequest(const std::vector<FormStructure*>& forms, | 69 static bool EncodeQueryRequest(const std::vector<FormStructure*>& forms, |
70 std::vector<std::string>* encoded_signatures, | 70 std::vector<std::string>* encoded_signatures, |
71 autofill::AutofillQueryContents* query); | 71 autofill::AutofillQueryContents* query); |
72 | 72 |
73 // Parses the field types from the server query response. |forms| must be the | 73 // Parses the field types from the server query response. |forms| must be the |
74 // same as the one passed to EncodeQueryRequest when constructing the query. | 74 // same as the one passed to EncodeQueryRequest when constructing the query. |
75 // |rappor_service| may be null. | 75 // |rappor_service| may be null. |
76 static void ParseQueryResponse(std::string response, | 76 static void ParseQueryResponse(std::string response, |
77 const std::vector<FormStructure*>& forms, | 77 const std::vector<FormStructure*>& forms, |
78 rappor::RapporService* rappor_service); | 78 rappor::RapporServiceImpl* rappor_service); |
79 | 79 |
80 // Returns predictions using the details from the given |form_structures| and | 80 // Returns predictions using the details from the given |form_structures| and |
81 // their fields' predicted types. | 81 // their fields' predicted types. |
82 static std::vector<FormDataPredictions> GetFieldTypePredictions( | 82 static std::vector<FormDataPredictions> GetFieldTypePredictions( |
83 const std::vector<FormStructure*>& form_structures); | 83 const std::vector<FormStructure*>& form_structures); |
84 | 84 |
85 // Returns whether sending autofill field metadata to the server is enabled. | 85 // Returns whether sending autofill field metadata to the server is enabled. |
86 static bool IsAutofillFieldMetadataEnabled(); | 86 static bool IsAutofillFieldMetadataEnabled(); |
87 | 87 |
88 // Return the form signature as string. | 88 // Return the form signature as string. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // This method should only be called after the possible field types have been | 122 // This method should only be called after the possible field types have been |
123 // set for each field. |interaction_time| should be a timestamp corresponding | 123 // set for each field. |interaction_time| should be a timestamp corresponding |
124 // to the user's first interaction with the form. |submission_time| should be | 124 // to the user's first interaction with the form. |submission_time| should be |
125 // a timestamp corresponding to the form's submission. |observed_submission| | 125 // a timestamp corresponding to the form's submission. |observed_submission| |
126 // indicates whether this method is called as a result of observing a | 126 // indicates whether this method is called as a result of observing a |
127 // submission event (otherwise, it may be that an upload was triggered after | 127 // submission event (otherwise, it may be that an upload was triggered after |
128 // a form was unfocused or a navigation occurred). | 128 // a form was unfocused or a navigation occurred). |
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::RapporServiceImpl* rappor_service, |
133 bool did_show_suggestions, | 133 bool did_show_suggestions, |
134 bool observed_submission) const; | 134 bool observed_submission) const; |
135 | 135 |
136 // Log the quality of the heuristics and server predictions for this form | 136 // Log the quality of the heuristics and server predictions for this form |
137 // structure, if autocomplete attributes are present on the fields (they are | 137 // structure, if autocomplete attributes are present on the fields (they are |
138 // used as golden truths). | 138 // used as golden truths). |
139 void LogQualityMetricsBasedOnAutocomplete() const; | 139 void LogQualityMetricsBasedOnAutocomplete() const; |
140 | 140 |
141 // Classifies each field in |fields_| based upon its |autocomplete| attribute, | 141 // Classifies each field in |fields_| based upon its |autocomplete| attribute, |
142 // if the attribute is available. The association is stored into the field's | 142 // if the attribute is available. The association is stored into the field's |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // The unique signature for this form, composed of the target url domain, | 312 // The unique signature for this form, composed of the target url domain, |
313 // the form name, and the form field names in a 64-bit hash. | 313 // the form name, and the form field names in a 64-bit hash. |
314 FormSignature form_signature_; | 314 FormSignature form_signature_; |
315 | 315 |
316 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 316 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
317 }; | 317 }; |
318 | 318 |
319 } // namespace autofill | 319 } // namespace autofill |
320 | 320 |
321 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 321 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
OLD | NEW |