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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 scoped_ptr<Value> key(PopDataAsValue(&entry_reader)); | 50 scoped_ptr<Value> key(PopDataAsValue(&entry_reader)); |
51 if (!key.get()) | 51 if (!key.get()) |
52 return false; | 52 return false; |
53 // Use JSONWriter to convert an arbitrary value to a string. | 53 // Use JSONWriter to convert an arbitrary value to a string. |
54 base::JSONWriter::Write(key.get(), &key_string); | 54 base::JSONWriter::Write(key.get(), &key_string); |
55 } | 55 } |
56 // Get the value and set the key-value pair. | 56 // Get the value and set the key-value pair. |
57 Value* value = PopDataAsValue(&entry_reader); | 57 Value* value = PopDataAsValue(&entry_reader); |
58 if (!value) | 58 if (!value) |
59 return false; | 59 return false; |
60 dictionary_value->Set(key_string, value); | 60 dictionary_value->SetWithoutPathExpansion(key_string, value); |
satorux1
2012/03/20 16:55:09
Wow, that's subtle...
| |
61 } | 61 } |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 Value* PopDataAsValue(MessageReader* reader) { | 67 Value* PopDataAsValue(MessageReader* reader) { |
68 Value* result = NULL; | 68 Value* result = NULL; |
69 switch (reader->GetDataType()) { | 69 switch (reader->GetDataType()) { |
70 case Message::INVALID_DATA: | 70 case Message::INVALID_DATA: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 MessageReader sub_reader(NULL); | 176 MessageReader sub_reader(NULL); |
177 if (reader->PopVariant(&sub_reader)) | 177 if (reader->PopVariant(&sub_reader)) |
178 result = PopDataAsValue(&sub_reader); | 178 result = PopDataAsValue(&sub_reader); |
179 break; | 179 break; |
180 } | 180 } |
181 } | 181 } |
182 return result; | 182 return result; |
183 } | 183 } |
184 | 184 |
185 } // namespace dbus | 185 } // namespace dbus |
OLD | NEW |