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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 case base::Value::TYPE_DOUBLE: | 72 case base::Value::TYPE_DOUBLE: |
73 return "d"; | 73 return "d"; |
74 case base::Value::TYPE_STRING: | 74 case base::Value::TYPE_STRING: |
75 return "s"; | 75 return "s"; |
76 case base::Value::TYPE_BINARY: | 76 case base::Value::TYPE_BINARY: |
77 return "ay"; | 77 return "ay"; |
78 case base::Value::TYPE_DICTIONARY: | 78 case base::Value::TYPE_DICTIONARY: |
79 return "a{sv}"; | 79 return "a{sv}"; |
80 default: | 80 default: |
81 DLOG(ERROR) << "Unexpected type " << value.GetType(); | 81 DLOG(ERROR) << "Unexpected type " << value.GetType(); |
82 return ""; | 82 return std::string(); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 base::Value* PopDataAsValue(MessageReader* reader) { | 88 base::Value* PopDataAsValue(MessageReader* reader) { |
89 base::Value* result = NULL; | 89 base::Value* result = NULL; |
90 switch (reader->GetDataType()) { | 90 switch (reader->GetDataType()) { |
91 case Message::INVALID_DATA: | 91 case Message::INVALID_DATA: |
92 // Do nothing. | 92 // Do nothing. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 void AppendBasicTypeValueDataAsVariant(MessageWriter* writer, | 248 void AppendBasicTypeValueDataAsVariant(MessageWriter* writer, |
249 const base::Value& value) { | 249 const base::Value& value) { |
250 MessageWriter sub_writer(NULL); | 250 MessageWriter sub_writer(NULL); |
251 writer->OpenVariant(GetTypeSignature(value), &sub_writer); | 251 writer->OpenVariant(GetTypeSignature(value), &sub_writer); |
252 AppendBasicTypeValueData(&sub_writer, value); | 252 AppendBasicTypeValueData(&sub_writer, value); |
253 writer->CloseContainer(&sub_writer); | 253 writer->CloseContainer(&sub_writer); |
254 } | 254 } |
255 | 255 |
256 } // namespace dbus | 256 } // namespace dbus |
OLD | NEW |