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 <string> |
| 8 |
7 #include "content/public/common/content_constants.h" | 9 #include "content/public/common/content_constants.h" |
8 #include "content/public/common/page_state.h" | 10 #include "content/public/common/page_state.h" |
9 #include "content/public/common/referrer.h" | 11 #include "content/public/common/referrer.h" |
10 #include "content/public/common/url_utils.h" | 12 #include "content/public/common/url_utils.h" |
11 #include "net/base/host_port_pair.h" | 13 #include "net/base/host_port_pair.h" |
12 #include "net/base/ip_endpoint.h" | 14 #include "net/base/ip_endpoint.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
14 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
15 #include "ui/gfx/rect_f.h" | 17 #include "ui/gfx/rect_f.h" |
16 | 18 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 *p = GURL(); | 82 *p = GURL(); |
81 return false; | 83 return false; |
82 } | 84 } |
83 return true; | 85 return true; |
84 } | 86 } |
85 | 87 |
86 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { | 88 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { |
87 l->append(p.spec()); | 89 l->append(p.spec()); |
88 } | 90 } |
89 | 91 |
| 92 void ParamTraits<url::Origin>::Write(Message* m, |
| 93 const url::Origin& p) { |
| 94 m->WriteString(p.string()); |
| 95 } |
| 96 |
| 97 bool ParamTraits<url::Origin>::Read(const Message* m, |
| 98 PickleIterator* iter, |
| 99 url::Origin* p) { |
| 100 std::string s; |
| 101 if (!m->ReadString(iter, &s)) { |
| 102 *p = url::Origin(); |
| 103 return false; |
| 104 } |
| 105 *p = url::Origin(s); |
| 106 return true; |
| 107 } |
| 108 |
| 109 void ParamTraits<url::Origin>::Log(const url::Origin& p, std::string* l) { |
| 110 l->append(p.string()); |
| 111 } |
| 112 |
90 void ParamTraits<net::HostPortPair>::Write(Message* m, const param_type& p) { | 113 void ParamTraits<net::HostPortPair>::Write(Message* m, const param_type& p) { |
91 WriteParam(m, p.host()); | 114 WriteParam(m, p.host()); |
92 WriteParam(m, p.port()); | 115 WriteParam(m, p.port()); |
93 } | 116 } |
94 | 117 |
95 bool ParamTraits<net::HostPortPair>::Read(const Message* m, | 118 bool ParamTraits<net::HostPortPair>::Read(const Message* m, |
96 PickleIterator* iter, | 119 PickleIterator* iter, |
97 param_type* r) { | 120 param_type* r) { |
98 std::string host; | 121 std::string host; |
99 uint16 port; | 122 uint16 port; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 401 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
379 #include "content/public/common/common_param_traits_macros.h" | 402 #include "content/public/common/common_param_traits_macros.h" |
380 } // namespace IPC | 403 } // namespace IPC |
381 | 404 |
382 // Generate param traits log methods. | 405 // Generate param traits log methods. |
383 #include "ipc/param_traits_log_macros.h" | 406 #include "ipc/param_traits_log_macros.h" |
384 namespace IPC { | 407 namespace IPC { |
385 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 408 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
386 #include "content/public/common/common_param_traits_macros.h" | 409 #include "content/public/common/common_param_traits_macros.h" |
387 } // namespace IPC | 410 } // namespace IPC |
OLD | NEW |