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 "ipc/ipc_message_utils.h" | 5 #include "ipc/ipc_message_utils.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/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/strings/nullable_string16.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "ipc/ipc_channel_handle.h" | 15 #include "ipc/ipc_channel_handle.h" |
16 | 16 |
17 #if defined(OS_POSIX) | 17 #if defined(OS_POSIX) |
18 #include "ipc/file_descriptor_set_posix.h" | 18 #include "ipc/file_descriptor_set_posix.h" |
19 #elif defined(OS_WIN) | 19 #elif defined(OS_WIN) |
20 #include <tchar.h> | 20 #include <tchar.h> |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 518 |
519 return ReadListValue(m, iter, r, 0); | 519 return ReadListValue(m, iter, r, 0); |
520 } | 520 } |
521 | 521 |
522 void ParamTraits<ListValue>::Log(const param_type& p, std::string* l) { | 522 void ParamTraits<ListValue>::Log(const param_type& p, std::string* l) { |
523 std::string json; | 523 std::string json; |
524 base::JSONWriter::Write(&p, &json); | 524 base::JSONWriter::Write(&p, &json); |
525 l->append(json); | 525 l->append(json); |
526 } | 526 } |
527 | 527 |
528 void ParamTraits<NullableString16>::Write(Message* m, const param_type& p) { | 528 void ParamTraits<base::NullableString16>::Write(Message* m, |
| 529 const param_type& p) { |
529 WriteParam(m, p.string()); | 530 WriteParam(m, p.string()); |
530 WriteParam(m, p.is_null()); | 531 WriteParam(m, p.is_null()); |
531 } | 532 } |
532 | 533 |
533 bool ParamTraits<NullableString16>::Read(const Message* m, PickleIterator* iter, | 534 bool ParamTraits<base::NullableString16>::Read(const Message* m, |
534 param_type* r) { | 535 PickleIterator* iter, |
| 536 param_type* r) { |
535 string16 string; | 537 string16 string; |
536 if (!ReadParam(m, iter, &string)) | 538 if (!ReadParam(m, iter, &string)) |
537 return false; | 539 return false; |
538 bool is_null; | 540 bool is_null; |
539 if (!ReadParam(m, iter, &is_null)) | 541 if (!ReadParam(m, iter, &is_null)) |
540 return false; | 542 return false; |
541 *r = NullableString16(string, is_null); | 543 *r = base::NullableString16(string, is_null); |
542 return true; | 544 return true; |
543 } | 545 } |
544 | 546 |
545 void ParamTraits<NullableString16>::Log(const param_type& p, std::string* l) { | 547 void ParamTraits<base::NullableString16>::Log(const param_type& p, |
| 548 std::string* l) { |
546 l->append("("); | 549 l->append("("); |
547 LogParam(p.string(), l); | 550 LogParam(p.string(), l); |
548 l->append(", "); | 551 l->append(", "); |
549 LogParam(p.is_null(), l); | 552 LogParam(p.is_null(), l); |
550 l->append(")"); | 553 l->append(")"); |
551 } | 554 } |
552 | 555 |
553 void ParamTraits<base::PlatformFileInfo>::Write(Message* m, | 556 void ParamTraits<base::PlatformFileInfo>::Write(Message* m, |
554 const param_type& p) { | 557 const param_type& p) { |
555 WriteParam(m, p.size); | 558 WriteParam(m, p.size); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 return result; | 821 return result; |
819 } | 822 } |
820 | 823 |
821 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 824 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
822 l->append("<MSG>"); | 825 l->append("<MSG>"); |
823 } | 826 } |
824 | 827 |
825 #endif // OS_WIN | 828 #endif // OS_WIN |
826 | 829 |
827 } // namespace IPC | 830 } // namespace IPC |
OLD | NEW |