[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 1 | // Copyright (c) 2010 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. |
| 4 | |
| 5 | #ifndef PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_ |
| 6 | #define PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_ |
| 7 | |
| 8 | #include "ipc/ipc_message_utils.h" |
| 9 | #include "ppapi/c/pp_completion_callback.h" |
| 10 | #include "ppapi/c/pp_input_event.h" |
| 11 | #include "ppapi/c/pp_rect.h" |
| 12 | #include "ppapi/c/pp_var.h" |
| 13 | #include "ppapi/proxy/serialized_var.h" // TODO(brettw) eraseme. |
| 14 | |
[email protected] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame^] | 15 | struct PP_ObjectProperty; |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 16 | |
| 17 | namespace pp { |
| 18 | namespace proxy { |
[email protected] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame^] | 19 | struct PPBFont_DrawTextAt_Params; |
| 20 | class SerializedFontDescription; |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 21 | class SerializedVar; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | namespace IPC { |
| 26 | |
| 27 | template<> |
[email protected] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame^] | 28 | struct ParamTraits<PP_Bool> { |
| 29 | typedef PP_Bool param_type; |
| 30 | static void Write(Message* m, const param_type& p); |
| 31 | static bool Read(const Message* m, void** iter, param_type* r); |
| 32 | static void Log(const param_type& p, std::string* l); |
| 33 | }; |
| 34 | |
| 35 | template<> |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 36 | struct ParamTraits<PP_InputEvent> { |
| 37 | typedef PP_InputEvent param_type; |
| 38 | static void Write(Message* m, const param_type& p); |
| 39 | static bool Read(const Message* m, void** iter, param_type* r); |
| 40 | static void Log(const param_type& p, std::string* l); |
| 41 | }; |
| 42 | |
| 43 | template<> |
| 44 | struct ParamTraits<PP_ObjectProperty> { |
| 45 | typedef PP_ObjectProperty param_type; |
| 46 | static void Write(Message* m, const param_type& p); |
| 47 | static bool Read(const Message* m, void** iter, param_type* r); |
| 48 | static void Log(const param_type& p, std::string* l); |
| 49 | }; |
| 50 | |
| 51 | template<> |
| 52 | struct ParamTraits<PP_Point> { |
| 53 | typedef PP_Point param_type; |
| 54 | static void Write(Message* m, const param_type& p); |
| 55 | static bool Read(const Message* m, void** iter, param_type* r); |
| 56 | static void Log(const param_type& p, std::string* l); |
| 57 | }; |
| 58 | |
| 59 | template<> |
| 60 | struct ParamTraits<PP_Rect> { |
| 61 | typedef PP_Rect param_type; |
| 62 | static void Write(Message* m, const param_type& p); |
| 63 | static bool Read(const Message* m, void** iter, param_type* r); |
| 64 | static void Log(const param_type& p, std::string* l); |
| 65 | }; |
| 66 | |
| 67 | template<> |
| 68 | struct ParamTraits<PP_Size> { |
| 69 | typedef PP_Size param_type; |
| 70 | static void Write(Message* m, const param_type& p); |
| 71 | static bool Read(const Message* m, void** iter, param_type* r); |
| 72 | static void Log(const param_type& p, std::string* l); |
| 73 | }; |
| 74 | |
| 75 | template<> |
[email protected] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame^] | 76 | struct ParamTraits<pp::proxy::PPBFont_DrawTextAt_Params> { |
| 77 | typedef pp::proxy::PPBFont_DrawTextAt_Params param_type; |
| 78 | static void Write(Message* m, const param_type& p); |
| 79 | static bool Read(const Message* m, void** iter, param_type* r); |
| 80 | static void Log(const param_type& p, std::string* l); |
| 81 | }; |
| 82 | |
| 83 | template<> |
| 84 | struct ParamTraits<pp::proxy::SerializedFontDescription> { |
| 85 | typedef pp::proxy::SerializedFontDescription param_type; |
| 86 | static void Write(Message* m, const param_type& p); |
| 87 | static bool Read(const Message* m, void** iter, param_type* r); |
| 88 | static void Log(const param_type& p, std::string* l); |
| 89 | }; |
| 90 | |
| 91 | template<> |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 92 | struct ParamTraits<pp::proxy::SerializedVar> { |
| 93 | typedef pp::proxy::SerializedVar param_type; |
| 94 | static void Write(Message* m, const param_type& p); |
| 95 | static bool Read(const Message* m, void** iter, param_type* r); |
| 96 | static void Log(const param_type& p, std::string* l); |
| 97 | }; |
| 98 | |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 99 | template<> |
| 100 | struct ParamTraits< std::vector<pp::proxy::SerializedVar> > { |
| 101 | typedef std::vector<pp::proxy::SerializedVar> param_type; |
| 102 | static void Write(Message* m, const param_type& p); |
| 103 | static bool Read(const Message* m, void** iter, param_type* r); |
| 104 | static void Log(const param_type& p, std::string* l); |
| 105 | }; |
| 106 | |
| 107 | } // namespace IPC |
| 108 | |
| 109 | #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_ |