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