Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: mojo/common/values_struct_traits.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/common/common_custom_types_unittest.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return true; 70 return true;
71 } 71 }
72 case common::mojom::ValueDataView::Tag::DOUBLE_VALUE: { 72 case common::mojom::ValueDataView::Tag::DOUBLE_VALUE: {
73 *value_out = base::MakeUnique<base::Value>(data.double_value()); 73 *value_out = base::MakeUnique<base::Value>(data.double_value());
74 return true; 74 return true;
75 } 75 }
76 case common::mojom::ValueDataView::Tag::STRING_VALUE: { 76 case common::mojom::ValueDataView::Tag::STRING_VALUE: {
77 base::StringPiece string_value; 77 base::StringPiece string_value;
78 if (!data.ReadStringValue(&string_value)) 78 if (!data.ReadStringValue(&string_value))
79 return false; 79 return false;
80 *value_out = base::MakeUnique<base::StringValue>(string_value); 80 *value_out = base::MakeUnique<base::Value>(string_value);
81 return true; 81 return true;
82 } 82 }
83 case common::mojom::ValueDataView::Tag::BINARY_VALUE: { 83 case common::mojom::ValueDataView::Tag::BINARY_VALUE: {
84 mojo::ArrayDataView<uint8_t> binary_data; 84 mojo::ArrayDataView<uint8_t> binary_data;
85 data.GetBinaryValueDataView(&binary_data); 85 data.GetBinaryValueDataView(&binary_data);
86 *value_out = base::BinaryValue::CreateWithCopiedBuffer( 86 *value_out = base::BinaryValue::CreateWithCopiedBuffer(
87 reinterpret_cast<const char*>(binary_data.data()), 87 reinterpret_cast<const char*>(binary_data.data()),
88 binary_data.size()); 88 binary_data.size());
89 return true; 89 return true;
90 } 90 }
91 case common::mojom::ValueDataView::Tag::DICTIONARY_VALUE: { 91 case common::mojom::ValueDataView::Tag::DICTIONARY_VALUE: {
92 std::unique_ptr<base::DictionaryValue> dictionary_value; 92 std::unique_ptr<base::DictionaryValue> dictionary_value;
93 if (!data.ReadDictionaryValue(&dictionary_value)) 93 if (!data.ReadDictionaryValue(&dictionary_value))
94 return false; 94 return false;
95 *value_out = std::move(dictionary_value); 95 *value_out = std::move(dictionary_value);
96 return true; 96 return true;
97 } 97 }
98 case common::mojom::ValueDataView::Tag::LIST_VALUE: { 98 case common::mojom::ValueDataView::Tag::LIST_VALUE: {
99 std::unique_ptr<base::ListValue> list_value; 99 std::unique_ptr<base::ListValue> list_value;
100 if (!data.ReadListValue(&list_value)) 100 if (!data.ReadListValue(&list_value))
101 return false; 101 return false;
102 *value_out = std::move(list_value); 102 *value_out = std::move(list_value);
103 return true; 103 return true;
104 } 104 }
105 } 105 }
106 return false; 106 return false;
107 } 107 }
108 108
109 } // namespace mojo 109 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/common/common_custom_types_unittest.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698