OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #include "webkit/glue/form_field.h" | 5 #include "webkit/glue/form_field.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebSelectElement.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebSelectElement.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const string16& form_control_type) | 46 const string16& form_control_type) |
47 : label_(label), | 47 : label_(label), |
48 name_(name), | 48 name_(name), |
49 value_(value), | 49 value_(value), |
50 form_control_type_(form_control_type) { | 50 form_control_type_(form_control_type) { |
51 } | 51 } |
52 | 52 |
53 bool FormField::operator==(const FormField& field) const { | 53 bool FormField::operator==(const FormField& field) const { |
54 // A FormField stores a value, but the value is not part of the identity of | 54 // A FormField stores a value, but the value is not part of the identity of |
55 // the field, so we don't want to compare the values. | 55 // the field, so we don't want to compare the values. |
56 // TODO(jhawkins): Re-enable checking the field label for == once we parse | 56 return (label_ == field.label_ && |
57 // labels again. | 57 name_ == field.name_ && |
58 return (name_ == field.name_ && | |
59 form_control_type_ == field.form_control_type_); | 58 form_control_type_ == field.form_control_type_); |
60 } | 59 } |
61 | 60 |
62 bool FormField::operator!=(const FormField& field) const { | 61 bool FormField::operator!=(const FormField& field) const { |
63 return !operator==(field); | 62 return !operator==(field); |
64 } | 63 } |
65 | 64 |
66 std::ostream& operator<<(std::ostream& os, const FormField& field) { | 65 std::ostream& operator<<(std::ostream& os, const FormField& field) { |
67 return os | 66 return os |
68 << UTF16ToUTF8(field.label()) | 67 << UTF16ToUTF8(field.label()) |
69 << " " | 68 << " " |
70 << UTF16ToUTF8(field.name()) | 69 << UTF16ToUTF8(field.name()) |
71 << " " | 70 << " " |
72 << UTF16ToUTF8(field.value()) | 71 << UTF16ToUTF8(field.value()) |
73 << " " | 72 << " " |
74 << UTF16ToUTF8(field.form_control_type()); | 73 << UTF16ToUTF8(field.form_control_type()); |
75 } | 74 } |
76 | 75 |
77 } // namespace webkit_glue | 76 } // namespace webkit_glue |
OLD | NEW |