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, or because the same type is being used in multiple | 11 // public members, or because the same type is being used in multiple |
12 // *_messages.h headers. | 12 // *_messages.h headers. |
13 | 13 |
14 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 14 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
15 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 15 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
16 | 16 |
17 #include <stdint.h> | 17 #include <stdint.h> |
18 | 18 |
19 #include <string> | 19 #include <string> |
20 | 20 |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
24 #include "content/public/common/common_param_traits_macros.h" | 24 #include "content/public/common/common_param_traits_macros.h" |
25 #include "ipc/ipc_message_utils.h" | 25 #include "ipc/ipc_message_utils.h" |
26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
27 #include "ui/surface/transport_dib.h" | 27 #include "ui/surface/transport_dib.h" |
28 #include "url/gurl.h" | 28 #include "url/ipc/url_param_traits.h" |
29 #include "url/origin.h" | 29 #include "url/origin.h" |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "base/win/win_util.h" | 32 #include "base/win/win_util.h" |
33 #endif | 33 #endif |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 class PageState; | 36 class PageState; |
37 } | 37 } |
38 | 38 |
39 namespace net { | 39 namespace net { |
40 class HostPortPair; | 40 class HostPortPair; |
41 class IPAddress; | 41 class IPAddress; |
42 class IPEndPoint; | 42 class IPEndPoint; |
43 } | 43 } |
44 | 44 |
45 namespace IPC { | 45 namespace IPC { |
46 | 46 |
47 template <> | 47 template <> |
48 struct CONTENT_EXPORT ParamTraits<GURL> { | |
49 typedef GURL param_type; | |
50 static void Write(base::Pickle* m, const param_type& p); | |
51 static bool Read(const base::Pickle* m, | |
52 base::PickleIterator* iter, | |
53 param_type* p); | |
54 static void Log(const param_type& p, std::string* l); | |
55 }; | |
56 | |
57 template <> | |
58 struct CONTENT_EXPORT ParamTraits<url::Origin> { | 48 struct CONTENT_EXPORT ParamTraits<url::Origin> { |
59 typedef url::Origin param_type; | 49 typedef url::Origin param_type; |
60 static void Write(base::Pickle* m, const param_type& p); | 50 static void Write(base::Pickle* m, const param_type& p); |
61 static bool Read(const base::Pickle* m, | 51 static bool Read(const base::Pickle* m, |
62 base::PickleIterator* iter, | 52 base::PickleIterator* iter, |
63 param_type* p); | 53 param_type* p); |
64 static void Log(const param_type& p, std::string* l); | 54 static void Log(const param_type& p, std::string* l); |
65 }; | 55 }; |
66 | 56 |
67 template<> | 57 template<> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 #endif | 123 #endif |
134 } | 124 } |
135 static void Log(const param_type& p, std::string* l) { | 125 static void Log(const param_type& p, std::string* l) { |
136 l->append("<gfx::NativeWindow>"); | 126 l->append("<gfx::NativeWindow>"); |
137 } | 127 } |
138 }; | 128 }; |
139 | 129 |
140 } // namespace IPC | 130 } // namespace IPC |
141 | 131 |
142 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 132 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |