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 20 matching lines...) Expand all Loading... |
31 USE_UPLOAD_RATES | 31 USE_UPLOAD_RATES |
32 }; | 32 }; |
33 | 33 |
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 ~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, |
45 std::string* encoded_xml) const; | 45 std::string* encoded_xml) const; |
46 | 46 |
47 // Encodes the XML query request for the set of forms. | 47 // Encodes the XML query request for the set of forms. |
48 // 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, |
49 // 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 |
50 // 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 |
51 // second, and the rest is for the third. | 51 // second, and the rest is for the third. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 std::vector<AutoFillField*>::const_iterator end() const { | 100 std::vector<AutoFillField*>::const_iterator end() const { |
101 return fields_.end(); | 101 return fields_.end(); |
102 } | 102 } |
103 | 103 |
104 const GURL& source_url() const { return source_url_; } | 104 const GURL& source_url() const { return source_url_; } |
105 | 105 |
106 bool operator==(const webkit_glue::FormData& form) const; | 106 bool operator==(const webkit_glue::FormData& form) const; |
107 bool operator!=(const webkit_glue::FormData& form) const; | 107 bool operator!=(const webkit_glue::FormData& form) const; |
108 | 108 |
| 109 protected: |
| 110 // For tests. |
| 111 ScopedVector<AutoFillField>* fields() { return &fields_; } |
| 112 |
109 private: | 113 private: |
110 enum EncodeRequestType { | 114 enum EncodeRequestType { |
111 QUERY, | 115 QUERY, |
112 UPLOAD, | 116 UPLOAD, |
113 }; | 117 }; |
114 | 118 |
115 // Runs several heuristics against the form fields to determine their possible | 119 // Runs several heuristics against the form fields to determine their possible |
116 // types. | 120 // types. |
117 void GetHeuristicAutoFillTypes(); | 121 void GetHeuristicAutoFillTypes(); |
118 | 122 |
(...skipping 30 matching lines...) Expand all Loading... |
149 // 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" |
150 std::string form_signature_field_names_; | 154 std::string form_signature_field_names_; |
151 | 155 |
152 // GET or POST. | 156 // GET or POST. |
153 RequestMethod method_; | 157 RequestMethod method_; |
154 | 158 |
155 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 159 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
156 }; | 160 }; |
157 | 161 |
158 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 162 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
OLD | NEW |