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_
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"
24 struct PP_NetAddress_Private
;
29 class PPB_X509Certificate_Fields
;
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
;
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
);
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
);
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
);
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.
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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)
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
);
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)
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
);
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
);
209 #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_