Android WebView: build debug/release based on variant.
[chromium-blink-merge.git] / ppapi / proxy / ppapi_param_traits.h
blobf56415a869f1de7362f796dabea2976462ed2951
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
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_
6 #define PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_
8 #include <string>
9 #include <vector>
11 #include "ipc/ipc_message_utils.h"
12 #include "ipc/ipc_platform_file.h"
13 #include "ppapi/c/pp_completion_callback.h"
14 #include "ppapi/c/pp_rect.h"
15 #include "ppapi/c/pp_var.h"
16 #include "ppapi/proxy/ppapi_proxy_export.h"
17 #include "ppapi/shared_impl/file_path.h"
18 #include "ppapi/shared_impl/file_ref_create_info.h"
19 #include "ppapi/shared_impl/ppapi_permissions.h"
20 #include "ppapi/shared_impl/ppb_file_ref_shared.h"
21 #include "ppapi/shared_impl/socket_option_data.h"
23 struct PP_FileInfo;
24 struct PP_NetAddress_Private;
26 namespace ppapi {
28 class HostResource;
29 class PPB_X509Certificate_Fields;
31 namespace proxy {
33 struct PPBFlash_DrawGlyphs_Params;
34 struct PPBURLLoader_UpdateProgress_Params;
35 struct SerializedDirEntry;
36 struct SerializedFontDescription;
37 struct SerializedTrueTypeFontDesc;
38 class SerializedFlashMenu;
39 class SerializedHandle;
40 class SerializedVar;
42 } // namespace proxy
43 } // namespace ppapi
45 namespace IPC {
47 template<>
48 struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> {
49 typedef PP_Bool param_type;
50 static void Write(Message* m, const param_type& p);
51 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
52 static void Log(const param_type& p, std::string* l);
55 template<>
56 struct PPAPI_PROXY_EXPORT ParamTraits<PP_FileInfo> {
57 typedef PP_FileInfo param_type;
58 static void Write(Message* m, const param_type& p);
59 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
60 static void Log(const param_type& p, std::string* l);
63 template <>
64 struct PPAPI_PROXY_EXPORT ParamTraits<PP_NetAddress_Private> {
65 typedef PP_NetAddress_Private param_type;
66 static void Write(Message* m, const param_type& p);
67 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
68 static void Log(const param_type& p, std::string* l);
71 template<>
72 struct PPAPI_PROXY_EXPORT ParamTraits<
73 ppapi::proxy::PPBFlash_DrawGlyphs_Params> {
74 typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type;
75 static void Write(Message* m, const param_type& p);
76 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
77 static void Log(const param_type& p, std::string* l);
80 // TODO(teravest): Remove this when we've switched over to the new proxy.
81 template<>
82 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_FileRef_CreateInfo> {
83 typedef ppapi::PPB_FileRef_CreateInfo param_type;
84 static void Write(Message* m, const param_type& p);
85 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
86 static void Log(const param_type& p, std::string* l);
89 template<>
90 struct PPAPI_PROXY_EXPORT ParamTraits<
91 ppapi::proxy::PPBURLLoader_UpdateProgress_Params> {
92 typedef ppapi::proxy::PPBURLLoader_UpdateProgress_Params param_type;
93 static void Write(Message* m, const param_type& p);
94 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
95 static void Log(const param_type& p, std::string* l);
98 template<>
99 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedDirEntry> {
100 typedef ppapi::proxy::SerializedDirEntry param_type;
101 static void Write(Message* m, const param_type& p);
102 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
103 static void Log(const param_type& p, std::string* l);
106 template<>
107 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFontDescription> {
108 typedef ppapi::proxy::SerializedFontDescription param_type;
109 static void Write(Message* m, const param_type& p);
110 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
111 static void Log(const param_type& p, std::string* l);
114 template<>
115 struct PPAPI_PROXY_EXPORT
116 ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc> {
117 typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type;
118 static void Write(Message* m, const param_type& p);
119 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
120 static void Log(const param_type& p, std::string* l);
123 template<>
124 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedHandle> {
125 typedef ppapi::proxy::SerializedHandle param_type;
126 static void Write(Message* m, const param_type& p);
127 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
128 static void Log(const param_type& p, std::string* l);
131 template<>
132 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::HostResource> {
133 typedef ppapi::HostResource param_type;
134 static void Write(Message* m, const param_type& p);
135 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
136 static void Log(const param_type& p, std::string* l);
139 template<>
140 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedVar> {
141 typedef ppapi::proxy::SerializedVar param_type;
142 static void Write(Message* m, const param_type& p);
143 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
144 static void Log(const param_type& p, std::string* l);
147 template<>
148 struct PPAPI_PROXY_EXPORT ParamTraits<
149 std::vector<ppapi::proxy::SerializedVar> > {
150 typedef std::vector<ppapi::proxy::SerializedVar> param_type;
151 static void Write(Message* m, const param_type& p);
152 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
153 static void Log(const param_type& p, std::string* l);
156 template<>
157 struct PPAPI_PROXY_EXPORT ParamTraits< std::vector<
158 ppapi::PPB_FileRef_CreateInfo> > {
159 typedef std::vector<ppapi::PPB_FileRef_CreateInfo> param_type;
160 static void Write(Message* m, const param_type& p);
161 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
162 static void Log(const param_type& p, std::string* l);
165 template<>
166 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PpapiPermissions> {
167 typedef ppapi::PpapiPermissions param_type;
168 static void Write(Message* m, const param_type& p);
169 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
170 static void Log(const param_type& p, std::string* l);
173 #if !defined(OS_NACL) && !defined(NACL_WIN64)
174 template <>
175 struct ParamTraits<ppapi::PepperFilePath> {
176 typedef ppapi::PepperFilePath param_type;
177 static void Write(Message* m, const param_type& p);
178 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
179 static void Log(const param_type& p, std::string* l);
182 template<>
183 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFlashMenu> {
184 typedef ppapi::proxy::SerializedFlashMenu param_type;
185 static void Write(Message* m, const param_type& p);
186 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
187 static void Log(const param_type& p, std::string* l);
189 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
191 template<>
192 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_X509Certificate_Fields> {
193 typedef ppapi::PPB_X509Certificate_Fields param_type;
194 static void Write(Message* m, const param_type& p);
195 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
196 static void Log(const param_type& p, std::string* l);
199 template<>
200 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::SocketOptionData> {
201 typedef ppapi::SocketOptionData param_type;
202 static void Write(Message* m, const param_type& p);
203 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
204 static void Log(const param_type& p, std::string* l);
207 } // namespace IPC
209 #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_