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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <tuple> | 9 #include <tuple> |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 is_formless_checkout != form.is_formless_checkout || | 79 is_formless_checkout != form.is_formless_checkout || |
80 fields.size() != form.fields.size()) | 80 fields.size() != form.fields.size()) |
81 return false; | 81 return false; |
82 for (size_t i = 0; i < fields.size(); ++i) { | 82 for (size_t i = 0; i < fields.size(); ++i) { |
83 if (!fields[i].SameFieldAs(form.fields[i])) | 83 if (!fields[i].SameFieldAs(form.fields[i])) |
84 return false; | 84 return false; |
85 } | 85 } |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
| 89 bool FormData::SimilarFormAs(const FormData& form) const { |
| 90 if (name != form.name || origin != form.origin || action != form.action || |
| 91 is_form_tag != form.is_form_tag || |
| 92 is_formless_checkout != form.is_formless_checkout || |
| 93 fields.size() != form.fields.size()) |
| 94 return false; |
| 95 for (size_t i = 0; i < fields.size(); ++i) { |
| 96 if (!fields[i].SimilarFieldAs(form.fields[i])) |
| 97 return false; |
| 98 } |
| 99 return true; |
| 100 } |
| 101 |
89 bool FormData::operator==(const FormData& form) const { | 102 bool FormData::operator==(const FormData& form) const { |
90 return name == form.name && origin == form.origin && action == form.action && | 103 return name == form.name && origin == form.origin && action == form.action && |
91 is_form_tag == form.is_form_tag && | 104 is_form_tag == form.is_form_tag && |
92 is_formless_checkout == form.is_formless_checkout && | 105 is_formless_checkout == form.is_formless_checkout && |
93 fields == form.fields; | 106 fields == form.fields; |
94 } | 107 } |
95 | 108 |
96 bool FormData::operator!=(const FormData& form) const { | 109 bool FormData::operator!=(const FormData& form) const { |
97 return !(*this == form); | 110 return !(*this == form); |
98 } | 111 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 if (input.empty()) | 207 if (input.empty()) |
195 return false; | 208 return false; |
196 std::string pickle_data; | 209 std::string pickle_data; |
197 Base64Decode(input, &pickle_data); | 210 Base64Decode(input, &pickle_data); |
198 base::Pickle pickle(pickle_data.data(), static_cast<int>(pickle_data.size())); | 211 base::Pickle pickle(pickle_data.data(), static_cast<int>(pickle_data.size())); |
199 base::PickleIterator iter(pickle); | 212 base::PickleIterator iter(pickle); |
200 return DeserializeFormData(&iter, form_data); | 213 return DeserializeFormData(&iter, form_data); |
201 } | 214 } |
202 | 215 |
203 } // namespace autofill | 216 } // namespace autofill |
OLD | NEW |