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