OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/common/form_data.h" | 5 #include "components/autofill/core/common/form_data.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/autofill/core/common/form_field_data.h" | 10 #include "components/autofill/core/common/form_field_data.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 origin == form.origin && | 72 origin == form.origin && |
73 action == form.action && | 73 action == form.action && |
74 user_submitted == form.user_submitted && | 74 user_submitted == form.user_submitted && |
75 fields == form.fields; | 75 fields == form.fields; |
76 } | 76 } |
77 | 77 |
78 bool FormData::operator!=(const FormData& form) const { | 78 bool FormData::operator!=(const FormData& form) const { |
79 return !operator==(form); | 79 return !operator==(form); |
80 } | 80 } |
81 | 81 |
| 82 bool FormData::operator<(const FormData& form) const { |
| 83 if (name != form.name) |
| 84 return name < form.name; |
| 85 if (StringToLowerASCII(method) != StringToLowerASCII(form.method)) |
| 86 return StringToLowerASCII(method) < StringToLowerASCII(form.method); |
| 87 if (origin != form.origin) |
| 88 return origin < form.origin; |
| 89 if (action != form.action) |
| 90 return action < form.action; |
| 91 if (user_submitted != form.user_submitted) |
| 92 return user_submitted < form.user_submitted; |
| 93 return fields < form.fields; |
| 94 } |
| 95 |
82 std::ostream& operator<<(std::ostream& os, const FormData& form) { | 96 std::ostream& operator<<(std::ostream& os, const FormData& form) { |
83 os << base::UTF16ToUTF8(form.name) << " " | 97 os << base::UTF16ToUTF8(form.name) << " " |
84 << base::UTF16ToUTF8(form.method) << " " | 98 << base::UTF16ToUTF8(form.method) << " " |
85 << form.origin << " " | 99 << form.origin << " " |
86 << form.action << " " | 100 << form.action << " " |
87 << form.user_submitted << " " | 101 << form.user_submitted << " " |
88 << "Fields:"; | 102 << "Fields:"; |
89 for (size_t i = 0; i < form.fields.size(); ++i) { | 103 for (size_t i = 0; i < form.fields.size(); ++i) { |
90 os << form.fields[i] << ","; | 104 os << form.fields[i] << ","; |
91 } | 105 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 138 } |
125 default: { | 139 default: { |
126 LOG(ERROR) << "Unknown FormData pickle version " << version; | 140 LOG(ERROR) << "Unknown FormData pickle version " << version; |
127 return false; | 141 return false; |
128 } | 142 } |
129 } | 143 } |
130 return true; | 144 return true; |
131 } | 145 } |
132 | 146 |
133 } // namespace autofill | 147 } // namespace autofill |
OLD | NEW |