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/public/common/common_param_traits.h" | 5 #include "content/public/common/common_param_traits.h" |
6 | 6 |
7 #include "content/public/common/content_constants.h" | 7 #include "content/public/common/content_constants.h" |
8 #include "content/public/common/page_state.h" | 8 #include "content/public/common/page_state.h" |
9 #include "content/public/common/referrer.h" | 9 #include "content/public/common/referrer.h" |
10 #include "content/public/common/url_utils.h" | 10 #include "content/public/common/url_utils.h" |
11 #include "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
| 12 #include "net/base/ip_endpoint.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
13 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
14 #include "ui/gfx/rect_f.h" | 15 #include "ui/gfx/rect_f.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 struct SkBitmap_Data { | 19 struct SkBitmap_Data { |
19 // The configuration for the bitmap (bits per pixel, etc). | 20 // The configuration for the bitmap (bits per pixel, etc). |
20 SkBitmap::Config fConfig; | 21 SkBitmap::Config fConfig; |
21 | 22 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 r->set_host(host); | 103 r->set_host(host); |
103 r->set_port(port); | 104 r->set_port(port); |
104 return true; | 105 return true; |
105 } | 106 } |
106 | 107 |
107 void ParamTraits<net::HostPortPair>::Log(const param_type& p, std::string* l) { | 108 void ParamTraits<net::HostPortPair>::Log(const param_type& p, std::string* l) { |
108 l->append(p.ToString()); | 109 l->append(p.ToString()); |
109 } | 110 } |
110 | 111 |
| 112 void ParamTraits<net::IPEndPoint>::Write(Message* m, const param_type& p) { |
| 113 WriteParam(m, p.address()); |
| 114 WriteParam(m, p.port()); |
| 115 } |
| 116 |
| 117 bool ParamTraits<net::IPEndPoint>::Read(const Message* m, PickleIterator* iter, |
| 118 param_type* p) { |
| 119 net::IPAddressNumber address; |
| 120 int port; |
| 121 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) |
| 122 return false; |
| 123 *p = net::IPEndPoint(address, port); |
| 124 return true; |
| 125 } |
| 126 |
| 127 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { |
| 128 LogParam("IPEndPoint:" + p.ToString(), l); |
| 129 } |
| 130 |
111 void ParamTraits<content::PageState>::Write( | 131 void ParamTraits<content::PageState>::Write( |
112 Message* m, const param_type& p) { | 132 Message* m, const param_type& p) { |
113 WriteParam(m, p.ToEncodedData()); | 133 WriteParam(m, p.ToEncodedData()); |
114 } | 134 } |
115 | 135 |
116 bool ParamTraits<content::PageState>::Read( | 136 bool ParamTraits<content::PageState>::Read( |
117 const Message* m, PickleIterator* iter, param_type* r) { | 137 const Message* m, PickleIterator* iter, param_type* r) { |
118 std::string data; | 138 std::string data; |
119 if (!ReadParam(m, iter, &data)) | 139 if (!ReadParam(m, iter, &data)) |
120 return false; | 140 return false; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 378 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
359 #include "content/public/common/common_param_traits_macros.h" | 379 #include "content/public/common/common_param_traits_macros.h" |
360 } // namespace IPC | 380 } // namespace IPC |
361 | 381 |
362 // Generate param traits log methods. | 382 // Generate param traits log methods. |
363 #include "ipc/param_traits_log_macros.h" | 383 #include "ipc/param_traits_log_macros.h" |
364 namespace IPC { | 384 namespace IPC { |
365 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 385 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
366 #include "content/public/common/common_param_traits_macros.h" | 386 #include "content/public/common/common_param_traits_macros.h" |
367 } // namespace IPC | 387 } // namespace IPC |
OLD | NEW |