| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "mojo/common/values_struct_traits.h" | 6 #include "mojo/common/values_struct_traits.h" |
| 7 | 7 |
| 8 namespace mojo { | 8 namespace mojo { |
| 9 | 9 |
| 10 bool StructTraits<common::mojom::ListValueDataView, | 10 bool StructTraits<common::mojom::ListValueDataView, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 std::unique_ptr<base::DictionaryValue>* value_out) { | 32 std::unique_ptr<base::DictionaryValue>* value_out) { |
| 33 mojo::MapDataView<mojo::StringDataView, common::mojom::ValueDataView> view; | 33 mojo::MapDataView<mojo::StringDataView, common::mojom::ValueDataView> view; |
| 34 data.GetValuesDataView(&view); | 34 data.GetValuesDataView(&view); |
| 35 auto dictionary_value = base::MakeUnique<base::DictionaryValue>(); | 35 auto dictionary_value = base::MakeUnique<base::DictionaryValue>(); |
| 36 for (size_t i = 0; i < view.size(); ++i) { | 36 for (size_t i = 0; i < view.size(); ++i) { |
| 37 base::StringPiece key; | 37 base::StringPiece key; |
| 38 std::unique_ptr<base::Value> value; | 38 std::unique_ptr<base::Value> value; |
| 39 if (!view.keys().Read(i, &key) || !view.values().Read(i, &value)) | 39 if (!view.keys().Read(i, &key) || !view.values().Read(i, &value)) |
| 40 return false; | 40 return false; |
| 41 | 41 |
| 42 dictionary_value->Set(key, std::move(value)); | 42 dictionary_value->SetWithoutPathExpansion(key, std::move(value)); |
| 43 } | 43 } |
| 44 *value_out = std::move(dictionary_value); | 44 *value_out = std::move(dictionary_value); |
| 45 return true; | 45 return true; |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>>:: | 48 bool UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>>:: |
| 49 Read(common::mojom::ValueDataView data, | 49 Read(common::mojom::ValueDataView data, |
| 50 std::unique_ptr<base::Value>* value_out) { | 50 std::unique_ptr<base::Value>* value_out) { |
| 51 switch (data.tag()) { | 51 switch (data.tag()) { |
| 52 case common::mojom::ValueDataView::Tag::NULL_VALUE: { | 52 case common::mojom::ValueDataView::Tag::NULL_VALUE: { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (!data.ReadListValue(&list_value)) | 93 if (!data.ReadListValue(&list_value)) |
| 94 return false; | 94 return false; |
| 95 *value_out = std::move(list_value); | 95 *value_out = std::move(list_value); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 return false; | 99 return false; |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace mojo | 102 } // namespace mojo |
| OLD | NEW |