Chromium Code Reviews| 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 to string for uploading. | |
|
Ilya Sherman
2011/01/22 01:12:35
nit: "to to" -> "to"
GeorgeY
2011/01/22 01:40:40
Done.
| |
| 132 std::string ConvertPresenceBitsToString() const; | |
| 133 | |
| 134 // Returns true if field_set has field types that are allowed to be uploaded | |
| 135 // to Toolbar servers. Any singular field is allowed. If there are multiple | |
| 136 // fields in the |field_set| they are allowed only if they are different by | |
| 137 // HOME/BILLING or HOME/FAX designation. | |
| 138 static bool AllowedForUpload(FieldTypeSet const& field_set); | |
| 139 | |
| 131 // The name of the form. | 140 // The name of the form. |
| 132 string16 form_name_; | 141 string16 form_name_; |
| 133 | 142 |
| 134 // The source URL. | 143 // The source URL. |
| 135 GURL source_url_; | 144 GURL source_url_; |
| 136 | 145 |
| 137 // The target URL. | 146 // The target URL. |
| 138 GURL target_url_; | 147 GURL target_url_; |
| 139 | 148 |
| 140 bool has_credit_card_field_; | 149 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" | 162 // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" |
| 154 std::string form_signature_field_names_; | 163 std::string form_signature_field_names_; |
| 155 | 164 |
| 156 // GET or POST. | 165 // GET or POST. |
| 157 RequestMethod method_; | 166 RequestMethod method_; |
| 158 | 167 |
| 159 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 168 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
| 160 }; | 169 }; |
| 161 | 170 |
| 162 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 171 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| OLD | NEW |