| 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 case Message::UNIX_FD: { |
| 167 // Cannot distinguish a file descriptor from an int |
| 168 NOTREACHED(); |
| 169 break; |
| 170 } |
| 166 case Message::ARRAY: { | 171 case Message::ARRAY: { |
| 167 MessageReader sub_reader(NULL); | 172 MessageReader sub_reader(NULL); |
| 168 if (reader->PopArray(&sub_reader)) { | 173 if (reader->PopArray(&sub_reader)) { |
| 169 // If the type of the array's element is DICT_ENTRY, create a | 174 // If the type of the array's element is DICT_ENTRY, create a |
| 170 // DictionaryValue, otherwise create a ListValue. | 175 // DictionaryValue, otherwise create a ListValue. |
| 171 if (sub_reader.GetDataType() == Message::DICT_ENTRY) { | 176 if (sub_reader.GetDataType() == Message::DICT_ENTRY) { |
| 172 scoped_ptr<DictionaryValue> dictionary_value(new DictionaryValue); | 177 scoped_ptr<DictionaryValue> dictionary_value(new DictionaryValue); |
| 173 if (PopDictionaryEntries(&sub_reader, dictionary_value.get())) | 178 if (PopDictionaryEntries(&sub_reader, dictionary_value.get())) |
| 174 result = dictionary_value.release(); | 179 result = dictionary_value.release(); |
| 175 } else { | 180 } else { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 246 |
| 242 void AppendBasicTypeValueDataAsVariant(MessageWriter* writer, | 247 void AppendBasicTypeValueDataAsVariant(MessageWriter* writer, |
| 243 const base::Value& value) { | 248 const base::Value& value) { |
| 244 MessageWriter sub_writer(NULL); | 249 MessageWriter sub_writer(NULL); |
| 245 writer->OpenVariant(GetTypeSignature(value), &sub_writer); | 250 writer->OpenVariant(GetTypeSignature(value), &sub_writer); |
| 246 AppendBasicTypeValueData(&sub_writer, value); | 251 AppendBasicTypeValueData(&sub_writer, value); |
| 247 writer->CloseContainer(&sub_writer); | 252 writer->CloseContainer(&sub_writer); |
| 248 } | 253 } |
| 249 | 254 |
| 250 } // namespace dbus | 255 } // namespace dbus |
| OLD | NEW |