OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 23 matching lines...) Expand all Loading... |
34 class AutoFillMetrics; | 34 class AutoFillMetrics; |
35 | 35 |
36 // FormStructure stores a single HTML form together with the values entered | 36 // FormStructure stores a single HTML form together with the values entered |
37 // in the fields along with additional information needed by AutoFill. | 37 // in the fields along with additional information needed by AutoFill. |
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 // Encodes the XML upload request from this FormStructure. | 43 // Encodes the XML upload request from this FormStructure. |
44 bool EncodeUploadRequest(bool auto_fill_used, std::string* encoded_xml) const; | 44 bool EncodeUploadRequest(bool auto_fill_used, |
| 45 std::string* encoded_xml) const; |
45 | 46 |
46 // Encodes the XML query request for the set of forms. | 47 // Encodes the XML query request for the set of forms. |
47 // All fields are returned in one XML. For example, there are three forms, | 48 // All fields are returned in one XML. For example, there are three forms, |
48 // with 2, 4, and 3 fields. The returned XML would have type info for 9 | 49 // with 2, 4, and 3 fields. The returned XML would have type info for 9 |
49 // fields, first two of which would be for the first form, next 4 for the | 50 // fields, first two of which would be for the first form, next 4 for the |
50 // second, and the rest is for the third. | 51 // second, and the rest is for the third. |
51 static bool EncodeQueryRequest(const ScopedVector<FormStructure>& forms, | 52 static bool EncodeQueryRequest(const ScopedVector<FormStructure>& forms, |
52 std::vector<std::string>* encoded_signatures, | 53 std::vector<std::string>* encoded_signatures, |
53 std::string* encoded_xml); | 54 std::string* encoded_xml); |
54 | 55 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void GetHeuristicAutoFillTypes(); | 121 void GetHeuristicAutoFillTypes(); |
121 | 122 |
122 // Associates the field with the heuristic type for each of the field views. | 123 // Associates the field with the heuristic type for each of the field views. |
123 void GetHeuristicFieldInfo(FieldTypeMap* field_types_map); | 124 void GetHeuristicFieldInfo(FieldTypeMap* field_types_map); |
124 | 125 |
125 // Adds form info to |encompassing_xml_element|. |request_type| indicates if | 126 // Adds form info to |encompassing_xml_element|. |request_type| indicates if |
126 // it is a query or upload. | 127 // it is a query or upload. |
127 bool EncodeFormRequest(EncodeRequestType request_type, | 128 bool EncodeFormRequest(EncodeRequestType request_type, |
128 buzz::XmlElement* encompassing_xml_element) const; | 129 buzz::XmlElement* encompassing_xml_element) const; |
129 | 130 |
130 // Helper for EncodeUploadRequest() that collects presense of all data in the | |
131 // form structure and converts it to string for uploading. | |
132 std::string ConvertPresenceBitsToString() const; | |
133 | |
134 // The name of the form. | 131 // The name of the form. |
135 string16 form_name_; | 132 string16 form_name_; |
136 | 133 |
137 // The source URL. | 134 // The source URL. |
138 GURL source_url_; | 135 GURL source_url_; |
139 | 136 |
140 // The target URL. | 137 // The target URL. |
141 GURL target_url_; | 138 GURL target_url_; |
142 | 139 |
143 bool has_credit_card_field_; | 140 bool has_credit_card_field_; |
(...skipping 12 matching lines...) Expand all Loading... |
156 // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" | 153 // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" |
157 std::string form_signature_field_names_; | 154 std::string form_signature_field_names_; |
158 | 155 |
159 // GET or POST. | 156 // GET or POST. |
160 RequestMethod method_; | 157 RequestMethod method_; |
161 | 158 |
162 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 159 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
163 }; | 160 }; |
164 | 161 |
165 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 162 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
OLD | NEW |