OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "dbus/values_util.h" | 5 #include "dbus/values_util.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 152 } |
153 case Message::DOUBLE: { | 153 case Message::DOUBLE: { |
154 double value = 0; | 154 double value = 0; |
155 if (reader->PopDouble(&value)) | 155 if (reader->PopDouble(&value)) |
156 result = base::MakeUnique<base::Value>(value); | 156 result = base::MakeUnique<base::Value>(value); |
157 break; | 157 break; |
158 } | 158 } |
159 case Message::STRING: { | 159 case Message::STRING: { |
160 std::string value; | 160 std::string value; |
161 if (reader->PopString(&value)) | 161 if (reader->PopString(&value)) |
162 result = base::MakeUnique<base::StringValue>(value); | 162 result = base::MakeUnique<base::Value>(value); |
163 break; | 163 break; |
164 } | 164 } |
165 case Message::OBJECT_PATH: { | 165 case Message::OBJECT_PATH: { |
166 ObjectPath value; | 166 ObjectPath value; |
167 if (reader->PopObjectPath(&value)) | 167 if (reader->PopObjectPath(&value)) |
168 result = base::MakeUnique<base::StringValue>(value.value()); | 168 result = base::MakeUnique<base::Value>(value.value()); |
169 break; | 169 break; |
170 } | 170 } |
171 case Message::UNIX_FD: { | 171 case Message::UNIX_FD: { |
172 // Cannot distinguish a file descriptor from an int | 172 // Cannot distinguish a file descriptor from an int |
173 NOTREACHED(); | 173 NOTREACHED(); |
174 break; | 174 break; |
175 } | 175 } |
176 case Message::ARRAY: { | 176 case Message::ARRAY: { |
177 MessageReader sub_reader(NULL); | 177 MessageReader sub_reader(NULL); |
178 if (reader->PopArray(&sub_reader)) { | 178 if (reader->PopArray(&sub_reader)) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 299 } |
300 | 300 |
301 void AppendValueDataAsVariant(MessageWriter* writer, const base::Value& value) { | 301 void AppendValueDataAsVariant(MessageWriter* writer, const base::Value& value) { |
302 MessageWriter variant_writer(NULL); | 302 MessageWriter variant_writer(NULL); |
303 writer->OpenVariant(GetTypeSignature(value), &variant_writer); | 303 writer->OpenVariant(GetTypeSignature(value), &variant_writer); |
304 AppendValueData(&variant_writer, value); | 304 AppendValueData(&variant_writer, value); |
305 writer->CloseContainer(&variant_writer); | 305 writer->CloseContainer(&variant_writer); |
306 } | 306 } |
307 | 307 |
308 } // namespace dbus | 308 } // namespace dbus |
OLD | NEW |