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/ppapi_permissions.h"
19 #include "ppapi/shared_impl/ppb_file_ref_shared.h"
22 struct PP_NetAddress_Private
;
27 class PPB_X509Certificate_Fields
;
31 struct PPBFlash_DrawGlyphs_Params
;
32 struct PPBURLLoader_UpdateProgress_Params
;
33 struct SerializedDirEntry
;
34 struct SerializedFontDescription
;
35 struct SerializedTrueTypeFontDesc
;
36 class SerializedFlashMenu
;
37 class SerializedHandle
;
46 struct PPAPI_PROXY_EXPORT ParamTraits
<PP_Bool
> {
47 typedef PP_Bool param_type
;
48 static void Write(Message
* m
, const param_type
& p
);
49 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
50 static void Log(const param_type
& p
, std::string
* l
);
54 struct PPAPI_PROXY_EXPORT ParamTraits
<PP_FileInfo
> {
55 typedef PP_FileInfo param_type
;
56 static void Write(Message
* m
, const param_type
& p
);
57 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
58 static void Log(const param_type
& p
, std::string
* l
);
62 struct PPAPI_PROXY_EXPORT ParamTraits
<PP_NetAddress_Private
> {
63 typedef PP_NetAddress_Private param_type
;
64 static void Write(Message
* m
, const param_type
& p
);
65 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
66 static void Log(const param_type
& p
, std::string
* l
);
70 struct PPAPI_PROXY_EXPORT ParamTraits
<
71 ppapi::proxy::PPBFlash_DrawGlyphs_Params
> {
72 typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type
;
73 static void Write(Message
* m
, const param_type
& p
);
74 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
75 static void Log(const param_type
& p
, std::string
* l
);
79 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::PPB_FileRef_CreateInfo
> {
80 typedef ppapi::PPB_FileRef_CreateInfo param_type
;
81 static void Write(Message
* m
, const param_type
& p
);
82 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
83 static void Log(const param_type
& p
, std::string
* l
);
87 struct PPAPI_PROXY_EXPORT ParamTraits
<
88 ppapi::proxy::PPBURLLoader_UpdateProgress_Params
> {
89 typedef ppapi::proxy::PPBURLLoader_UpdateProgress_Params param_type
;
90 static void Write(Message
* m
, const param_type
& p
);
91 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
92 static void Log(const param_type
& p
, std::string
* l
);
96 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedDirEntry
> {
97 typedef ppapi::proxy::SerializedDirEntry param_type
;
98 static void Write(Message
* m
, const param_type
& p
);
99 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
100 static void Log(const param_type
& p
, std::string
* l
);
104 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedFontDescription
> {
105 typedef ppapi::proxy::SerializedFontDescription param_type
;
106 static void Write(Message
* m
, const param_type
& p
);
107 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
108 static void Log(const param_type
& p
, std::string
* l
);
112 struct PPAPI_PROXY_EXPORT
113 ParamTraits
<ppapi::proxy::SerializedTrueTypeFontDesc
> {
114 typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type
;
115 static void Write(Message
* m
, const param_type
& p
);
116 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
117 static void Log(const param_type
& p
, std::string
* l
);
121 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedHandle
> {
122 typedef ppapi::proxy::SerializedHandle param_type
;
123 static void Write(Message
* m
, const param_type
& p
);
124 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
125 static void Log(const param_type
& p
, std::string
* l
);
129 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::HostResource
> {
130 typedef ppapi::HostResource param_type
;
131 static void Write(Message
* m
, const param_type
& p
);
132 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
133 static void Log(const param_type
& p
, std::string
* l
);
137 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedVar
> {
138 typedef ppapi::proxy::SerializedVar param_type
;
139 static void Write(Message
* m
, const param_type
& p
);
140 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
141 static void Log(const param_type
& p
, std::string
* l
);
145 struct PPAPI_PROXY_EXPORT ParamTraits
<
146 std::vector
<ppapi::proxy::SerializedVar
> > {
147 typedef std::vector
<ppapi::proxy::SerializedVar
> param_type
;
148 static void Write(Message
* m
, const param_type
& p
);
149 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
150 static void Log(const param_type
& p
, std::string
* l
);
154 struct PPAPI_PROXY_EXPORT ParamTraits
< std::vector
<
155 ppapi::PPB_FileRef_CreateInfo
> > {
156 typedef std::vector
<ppapi::PPB_FileRef_CreateInfo
> param_type
;
157 static void Write(Message
* m
, const param_type
& p
);
158 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
159 static void Log(const param_type
& p
, std::string
* l
);
163 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::PpapiPermissions
> {
164 typedef ppapi::PpapiPermissions param_type
;
165 static void Write(Message
* m
, const param_type
& p
);
166 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
167 static void Log(const param_type
& p
, std::string
* l
);
170 #if !defined(OS_NACL) && !defined(NACL_WIN64)
172 struct ParamTraits
<ppapi::PepperFilePath
> {
173 typedef ppapi::PepperFilePath param_type
;
174 static void Write(Message
* m
, const param_type
& p
);
175 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
176 static void Log(const param_type
& p
, std::string
* l
);
180 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedFlashMenu
> {
181 typedef ppapi::proxy::SerializedFlashMenu param_type
;
182 static void Write(Message
* m
, const param_type
& p
);
183 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
184 static void Log(const param_type
& p
, std::string
* l
);
186 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
189 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::PPB_X509Certificate_Fields
> {
190 typedef ppapi::PPB_X509Certificate_Fields param_type
;
191 static void Write(Message
* m
, const param_type
& p
);
192 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
193 static void Log(const param_type
& p
, std::string
* l
);
199 #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_