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" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 WriteParam(m, p.address()); | 113 WriteParam(m, p.address()); |
114 WriteParam(m, p.port()); | 114 WriteParam(m, p.port()); |
115 } | 115 } |
116 | 116 |
117 bool ParamTraits<net::IPEndPoint>::Read(const Message* m, PickleIterator* iter, | 117 bool ParamTraits<net::IPEndPoint>::Read(const Message* m, PickleIterator* iter, |
118 param_type* p) { | 118 param_type* p) { |
119 net::IPAddressNumber address; | 119 net::IPAddressNumber address; |
120 int port; | 120 int port; |
121 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) | 121 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) |
122 return false; | 122 return false; |
| 123 if (address.size() && |
| 124 address.size() != net::kIPv4AddressSize && |
| 125 address.size() != net::kIPv6AddressSize) { |
| 126 return false; |
| 127 } |
123 *p = net::IPEndPoint(address, port); | 128 *p = net::IPEndPoint(address, port); |
124 return true; | 129 return true; |
125 } | 130 } |
126 | 131 |
127 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { | 132 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { |
128 LogParam("IPEndPoint:" + p.ToString(), l); | 133 LogParam("IPEndPoint:" + p.ToString(), l); |
129 } | 134 } |
130 | 135 |
131 void ParamTraits<content::PageState>::Write( | 136 void ParamTraits<content::PageState>::Write( |
132 Message* m, const param_type& p) { | 137 Message* m, const param_type& p) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 383 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
379 #include "content/public/common/common_param_traits_macros.h" | 384 #include "content/public/common/common_param_traits_macros.h" |
380 } // namespace IPC | 385 } // namespace IPC |
381 | 386 |
382 // Generate param traits log methods. | 387 // Generate param traits log methods. |
383 #include "ipc/param_traits_log_macros.h" | 388 #include "ipc/param_traits_log_macros.h" |
384 namespace IPC { | 389 namespace IPC { |
385 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 390 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
386 #include "content/public/common/common_param_traits_macros.h" | 391 #include "content/public/common/common_param_traits_macros.h" |
387 } // namespace IPC | 392 } // namespace IPC |
OLD | NEW |