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 WEBKIT_GLUE_FORM_FIELD_H_ | 5 #ifndef WEBKIT_GLUE_FORM_FIELD_H_ |
6 #define WEBKIT_GLUE_FORM_FIELD_H_ | 6 #define WEBKIT_GLUE_FORM_FIELD_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" |
12 | 12 |
13 namespace webkit_glue { | 13 namespace webkit_glue { |
14 | 14 |
15 // Stores information about a field in a form. | 15 // Stores information about a field in a form. |
16 struct FormField { | 16 struct FormField { |
17 FormField(); | 17 FormField(); |
18 FormField(const string16& label, | |
19 const string16& name, | |
20 const string16& value, | |
21 const string16& form_control_type, | |
22 int max_length, | |
23 bool is_autofilled); | |
24 virtual ~FormField(); | 18 virtual ~FormField(); |
25 | 19 |
26 // Equality tests for identity which does not include |value_| or |size_|. | 20 // Equality tests for identity which does not include |value| or |
27 // Use |StrictlyEqualsHack| method to test all members. | 21 // |is_autofilled|. |
28 // TODO(dhollowa): These operators need to be revised when we implement field | 22 // TODO(dhollowa): These operators need to be revised when we implement field |
29 // ids. | 23 // ids. |
30 bool operator==(const FormField& field) const; | 24 bool operator==(const FormField& field) const; |
31 bool operator!=(const FormField& field) const; | 25 bool operator!=(const FormField& field) const; |
32 | 26 |
33 // Test equality of all data members. | |
34 // TODO(dhollowa): This will be removed when we implement field ids. | |
35 bool StrictlyEqualsHack(const FormField& field) const; | |
36 | |
37 string16 label; | 27 string16 label; |
38 string16 name; | 28 string16 name; |
39 string16 value; | 29 string16 value; |
40 string16 form_control_type; | 30 string16 form_control_type; |
41 int max_length; | 31 int max_length; |
42 bool is_autofilled; | 32 bool is_autofilled; |
43 | 33 |
44 // For the HTML snippet |<option value="US">United States</option>|, the | 34 // For the HTML snippet |<option value="US">United States</option>|, the |
45 // value is "US" and the contents are "United States". | 35 // value is "US" and the contents are "United States". |
46 std::vector<string16> option_values; | 36 std::vector<string16> option_values; |
47 std::vector<string16> option_contents; | 37 std::vector<string16> option_contents; |
48 }; | 38 }; |
49 | 39 |
50 // So we can compare FormFields with EXPECT_EQ(). | 40 // So we can compare FormFields with EXPECT_EQ(). |
51 std::ostream& operator<<(std::ostream& os, const FormField& field); | 41 std::ostream& operator<<(std::ostream& os, const FormField& field); |
52 | 42 |
53 } // namespace webkit_glue | 43 } // namespace webkit_glue |
54 | 44 |
55 #endif // WEBKIT_GLUE_FORM_FIELD_H_ | 45 #endif // WEBKIT_GLUE_FORM_FIELD_H_ |
OLD | NEW |