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#ifdef ANDROID 11#include "base/base_api.h" 12#endif 13#include "base/string16.h" 14#ifndef ANDROID 15#include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" 16#endif 17 18namespace webkit_glue { 19 20// Stores information about a field in a form. 21struct 22#ifdef ANDROID 23BASE_API 24#endif 25FormField { 26 FormField(); 27#ifndef ANDROID 28 explicit FormField(WebKit::WebFormControlElement element); 29#endif 30 FormField(const string16& label, 31 const string16& name, 32 const string16& value, 33 const string16& form_control_type, 34 int max_length, 35 bool is_autofilled); 36 virtual ~FormField(); 37 38 // Equality tests for identity which does not include |value_| or |size_|. 39 // Use |StrictlyEqualsHack| method to test all members. 40 // TODO(dhollowa): These operators need to be revised when we implement field 41 // ids. 42 bool operator==(const FormField& field) const; 43 bool operator!=(const FormField& field) const; 44 45 // Test equality of all data members. 46 // TODO(dhollowa): This will be removed when we implement field ids. 47 bool StrictlyEqualsHack(const FormField& field) const; 48 49 string16 label; 50 string16 name; 51 string16 value; 52 string16 form_control_type; 53 int max_length; 54 bool is_autofilled; 55 std::vector<string16> option_strings; 56}; 57 58// So we can compare FormFields with EXPECT_EQ(). 59std::ostream& operator<<(std::ostream& os, const FormField& field); 60 61} // namespace webkit_glue 62 63#endif // WEBKIT_GLUE_FORM_FIELD_H_ 64