| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class FormStructure { | 38 class FormStructure { |
| 39 public: | 39 public: |
| 40 explicit FormStructure(const webkit_glue::FormData& form); | 40 explicit FormStructure(const webkit_glue::FormData& form); |
| 41 virtual ~FormStructure(); | 41 virtual ~FormStructure(); |
| 42 | 42 |
| 43 // Runs several heuristics against the form fields to determine their possible | 43 // Runs several heuristics against the form fields to determine their possible |
| 44 // types. | 44 // types. |
| 45 void DetermineHeuristicTypes(); | 45 void DetermineHeuristicTypes(); |
| 46 | 46 |
| 47 // Encodes the XML upload request from this FormStructure. | 47 // Encodes the XML upload request from this FormStructure. |
| 48 bool EncodeUploadRequest(bool autofill_used, std::string* encoded_xml) const; | 48 bool EncodeUploadRequest(const FieldTypeSet& available_field_types, |
| 49 bool form_was_autofilled, |
| 50 std::string* encoded_xml) const; |
| 49 | 51 |
| 50 // Encodes the XML query request for the set of forms. | 52 // Encodes the XML query request for the set of forms. |
| 51 // All fields are returned in one XML. For example, there are three forms, | 53 // All fields are returned in one XML. For example, there are three forms, |
| 52 // with 2, 4, and 3 fields. The returned XML would have type info for 9 | 54 // with 2, 4, and 3 fields. The returned XML would have type info for 9 |
| 53 // fields, first two of which would be for the first form, next 4 for the | 55 // fields, first two of which would be for the first form, next 4 for the |
| 54 // second, and the rest is for the third. | 56 // second, and the rest is for the third. |
| 55 static bool EncodeQueryRequest(const ScopedVector<FormStructure>& forms, | 57 static bool EncodeQueryRequest(const ScopedVector<FormStructure>& forms, |
| 56 std::vector<std::string>* encoded_signatures, | 58 std::vector<std::string>* encoded_signatures, |
| 57 std::string* encoded_xml); | 59 std::string* encoded_xml); |
| 58 | 60 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 enum EncodeRequestType { | 129 enum EncodeRequestType { |
| 128 QUERY, | 130 QUERY, |
| 129 UPLOAD, | 131 UPLOAD, |
| 130 }; | 132 }; |
| 131 | 133 |
| 132 // Adds form info to |encompassing_xml_element|. |request_type| indicates if | 134 // Adds form info to |encompassing_xml_element|. |request_type| indicates if |
| 133 // it is a query or upload. | 135 // it is a query or upload. |
| 134 bool EncodeFormRequest(EncodeRequestType request_type, | 136 bool EncodeFormRequest(EncodeRequestType request_type, |
| 135 buzz::XmlElement* encompassing_xml_element) const; | 137 buzz::XmlElement* encompassing_xml_element) const; |
| 136 | 138 |
| 137 // Helper for EncodeUploadRequest() that collects presense of all data in the | |
| 138 // form structure and converts it to string for uploading. | |
| 139 std::string ConvertPresenceBitsToString() const; | |
| 140 | |
| 141 // The name of the form. | 139 // The name of the form. |
| 142 string16 form_name_; | 140 string16 form_name_; |
| 143 | 141 |
| 144 // The source URL. | 142 // The source URL. |
| 145 GURL source_url_; | 143 GURL source_url_; |
| 146 | 144 |
| 147 // The target URL. | 145 // The target URL. |
| 148 GURL target_url_; | 146 GURL target_url_; |
| 149 | 147 |
| 150 // The number of fields able to be auto-filled. | 148 // The number of fields able to be auto-filled. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 162 // form. | 160 // form. |
| 163 std::string server_experiment_id_; | 161 std::string server_experiment_id_; |
| 164 | 162 |
| 165 // GET or POST. | 163 // GET or POST. |
| 166 RequestMethod method_; | 164 RequestMethod method_; |
| 167 | 165 |
| 168 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 166 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
| 169 }; | 167 }; |
| 170 | 168 |
| 171 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 169 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| OLD | NEW |