OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/nullable_string16.h" | 10 #include "base/nullable_string16.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 WriteParam(m, val); | 55 WriteParam(m, val); |
56 break; | 56 break; |
57 } | 57 } |
58 case Value::TYPE_STRING: { | 58 case Value::TYPE_STRING: { |
59 std::string val; | 59 std::string val; |
60 value->GetAsString(&val); | 60 value->GetAsString(&val); |
61 WriteParam(m, val); | 61 WriteParam(m, val); |
62 break; | 62 break; |
63 } | 63 } |
64 case Value::TYPE_BINARY: { | 64 case Value::TYPE_BINARY: { |
65 const BinaryValue* binary = static_cast<const BinaryValue*>(value); | 65 const base::BinaryValue* binary = |
| 66 static_cast<const base::BinaryValue*>(value); |
66 m->WriteData(binary->GetBuffer(), static_cast<int>(binary->GetSize())); | 67 m->WriteData(binary->GetBuffer(), static_cast<int>(binary->GetSize())); |
67 break; | 68 break; |
68 } | 69 } |
69 case Value::TYPE_DICTIONARY: { | 70 case Value::TYPE_DICTIONARY: { |
70 const DictionaryValue* dict = static_cast<const DictionaryValue*>(value); | 71 const DictionaryValue* dict = static_cast<const DictionaryValue*>(value); |
71 | 72 |
72 WriteParam(m, static_cast<int>(dict->size())); | 73 WriteParam(m, static_cast<int>(dict->size())); |
73 | 74 |
74 for (DictionaryValue::key_iterator it = dict->begin_keys(); | 75 for (DictionaryValue::key_iterator it = dict->begin_keys(); |
75 it != dict->end_keys(); ++it) { | 76 it != dict->end_keys(); ++it) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (!ReadParam(m, iter, &val)) | 179 if (!ReadParam(m, iter, &val)) |
179 return false; | 180 return false; |
180 *value = Value::CreateStringValue(val); | 181 *value = Value::CreateStringValue(val); |
181 break; | 182 break; |
182 } | 183 } |
183 case Value::TYPE_BINARY: { | 184 case Value::TYPE_BINARY: { |
184 const char* data; | 185 const char* data; |
185 int length; | 186 int length; |
186 if (!m->ReadData(iter, &data, &length)) | 187 if (!m->ReadData(iter, &data, &length)) |
187 return false; | 188 return false; |
188 *value = BinaryValue::CreateWithCopiedBuffer(data, length); | 189 *value = base::BinaryValue::CreateWithCopiedBuffer(data, length); |
189 break; | 190 break; |
190 } | 191 } |
191 case Value::TYPE_DICTIONARY: { | 192 case Value::TYPE_DICTIONARY: { |
192 scoped_ptr<DictionaryValue> val(new DictionaryValue()); | 193 scoped_ptr<DictionaryValue> val(new DictionaryValue()); |
193 if (!ReadDictionaryValue(m, iter, val.get(), recursion)) | 194 if (!ReadDictionaryValue(m, iter, val.get(), recursion)) |
194 return false; | 195 return false; |
195 *value = val.release(); | 196 *value = val.release(); |
196 break; | 197 break; |
197 } | 198 } |
198 case Value::TYPE_LIST: { | 199 case Value::TYPE_LIST: { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 ReadParam(m, iter, &r->flags) && | 469 ReadParam(m, iter, &r->flags) && |
469 ReadParam(m, iter, &r->sent) && | 470 ReadParam(m, iter, &r->sent) && |
470 ReadParam(m, iter, &r->receive) && | 471 ReadParam(m, iter, &r->receive) && |
471 ReadParam(m, iter, &r->dispatch) && | 472 ReadParam(m, iter, &r->dispatch) && |
472 ReadParam(m, iter, &r->params); | 473 ReadParam(m, iter, &r->params); |
473 r->type = static_cast<uint16>(type); | 474 r->type = static_cast<uint16>(type); |
474 return result; | 475 return result; |
475 } | 476 } |
476 | 477 |
477 } // namespace IPC | 478 } // namespace IPC |
OLD | NEW |