[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 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" |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 9 | #include "ipc/ipc_platform_file.h" |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 10 | #include "ppapi/c/pp_completion_callback.h" |
| 11 | #include "ppapi/c/pp_input_event.h" |
| 12 | #include "ppapi/c/pp_rect.h" |
| 13 | #include "ppapi/c/pp_var.h" |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 14 | |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 15 | struct PP_FileInfo_Dev; |
[email protected] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame] | 16 | struct PP_ObjectProperty; |
[email protected] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 17 | struct PP_Flash_Menu; |
[email protected] | 373a95a | 2011-07-01 16:58:14 | [diff] [blame^] | 18 | struct PP_Flash_NetAddress; |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 19 | |
| 20 | namespace pp { |
| 21 | namespace proxy { |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 22 | |
[email protected] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 23 | class HostResource; |
[email protected] | 4deeb43 | 2011-02-17 23:59:39 | [diff] [blame] | 24 | struct PPBFileRef_CreateInfo; |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 25 | struct PPBFlash_DrawGlyphs_Params; |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 26 | struct PPBURLLoader_UpdateProgress_Params; |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 27 | struct SerializedDirEntry; |
[email protected] | 709a847e | 2010-11-10 01:16:11 | [diff] [blame] | 28 | struct SerializedFontDescription; |
[email protected] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 29 | class SerializedFlashMenu; |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 30 | class SerializedVar; |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 31 | |
| 32 | } // namespace proxy |
| 33 | } // namespace pp |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 34 | |
| 35 | namespace IPC { |
| 36 | |
| 37 | template<> |
[email protected] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame] | 38 | struct ParamTraits<PP_Bool> { |
| 39 | typedef PP_Bool param_type; |
| 40 | static void Write(Message* m, const param_type& p); |
| 41 | static bool Read(const Message* m, void** iter, param_type* r); |
| 42 | static void Log(const param_type& p, std::string* l); |
| 43 | }; |
| 44 | |
| 45 | template<> |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 46 | struct ParamTraits<PP_FileInfo_Dev> { |
| 47 | typedef PP_FileInfo_Dev param_type; |
| 48 | static void Write(Message* m, const param_type& p); |
| 49 | static bool Read(const Message* m, void** iter, param_type* r); |
| 50 | static void Log(const param_type& p, std::string* l); |
| 51 | }; |
| 52 | |
[email protected] | 373a95a | 2011-07-01 16:58:14 | [diff] [blame^] | 53 | template <> |
| 54 | struct ParamTraits<PP_Flash_NetAddress> { |
| 55 | typedef PP_Flash_NetAddress param_type; |
| 56 | static void Write(Message* m, const param_type& p); |
| 57 | static bool Read(const Message* m, void** iter, param_type* p); |
| 58 | static void Log(const param_type& p, std::string* l); |
| 59 | }; |
| 60 | |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 61 | template<> |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 62 | struct ParamTraits<PP_InputEvent> { |
| 63 | typedef PP_InputEvent param_type; |
| 64 | static void Write(Message* m, const param_type& p); |
| 65 | static bool Read(const Message* m, void** iter, param_type* r); |
| 66 | static void Log(const param_type& p, std::string* l); |
| 67 | }; |
| 68 | |
| 69 | template<> |
| 70 | struct ParamTraits<PP_ObjectProperty> { |
| 71 | typedef PP_ObjectProperty param_type; |
| 72 | static void Write(Message* m, const param_type& p); |
| 73 | static bool Read(const Message* m, void** iter, param_type* r); |
| 74 | static void Log(const param_type& p, std::string* l); |
| 75 | }; |
| 76 | |
| 77 | template<> |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 78 | struct ParamTraits<pp::proxy::PPBFlash_DrawGlyphs_Params> { |
| 79 | typedef pp::proxy::PPBFlash_DrawGlyphs_Params param_type; |
| 80 | static void Write(Message* m, const param_type& p); |
| 81 | static bool Read(const Message* m, void** iter, param_type* r); |
| 82 | static void Log(const param_type& p, std::string* l); |
| 83 | }; |
| 84 | |
| 85 | template<> |
[email protected] | 4deeb43 | 2011-02-17 23:59:39 | [diff] [blame] | 86 | struct ParamTraits<pp::proxy::PPBFileRef_CreateInfo> { |
| 87 | typedef pp::proxy::PPBFileRef_CreateInfo param_type; |
| 88 | static void Write(Message* m, const param_type& p); |
| 89 | static bool Read(const Message* m, void** iter, param_type* r); |
| 90 | static void Log(const param_type& p, std::string* l); |
| 91 | }; |
| 92 | |
| 93 | template<> |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 94 | struct ParamTraits<pp::proxy::PPBURLLoader_UpdateProgress_Params> { |
| 95 | typedef pp::proxy::PPBURLLoader_UpdateProgress_Params param_type; |
| 96 | static void Write(Message* m, const param_type& p); |
| 97 | static bool Read(const Message* m, void** iter, param_type* r); |
| 98 | static void Log(const param_type& p, std::string* l); |
| 99 | }; |
| 100 | |
| 101 | template<> |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 102 | struct ParamTraits<pp::proxy::SerializedDirEntry> { |
| 103 | typedef pp::proxy::SerializedDirEntry param_type; |
| 104 | static void Write(Message* m, const param_type& p); |
| 105 | static bool Read(const Message* m, void** iter, param_type* r); |
| 106 | static void Log(const param_type& p, std::string* l); |
| 107 | }; |
| 108 | |
| 109 | template<> |
[email protected] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame] | 110 | struct ParamTraits<pp::proxy::SerializedFontDescription> { |
| 111 | typedef pp::proxy::SerializedFontDescription param_type; |
| 112 | static void Write(Message* m, const param_type& p); |
| 113 | static bool Read(const Message* m, void** iter, param_type* r); |
| 114 | static void Log(const param_type& p, std::string* l); |
| 115 | }; |
| 116 | |
| 117 | template<> |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 118 | struct ParamTraits<pp::proxy::HostResource> { |
| 119 | typedef pp::proxy::HostResource param_type; |
| 120 | static void Write(Message* m, const param_type& p); |
| 121 | static bool Read(const Message* m, void** iter, param_type* r); |
| 122 | static void Log(const param_type& p, std::string* l); |
| 123 | }; |
| 124 | |
| 125 | template<> |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 126 | struct ParamTraits<pp::proxy::SerializedVar> { |
| 127 | typedef pp::proxy::SerializedVar param_type; |
| 128 | static void Write(Message* m, const param_type& p); |
| 129 | static bool Read(const Message* m, void** iter, param_type* r); |
| 130 | static void Log(const param_type& p, std::string* l); |
| 131 | }; |
| 132 | |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 133 | template<> |
| 134 | struct ParamTraits< std::vector<pp::proxy::SerializedVar> > { |
| 135 | typedef std::vector<pp::proxy::SerializedVar> param_type; |
| 136 | static void Write(Message* m, const param_type& p); |
| 137 | static bool Read(const Message* m, void** iter, param_type* r); |
| 138 | static void Log(const param_type& p, std::string* l); |
| 139 | }; |
| 140 | |
[email protected] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 141 | template<> |
[email protected] | 1162a6a | 2011-04-21 17:28:16 | [diff] [blame] | 142 | struct ParamTraits< std::vector<pp::proxy::PPBFileRef_CreateInfo> > { |
| 143 | typedef std::vector<pp::proxy::PPBFileRef_CreateInfo> param_type; |
| 144 | static void Write(Message* m, const param_type& p); |
| 145 | static bool Read(const Message* m, void** iter, param_type* r); |
| 146 | static void Log(const param_type& p, std::string* l); |
| 147 | }; |
| 148 | |
| 149 | template<> |
[email protected] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 150 | struct ParamTraits<pp::proxy::SerializedFlashMenu> { |
| 151 | typedef pp::proxy::SerializedFlashMenu param_type; |
| 152 | static void Write(Message* m, const param_type& p); |
| 153 | static bool Read(const Message* m, void** iter, param_type* r); |
| 154 | static void Log(const param_type& p, std::string* l); |
| 155 | }; |
| 156 | |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 157 | } // namespace IPC |
| 158 | |
| 159 | #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_ |