OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "ipc/ipc_message_utils.h" | 5 #include "ipc/ipc_message_utils.h" |
6 | 6 |
7 #include "base/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 | 11 |
12 namespace IPC { | 12 namespace IPC { |
13 | 13 |
14 const int kMaxRecursionDepth = 100; | 14 const int kMaxRecursionDepth = 100; |
15 | 15 |
16 // Value serialization | 16 // Value serialization |
17 | 17 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 const Message* m, void** iter, param_type* r) { | 209 const Message* m, void** iter, param_type* r) { |
210 int type; | 210 int type; |
211 if (!ReadParam(m, iter, &type) || type != Value::TYPE_DICTIONARY) | 211 if (!ReadParam(m, iter, &type) || type != Value::TYPE_DICTIONARY) |
212 return false; | 212 return false; |
213 | 213 |
214 return ReadDictionaryValue(m, iter, r, 0); | 214 return ReadDictionaryValue(m, iter, r, 0); |
215 } | 215 } |
216 | 216 |
217 void ParamTraits<DictionaryValue>::Log(const param_type& p, std::wstring* l) { | 217 void ParamTraits<DictionaryValue>::Log(const param_type& p, std::wstring* l) { |
218 std::string json; | 218 std::string json; |
219 JSONWriter::Write(&p, false, &json); | 219 base::JSONWriter::Write(&p, false, &json); |
220 l->append(UTF8ToWide(json)); | 220 l->append(UTF8ToWide(json)); |
221 } | 221 } |
222 | 222 |
223 void ParamTraits<ListValue>::Write(Message* m, const param_type& p) { | 223 void ParamTraits<ListValue>::Write(Message* m, const param_type& p) { |
224 WriteValue(m, &p, 0); | 224 WriteValue(m, &p, 0); |
225 } | 225 } |
226 | 226 |
227 bool ParamTraits<ListValue>::Read( | 227 bool ParamTraits<ListValue>::Read( |
228 const Message* m, void** iter, param_type* r) { | 228 const Message* m, void** iter, param_type* r) { |
229 int type; | 229 int type; |
230 if (!ReadParam(m, iter, &type) || type != Value::TYPE_LIST) | 230 if (!ReadParam(m, iter, &type) || type != Value::TYPE_LIST) |
231 return false; | 231 return false; |
232 | 232 |
233 return ReadListValue(m, iter, r, 0); | 233 return ReadListValue(m, iter, r, 0); |
234 } | 234 } |
235 | 235 |
236 void ParamTraits<ListValue>::Log(const param_type& p, std::wstring* l) { | 236 void ParamTraits<ListValue>::Log(const param_type& p, std::wstring* l) { |
237 std::string json; | 237 std::string json; |
238 JSONWriter::Write(&p, false, &json); | 238 base::JSONWriter::Write(&p, false, &json); |
239 l->append(UTF8ToWide(json)); | 239 l->append(UTF8ToWide(json)); |
240 } | 240 } |
241 } // namespace IPC | 241 } // namespace IPC |
OLD | NEW |