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/socket_option_data.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_NetAddress_Private
> {
55 typedef PP_NetAddress_Private param_type
;
56 static void Write(Message
* m
, const param_type
& p
);
57 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
58 static void Log(const param_type
& p
, std::string
* l
);
62 struct PPAPI_PROXY_EXPORT ParamTraits
<
63 ppapi::proxy::PPBFlash_DrawGlyphs_Params
> {
64 typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type
;
65 static void Write(Message
* m
, const param_type
& p
);
66 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
67 static void Log(const param_type
& p
, std::string
* l
);
71 struct PPAPI_PROXY_EXPORT ParamTraits
<
72 ppapi::proxy::PPBURLLoader_UpdateProgress_Params
> {
73 typedef ppapi::proxy::PPBURLLoader_UpdateProgress_Params param_type
;
74 static void Write(Message
* m
, const param_type
& p
);
75 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
76 static void Log(const param_type
& p
, std::string
* l
);
80 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedDirEntry
> {
81 typedef ppapi::proxy::SerializedDirEntry param_type
;
82 static void Write(Message
* m
, const param_type
& p
);
83 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
84 static void Log(const param_type
& p
, std::string
* l
);
88 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedFontDescription
> {
89 typedef ppapi::proxy::SerializedFontDescription 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
97 ParamTraits
<ppapi::proxy::SerializedTrueTypeFontDesc
> {
98 typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type
;
99 static void Write(Message
* m
, const param_type
& p
);
100 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
101 static void Log(const param_type
& p
, std::string
* l
);
105 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedHandle
> {
106 typedef ppapi::proxy::SerializedHandle param_type
;
107 static void Write(Message
* m
, const param_type
& p
);
108 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
109 static void Log(const param_type
& p
, std::string
* l
);
113 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::HostResource
> {
114 typedef ppapi::HostResource 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::SerializedVar
> {
122 typedef ppapi::proxy::SerializedVar 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
<
130 std::vector
<ppapi::proxy::SerializedVar
> > {
131 typedef std::vector
<ppapi::proxy::SerializedVar
> param_type
;
132 static void Write(Message
* m
, const param_type
& p
);
133 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
134 static void Log(const param_type
& p
, std::string
* l
);
138 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::PpapiPermissions
> {
139 typedef ppapi::PpapiPermissions param_type
;
140 static void Write(Message
* m
, const param_type
& p
);
141 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
142 static void Log(const param_type
& p
, std::string
* l
);
145 #if !defined(OS_NACL) && !defined(NACL_WIN64)
147 struct ParamTraits
<ppapi::PepperFilePath
> {
148 typedef ppapi::PepperFilePath param_type
;
149 static void Write(Message
* m
, const param_type
& p
);
150 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
151 static void Log(const param_type
& p
, std::string
* l
);
155 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::proxy::SerializedFlashMenu
> {
156 typedef ppapi::proxy::SerializedFlashMenu 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
);
161 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
164 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::PPB_X509Certificate_Fields
> {
165 typedef ppapi::PPB_X509Certificate_Fields param_type
;
166 static void Write(Message
* m
, const param_type
& p
);
167 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
168 static void Log(const param_type
& p
, std::string
* l
);
172 struct PPAPI_PROXY_EXPORT ParamTraits
<ppapi::SocketOptionData
> {
173 typedef ppapi::SocketOptionData param_type
;
174 static void Write(Message
* m
, const param_type
& p
);
175 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
176 static void Log(const param_type
& p
, std::string
* l
);
181 #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_