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 "content/common/content_param_traits.h" | 5 #include "content/common/content_param_traits.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "content/common/input/web_input_event_traits.h" | 8 #include "content/common/input/web_input_event_traits.h" |
9 #include "net/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
10 #include "ui/gfx/range/range.h" | 10 #include "ui/gfx/range/range.h" |
11 | 11 |
12 namespace IPC { | 12 namespace IPC { |
13 | 13 |
14 void ParamTraits<net::IPEndPoint>::Write(Message* m, const param_type& p) { | |
15 WriteParam(m, p.address()); | |
16 WriteParam(m, p.port()); | |
17 } | |
18 | |
19 bool ParamTraits<net::IPEndPoint>::Read(const Message* m, PickleIterator* iter, | |
20 param_type* p) { | |
21 net::IPAddressNumber address; | |
22 int port; | |
23 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) | |
24 return false; | |
25 *p = net::IPEndPoint(address, port); | |
26 return true; | |
27 } | |
28 | |
29 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { | |
30 LogParam("IPEndPoint:" + p.ToString(), l); | |
31 } | |
32 | |
33 void ParamTraits<gfx::Range>::Write(Message* m, const gfx::Range& r) { | 14 void ParamTraits<gfx::Range>::Write(Message* m, const gfx::Range& r) { |
34 m->WriteUInt64(r.start()); | 15 m->WriteUInt64(r.start()); |
35 m->WriteUInt64(r.end()); | 16 m->WriteUInt64(r.end()); |
36 } | 17 } |
37 | 18 |
38 bool ParamTraits<gfx::Range>::Read(const Message* m, | 19 bool ParamTraits<gfx::Range>::Read(const Message* m, |
39 PickleIterator* iter, | 20 PickleIterator* iter, |
40 gfx::Range* r) { | 21 gfx::Range* r) { |
41 uint64 start, end; | 22 uint64 start, end; |
42 if (!m->ReadUInt64(iter, &start) || !m->ReadUInt64(iter, &end)) | 23 if (!m->ReadUInt64(iter, &start) || !m->ReadUInt64(iter, &end)) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ | 90 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ |
110 #include "content/common/content_param_traits_macros.h" | 91 #include "content/common/content_param_traits_macros.h" |
111 } // namespace IPC | 92 } // namespace IPC |
112 | 93 |
113 // Generate param traits log methods. | 94 // Generate param traits log methods. |
114 #include "ipc/param_traits_log_macros.h" | 95 #include "ipc/param_traits_log_macros.h" |
115 namespace IPC { | 96 namespace IPC { |
116 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ | 97 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ |
117 #include "content/common/content_param_traits_macros.h" | 98 #include "content/common/content_param_traits_macros.h" |
118 } // namespace IPC | 99 } // namespace IPC |
OLD | NEW |