| 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_field_data.h" | 5 #include "components/autofill/core/common/form_field_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 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 const int kPickleVersion = 1; | 13 const int kPickleVersion = 1; |
| 14 | 14 |
| 15 void AddVectorToPickle(std::vector<base::string16> strings, | 15 void AddVectorToPickle(std::vector<base::string16> strings, |
| 16 Pickle* pickle) { | 16 Pickle* pickle) { |
| 17 pickle->WriteInt(static_cast<int>(strings.size())); | 17 pickle->WriteInt(static_cast<int>(strings.size())); |
| 18 for (size_t i = 0; i < strings.size(); ++i) { | 18 for (size_t i = 0; i < strings.size(); ++i) { |
| 19 pickle->WriteString16(strings[i]); | 19 pickle->WriteString16(strings[i]); |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| 23 bool ReadStringVector(PickleIterator* iter, | 23 bool ReadStringVector(PickleIterator* iter, |
| 24 std::vector<base::string16>* strings) { | 24 std::vector<base::string16>* strings) { |
| 25 int size; | 25 int size; |
| 26 if (!iter->ReadInt(&size)) | 26 if (!iter->ReadInt(&size)) |
| 27 return false; | 27 return false; |
| 28 | 28 |
| 29 string16 pickle_data; | 29 base::string16 pickle_data; |
| 30 for (int i = 0; i < size; i++) { | 30 for (int i = 0; i < size; i++) { |
| 31 if (!iter->ReadString16(&pickle_data)) | 31 if (!iter->ReadString16(&pickle_data)) |
| 32 return false; | 32 return false; |
| 33 | 33 |
| 34 strings->push_back(pickle_data); | 34 strings->push_back(pickle_data); |
| 35 } | 35 } |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool ReadTextDirection(PickleIterator* iter, | 39 bool ReadTextDirection(PickleIterator* iter, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 << (field.is_checkable ? "true" : "false") | 170 << (field.is_checkable ? "true" : "false") |
| 171 << " " | 171 << " " |
| 172 << (field.is_focusable ? "true" : "false") | 172 << (field.is_focusable ? "true" : "false") |
| 173 << " " | 173 << " " |
| 174 << (field.should_autocomplete ? "true" : "false") | 174 << (field.should_autocomplete ? "true" : "false") |
| 175 << " " | 175 << " " |
| 176 << field.text_direction; | 176 << field.text_direction; |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace autofill | 179 } // namespace autofill |
| OLD | NEW |