| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool FormData::operator<(const FormData& form) const { | 100 bool FormData::operator<(const FormData& form) const { |
| 101 return std::tie(name, origin, action, is_form_tag, is_formless_checkout, | 101 return std::tie(name, origin, action, is_form_tag, is_formless_checkout, |
| 102 fields) < std::tie(form.name, form.origin, form.action, | 102 fields) < std::tie(form.name, form.origin, form.action, |
| 103 form.is_form_tag, | 103 form.is_form_tag, |
| 104 form.is_formless_checkout, form.fields); | 104 form.is_formless_checkout, form.fields); |
| 105 } | 105 } |
| 106 | 106 |
| 107 std::ostream& operator<<(std::ostream& os, const FormData& form) { | 107 std::ostream& operator<<(std::ostream& os, const FormData& form) { |
| 108 os << base::UTF16ToUTF8(form.name) << " " << form.origin << " " << form.action | 108 os << base::UTF16ToUTF8(form.name) << "(name) " << form.origin << "(origin) "
<< form.action |
| 109 << " " << form.is_form_tag << " " << form.is_formless_checkout << " " | 109 << "(action) " << form.is_form_tag << "(is_form_tag) " << form.is_formless_
checkout << "(is_formeless_checkout) " |
| 110 << "Fields:"; | 110 << "Fields:"; |
| 111 for (size_t i = 0; i < form.fields.size(); ++i) { | 111 for (size_t i = 0; i < form.fields.size(); ++i) { |
| 112 os << form.fields[i] << ","; | 112 os << form.fields[i] << ","; |
| 113 } | 113 } |
| 114 return os; | 114 return os; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void SerializeFormData(const FormData& form_data, base::Pickle* pickle) { | 117 void SerializeFormData(const FormData& form_data, base::Pickle* pickle) { |
| 118 pickle->WriteInt(kPickleVersion); | 118 pickle->WriteInt(kPickleVersion); |
| 119 pickle->WriteString16(form_data.name); | 119 pickle->WriteString16(form_data.name); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if (input.empty()) | 194 if (input.empty()) |
| 195 return false; | 195 return false; |
| 196 std::string pickle_data; | 196 std::string pickle_data; |
| 197 Base64Decode(input, &pickle_data); | 197 Base64Decode(input, &pickle_data); |
| 198 base::Pickle pickle(pickle_data.data(), static_cast<int>(pickle_data.size())); | 198 base::Pickle pickle(pickle_data.data(), static_cast<int>(pickle_data.size())); |
| 199 base::PickleIterator iter(pickle); | 199 base::PickleIterator iter(pickle); |
| 200 return DeserializeFormData(&iter, form_data); | 200 return DeserializeFormData(&iter, form_data); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace autofill | 203 } // namespace autofill |
| OLD | NEW |