1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef WEBKIT_GLUE_FORM_FIELD_H_ 6 #define WEBKIT_GLUE_FORM_FIELD_H_ 7 8 #include <vector> 9 10 #include "base/string16.h" 11 #ifndef ANDROID 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" 13 #endif 14 15 namespace webkit_glue { 16 17 // Stores information about a field in a form. 18 struct FormField { 19 FormField(); 20 #ifndef ANDROID 21 explicit FormField(WebKit::WebFormControlElement element); 22 #endif 23 FormField(const string16& label, 24 const string16& name, 25 const string16& value, 26 const string16& form_control_type, 27 int max_length, 28 bool is_autofilled); 29 virtual ~FormField(); 30 31 // Equality tests for identity which does not include |value_| or |size_|. 32 // Use |StrictlyEqualsHack| method to test all members. 33 // TODO(dhollowa): These operators need to be revised when we implement field 34 // ids. 35 bool operator==(const FormField& field) const; 36 bool operator!=(const FormField& field) const; 37 38 // Test equality of all data members. 39 // TODO(dhollowa): This will be removed when we implement field ids. 40 bool StrictlyEqualsHack(const FormField& field) const; 41 42 string16 label; 43 string16 name; 44 string16 value; 45 string16 form_control_type; 46 int max_length; 47 bool is_autofilled; 48 std::vector<string16> option_strings; 49 }; 50 51 // So we can compare FormFields with EXPECT_EQ(). 52 std::ostream& operator<<(std::ostream& os, const FormField& field); 53 54 } // namespace webkit_glue 55 56 #endif // WEBKIT_GLUE_FORM_FIELD_H_ 57