| 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> | 7 #include <string> |
| 8 | 8 |
| 9 #include "content/public/common/content_constants.h" | 9 #include "content/public/common/content_constants.h" |
| 10 #include "content/public/common/page_state.h" | 10 #include "content/public/common/page_state.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 *p = GURL(); | 47 *p = GURL(); |
| 48 return false; | 48 return false; |
| 49 } | 49 } |
| 50 return true; | 50 return true; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { | 53 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { |
| 54 l->append(p.spec()); | 54 l->append(p.spec()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void ParamTraits<url::Origin>::Write(Message* m, | 57 void ParamTraits<url::Origin>::Write(Message* m, const url::Origin& p) { |
| 58 const url::Origin& p) { | 58 WriteParam(m, p.scheme()); |
| 59 m->WriteString(p.string()); | 59 WriteParam(m, p.host()); |
| 60 WriteParam(m, p.port()); |
| 60 } | 61 } |
| 61 | 62 |
| 62 bool ParamTraits<url::Origin>::Read(const Message* m, | 63 bool ParamTraits<url::Origin>::Read(const Message* m, |
| 63 PickleIterator* iter, | 64 PickleIterator* iter, |
| 64 url::Origin* p) { | 65 url::Origin* p) { |
| 65 std::string s; | 66 std::string scheme; |
| 66 if (!iter->ReadString(&s)) { | 67 std::string host; |
| 68 uint16 port; |
| 69 if (!ReadParam(m, iter, &scheme) || !ReadParam(m, iter, &host) || |
| 70 !ReadParam(m, iter, &port)) { |
| 67 *p = url::Origin(); | 71 *p = url::Origin(); |
| 68 return false; | 72 return false; |
| 69 } | 73 } |
| 70 *p = url::Origin(s); | 74 *p = url::Origin(scheme, host, port); |
| 71 return true; | 75 return true; |
| 72 } | 76 } |
| 73 | 77 |
| 74 void ParamTraits<url::Origin>::Log(const url::Origin& p, std::string* l) { | 78 void ParamTraits<url::Origin>::Log(const url::Origin& p, std::string* l) { |
| 75 l->append(p.string()); | 79 l->append(p.serialize()); |
| 76 } | 80 } |
| 77 | 81 |
| 78 void ParamTraits<net::HostPortPair>::Write(Message* m, const param_type& p) { | 82 void ParamTraits<net::HostPortPair>::Write(Message* m, const param_type& p) { |
| 79 WriteParam(m, p.host()); | 83 WriteParam(m, p.host()); |
| 80 WriteParam(m, p.port()); | 84 WriteParam(m, p.port()); |
| 81 } | 85 } |
| 82 | 86 |
| 83 bool ParamTraits<net::HostPortPair>::Read(const Message* m, | 87 bool ParamTraits<net::HostPortPair>::Read(const Message* m, |
| 84 PickleIterator* iter, | 88 PickleIterator* iter, |
| 85 param_type* r) { | 89 param_type* r) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 161 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
| 158 #include "content/public/common/common_param_traits_macros.h" | 162 #include "content/public/common/common_param_traits_macros.h" |
| 159 } // namespace IPC | 163 } // namespace IPC |
| 160 | 164 |
| 161 // Generate param traits log methods. | 165 // Generate param traits log methods. |
| 162 #include "ipc/param_traits_log_macros.h" | 166 #include "ipc/param_traits_log_macros.h" |
| 163 namespace IPC { | 167 namespace IPC { |
| 164 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 168 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
| 165 #include "content/public/common/common_param_traits_macros.h" | 169 #include "content/public/common/common_param_traits_macros.h" |
| 166 } // namespace IPC | 170 } // namespace IPC |
| OLD | NEW |