| 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 // This file is used to define IPC::ParamTraits<> specializations for a number | 5 // This file is used to define IPC::ParamTraits<> specializations for a number |
| 6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> | 6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> |
| 7 // specializations for basic types (like int and std::string) and types in the | 7 // specializations for basic types (like int and std::string) and types in the |
| 8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains | 8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains |
| 9 // specializations for types that are used by the content code, and which need | 9 // specializations for types that are used by the content code, and which need |
| 10 // manual serialization code. This is usually because they're not structs with | 10 // manual serialization code. This is usually because they're not structs with |
| 11 // public members.. | 11 // public members, or because the same type is being used in multiple |
| 12 // *_messages.h headers. |
| 12 | 13 |
| 13 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 14 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| 14 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 15 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| 15 #pragma once | 16 #pragma once |
| 16 | 17 |
| 17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 18 #include "base/platform_file.h" | 19 #include "base/platform_file.h" |
| 19 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 20 #include "content/public/common/page_transition_types.h" | 21 #include "content/public/common/page_transition_types.h" |
| 21 #include "content/public/common/security_style.h" | 22 #include "content/public/common/security_style.h" |
| 22 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
| 23 #include "ipc/ipc_message_utils.h" | 24 #include "ipc/ipc_message_utils.h" |
| 24 #include "net/base/ip_endpoint.h" | 25 #include "net/base/ip_endpoint.h" |
| 25 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
| 26 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
| 27 #include "ui/gfx/surface/transport_dib.h" | 28 #include "ui/gfx/surface/transport_dib.h" |
| 29 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" |
| 28 #include "webkit/glue/resource_type.h" | 30 #include "webkit/glue/resource_type.h" |
| 29 | 31 |
| 30 class SkBitmap; | 32 class SkBitmap; |
| 31 | 33 |
| 34 namespace content { |
| 35 struct Referrer; |
| 36 } |
| 37 |
| 32 namespace gfx { | 38 namespace gfx { |
| 33 class Point; | 39 class Point; |
| 34 class Rect; | 40 class Rect; |
| 35 class Size; | 41 class Size; |
| 36 } // namespace gfx | 42 } // namespace gfx |
| 37 | 43 |
| 38 namespace net { | 44 namespace net { |
| 39 class HttpResponseHeaders; | 45 class HttpResponseHeaders; |
| 40 class HostPortPair; | 46 class HostPortPair; |
| 41 class UploadData; | 47 class UploadData; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 111 |
| 106 template <> | 112 template <> |
| 107 struct ParamTraits<base::PlatformFileInfo> { | 113 struct ParamTraits<base::PlatformFileInfo> { |
| 108 typedef base::PlatformFileInfo param_type; | 114 typedef base::PlatformFileInfo param_type; |
| 109 static void Write(Message* m, const param_type& p); | 115 static void Write(Message* m, const param_type& p); |
| 110 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 116 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 111 static void Log(const param_type& p, std::string* l); | 117 static void Log(const param_type& p, std::string* l); |
| 112 }; | 118 }; |
| 113 | 119 |
| 114 template <> | 120 template <> |
| 121 struct CONTENT_EXPORT ParamTraits<content::Referrer> { |
| 122 typedef content::Referrer param_type; |
| 123 static void Write(Message* m, const param_type& p); |
| 124 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| 125 static void Log(const param_type& p, std::string* l); |
| 126 }; |
| 127 |
| 128 template <> |
| 115 struct CONTENT_EXPORT ParamTraits<gfx::Point> { | 129 struct CONTENT_EXPORT ParamTraits<gfx::Point> { |
| 116 typedef gfx::Point param_type; | 130 typedef gfx::Point param_type; |
| 117 static void Write(Message* m, const param_type& p); | 131 static void Write(Message* m, const param_type& p); |
| 118 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 132 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 119 static void Log(const param_type& p, std::string* l); | 133 static void Log(const param_type& p, std::string* l); |
| 120 }; | 134 }; |
| 121 | 135 |
| 122 template <> | 136 template <> |
| 123 struct CONTENT_EXPORT ParamTraits<gfx::Size> { | 137 struct CONTENT_EXPORT ParamTraits<gfx::Size> { |
| 124 typedef gfx::Size param_type; | 138 typedef gfx::Size param_type; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 240 |
| 227 static void Log(const param_type& p, std::string* l); | 241 static void Log(const param_type& p, std::string* l); |
| 228 }; | 242 }; |
| 229 | 243 |
| 230 template <> | 244 template <> |
| 231 struct SimilarTypeTraits<base::PlatformFileError> { | 245 struct SimilarTypeTraits<base::PlatformFileError> { |
| 232 typedef int Type; | 246 typedef int Type; |
| 233 }; | 247 }; |
| 234 | 248 |
| 235 template <> | 249 template <> |
| 250 struct CONTENT_EXPORT SimilarTypeTraits<WebKit::WebReferrerPolicy> { |
| 251 typedef int Type; |
| 252 }; |
| 253 |
| 254 template <> |
| 236 struct SimilarTypeTraits<content::PageTransition> { | 255 struct SimilarTypeTraits<content::PageTransition> { |
| 237 typedef int Type; | 256 typedef int Type; |
| 238 }; | 257 }; |
| 239 | 258 |
| 240 template <> | 259 template <> |
| 241 struct SimilarTypeTraits<content::SecurityStyle> { | 260 struct SimilarTypeTraits<content::SecurityStyle> { |
| 242 typedef int Type; | 261 typedef int Type; |
| 243 }; | 262 }; |
| 244 | 263 |
| 245 } // namespace IPC | 264 } // namespace IPC |
| 246 | 265 |
| 247 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 266 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| OLD | NEW |