Chromium Code Reviews| 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 "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 if (reader->PopString(&value)) | 156 if (reader->PopString(&value)) |
| 157 result = Value::CreateStringValue(value); | 157 result = Value::CreateStringValue(value); |
| 158 break; | 158 break; |
| 159 } | 159 } |
| 160 case Message::OBJECT_PATH: { | 160 case Message::OBJECT_PATH: { |
| 161 ObjectPath value; | 161 ObjectPath value; |
| 162 if (reader->PopObjectPath(&value)) | 162 if (reader->PopObjectPath(&value)) |
| 163 result = Value::CreateStringValue(value.value()); | 163 result = Value::CreateStringValue(value.value()); |
| 164 break; | 164 break; |
| 165 } | 165 } |
| 166 #if defined(DBUS_TYPE_UNIX_FD) | |
| 167 case Message::UNIX_FD: { | |
| 168 // Cannot distinguish fd from an int at the moment | |
|
keybuk
2012/03/27 22:36:35
Sure you can, it's a dbus::FileDescriptor now ;-)
Sam Leffler
2012/03/27 23:20:40
Previously I took the fd and stashed it in an inte
satorux1
2012/03/28 00:32:43
NOTREACHED() sounds reasonable to me.
| |
| 169 NOTREACHED(); | |
| 170 break; | |
| 171 } | |
| 172 #endif | |
| 166 case Message::ARRAY: { | 173 case Message::ARRAY: { |
| 167 MessageReader sub_reader(NULL); | 174 MessageReader sub_reader(NULL); |
| 168 if (reader->PopArray(&sub_reader)) { | 175 if (reader->PopArray(&sub_reader)) { |
| 169 // If the type of the array's element is DICT_ENTRY, create a | 176 // If the type of the array's element is DICT_ENTRY, create a |
| 170 // DictionaryValue, otherwise create a ListValue. | 177 // DictionaryValue, otherwise create a ListValue. |
| 171 if (sub_reader.GetDataType() == Message::DICT_ENTRY) { | 178 if (sub_reader.GetDataType() == Message::DICT_ENTRY) { |
| 172 scoped_ptr<DictionaryValue> dictionary_value(new DictionaryValue); | 179 scoped_ptr<DictionaryValue> dictionary_value(new DictionaryValue); |
| 173 if (PopDictionaryEntries(&sub_reader, dictionary_value.get())) | 180 if (PopDictionaryEntries(&sub_reader, dictionary_value.get())) |
| 174 result = dictionary_value.release(); | 181 result = dictionary_value.release(); |
| 175 } else { | 182 } else { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 | 244 |
| 238 void AppendBasicTypeValueDataAsVariant(MessageWriter* writer, | 245 void AppendBasicTypeValueDataAsVariant(MessageWriter* writer, |
| 239 const base::Value& value) { | 246 const base::Value& value) { |
| 240 MessageWriter sub_writer(NULL); | 247 MessageWriter sub_writer(NULL); |
| 241 writer->OpenVariant(GetTypeSignature(value), &sub_writer); | 248 writer->OpenVariant(GetTypeSignature(value), &sub_writer); |
| 242 AppendBasicTypeValueData(&sub_writer, value); | 249 AppendBasicTypeValueData(&sub_writer, value); |
| 243 writer->CloseContainer(&sub_writer); | 250 writer->CloseContainer(&sub_writer); |
| 244 } | 251 } |
| 245 | 252 |
| 246 } // namespace dbus | 253 } // namespace dbus |
| OLD | NEW |