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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 // Encodes a XML block contains autofill field type from this FormStructure. | 65 // Encodes a XML block contains autofill field type from this FormStructure. |
66 // This XML will be written VLOG only, never be sent to server. It will | 66 // This XML will be written VLOG only, never be sent to server. It will |
67 // help make FieldAssignments and feed back to autofill server as | 67 // help make FieldAssignments and feed back to autofill server as |
68 // experiment data. | 68 // experiment data. |
69 bool EncodeFieldAssignments(const ServerFieldTypeSet& available_field_types, | 69 bool EncodeFieldAssignments(const ServerFieldTypeSet& available_field_types, |
70 std::string* encoded_xml) const; | 70 std::string* encoded_xml) const; |
71 | 71 |
72 // Encodes the XML query request for the set of |forms| that are valid (see | 72 // Encodes the XML query request for the set of |forms| that are valid (see |
73 // implementation for details on which forms are not included in the query). | 73 // implementation for details on which forms are not included in the query). |
74 // The forms and form signatures used in the Query request are output in | 74 // The form signatures used in the Query request are output in |
75 // |queried_forms| and |encoded_signatures|, respectively. All valid fields | 75 // |encoded_signatures|. All valid fields are encoded in |encoded_xml|. For |
76 // are encoded in |encoded_xml|. For example, there are three valid forms, | 76 // example, there are three valid forms, with 2, 4, and 3 fields. The returned |
77 // with 2, 4, and 3 fields. The returned XML would have type info for 9 | 77 // XML would have type info for 9 fields, first two of which would be for the |
78 // fields, first two of which would be for the first form, next 4 for the | 78 // first form, next 4 for the second, and the rest is for the third. |
79 // second, and the rest is for the third. | |
80 static bool EncodeQueryRequest(const std::vector<FormStructure*>& forms, | 79 static bool EncodeQueryRequest(const std::vector<FormStructure*>& forms, |
81 std::vector<std::string>* encoded_signatures, | 80 std::vector<std::string>* encoded_signatures, |
82 std::vector<FormStructure*>* queried_forms, | |
83 std::string* encoded_xml); | 81 std::string* encoded_xml); |
84 | 82 |
85 // Parses the field types from the server query response. |forms| must be the | 83 // Parses the field types from the server query response. |forms| must be the |
86 // same as the one passed to EncodeQueryRequest when constructing the query. | 84 // same as the one passed to EncodeQueryRequest when constructing the query. |
87 // |rappor_service| may be null. | 85 // |rappor_service| may be null. |
88 static void ParseQueryResponse(const std::string& response_xml, | 86 static void ParseQueryResponse(const std::string& response_xml, |
89 const std::vector<FormStructure*>& forms, | 87 const std::vector<FormStructure*>& forms, |
90 rappor::RapporService* rappor_service); | 88 rappor::RapporService* rappor_service); |
91 | 89 |
92 // Returns predictions using the details from the given |form_structures| and | 90 // Returns predictions using the details from the given |form_structures| and |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 271 |
274 // True if the form is a <form>. | 272 // True if the form is a <form>. |
275 bool is_form_tag_; | 273 bool is_form_tag_; |
276 | 274 |
277 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 275 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
278 }; | 276 }; |
279 | 277 |
280 } // namespace autofill | 278 } // namespace autofill |
281 | 279 |
282 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 280 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
OLD | NEW |