[email protected] | a0e1adc5 | 2012-01-27 07:21:13 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [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_SERIALIZED_STRUCTS_H_ | ||||
6 | #define PPAPI_PROXY_SERIALIZED_STRUCTS_H_ | ||||
7 | |||||
8 | #include <string> | ||||
9 | #include <vector> | ||||
10 | |||||
[email protected] | 246fc49 | 2012-08-27 20:28:18 | [diff] [blame] | 11 | #include "base/logging.h" |
[email protected] | 8299b71 | 2013-07-17 19:55:23 | [diff] [blame] | 12 | #include "base/memory/shared_memory.h" |
[email protected] | 3acbbae4 | 2010-12-08 07:50:40 | [diff] [blame] | 13 | #include "build/build_config.h" |
[email protected] | 725056b7 | 2013-03-16 09:57:51 | [diff] [blame] | 14 | #include "ppapi/c/dev/ppb_truetype_font_dev.h" |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 15 | #include "ppapi/c/pp_bool.h" |
[email protected] | 859a7f3 | 2011-01-15 03:44:13 | [diff] [blame] | 16 | #include "ppapi/c/pp_instance.h" |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 17 | #include "ppapi/c/pp_point.h" |
18 | #include "ppapi/c/pp_rect.h" | ||||
[email protected] | 86fbad28 | 2013-09-22 06:34:03 | [diff] [blame] | 19 | #include "ppapi/c/ppb_network_list.h" |
[email protected] | 07d0a6bf | 2013-09-17 04:15:10 | [diff] [blame] | 20 | #include "ppapi/c/private/ppb_net_address_private.h" |
[email protected] | cb65f13 | 2012-10-09 17:06:09 | [diff] [blame] | 21 | #include "ppapi/proxy/ppapi_proxy_export.h" |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 22 | #include "ppapi/shared_impl/host_resource.h" |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 23 | |
24 | struct PP_FontDescription_Dev; | ||||
[email protected] | d0e3b4a | 2012-12-07 22:31:44 | [diff] [blame] | 25 | struct PP_BrowserFont_Trusted_Description; |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 26 | |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 27 | namespace ppapi { |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 28 | namespace proxy { |
29 | |||||
[email protected] | d0e3b4a | 2012-12-07 22:31:44 | [diff] [blame] | 30 | // PP_FontDescription_Dev/PP_BrowserFontDescription (same definition, different |
31 | // names) has to be redefined with a string in place of the PP_Var used for the | ||||
32 | // face name. | ||||
[email protected] | f0a04c4 | 2011-08-26 22:43:20 | [diff] [blame] | 33 | struct PPAPI_PROXY_EXPORT SerializedFontDescription { |
[email protected] | aa20e06 | 2010-12-07 23:07:27 | [diff] [blame] | 34 | SerializedFontDescription(); |
35 | ~SerializedFontDescription(); | ||||
36 | |||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 37 | // Converts a PP_FontDescription_Dev to a SerializedFontDescription. |
38 | // | ||||
[email protected] | cb65f13 | 2012-10-09 17:06:09 | [diff] [blame] | 39 | // The reference of |face| owned by the PP_FontDescription_Dev will be |
40 | // unchanged and the caller is responsible for freeing it. | ||||
41 | void SetFromPPFontDescription(const PP_FontDescription_Dev& desc); | ||||
[email protected] | d0e3b4a | 2012-12-07 22:31:44 | [diff] [blame] | 42 | void SetFromPPBrowserFontDescription( |
43 | const PP_BrowserFont_Trusted_Description& desc); | ||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 44 | |
45 | // Converts to a PP_FontDescription_Dev. The face name will have one ref | ||||
[email protected] | cb65f13 | 2012-10-09 17:06:09 | [diff] [blame] | 46 | // assigned to it. The caller is responsible for freeing it. |
47 | void SetToPPFontDescription(PP_FontDescription_Dev* desc) const; | ||||
[email protected] | d0e3b4a | 2012-12-07 22:31:44 | [diff] [blame] | 48 | void SetToPPBrowserFontDescription( |
49 | PP_BrowserFont_Trusted_Description* desc) const; | ||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 50 | |
[email protected] | cb65f13 | 2012-10-09 17:06:09 | [diff] [blame] | 51 | std::string face; |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 52 | int32_t family; |
53 | uint32_t size; | ||||
54 | int32_t weight; | ||||
55 | PP_Bool italic; | ||||
56 | PP_Bool small_caps; | ||||
57 | int32_t letter_spacing; | ||||
58 | int32_t word_spacing; | ||||
59 | }; | ||||
60 | |||||
[email protected] | 07d0a6bf | 2013-09-17 04:15:10 | [diff] [blame] | 61 | struct PPAPI_PROXY_EXPORT SerializedNetworkInfo { |
62 | SerializedNetworkInfo(); | ||||
63 | ~SerializedNetworkInfo(); | ||||
64 | |||||
65 | std::string name; | ||||
[email protected] | 86fbad28 | 2013-09-22 06:34:03 | [diff] [blame] | 66 | PP_NetworkList_Type type; |
67 | PP_NetworkList_State state; | ||||
[email protected] | 07d0a6bf | 2013-09-17 04:15:10 | [diff] [blame] | 68 | std::vector<PP_NetAddress_Private> addresses; |
69 | std::string display_name; | ||||
70 | int mtu; | ||||
71 | }; | ||||
72 | typedef std::vector<SerializedNetworkInfo> SerializedNetworkList; | ||||
73 | |||||
[email protected] | 725056b7 | 2013-03-16 09:57:51 | [diff] [blame] | 74 | struct PPAPI_PROXY_EXPORT SerializedTrueTypeFontDesc { |
75 | SerializedTrueTypeFontDesc(); | ||||
76 | ~SerializedTrueTypeFontDesc(); | ||||
77 | |||||
78 | // Sets this to correspond to the contents of a PP_TrueTypeFontDesc_Dev. | ||||
79 | // | ||||
80 | // The reference count of the desc.family PP_Var will be unchanged and the | ||||
81 | // caller is responsible for releasing it. | ||||
82 | void SetFromPPTrueTypeFontDesc(const PP_TrueTypeFontDesc_Dev& desc); | ||||
83 | |||||
84 | // Converts this to a PP_FontDescription_Dev. | ||||
85 | // | ||||
86 | // The desc.family PP_Var will have one reference assigned to it. The caller | ||||
87 | // is responsible for releasing it. | ||||
88 | void CopyToPPTrueTypeFontDesc(PP_TrueTypeFontDesc_Dev* desc) const; | ||||
89 | |||||
90 | std::string family; | ||||
91 | PP_TrueTypeFontFamily_Dev generic_family; | ||||
92 | PP_TrueTypeFontStyle_Dev style; | ||||
93 | PP_TrueTypeFontWeight_Dev weight; | ||||
94 | PP_TrueTypeFontWidth_Dev width; | ||||
95 | PP_TrueTypeFontCharset_Dev charset; | ||||
96 | }; | ||||
97 | |||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 98 | struct SerializedDirEntry { |
99 | std::string name; | ||||
100 | bool is_dir; | ||||
101 | }; | ||||
102 | |||||
[email protected] | 24f40c1 | 2012-12-19 20:17:42 | [diff] [blame] | 103 | struct PPAPI_PROXY_EXPORT PPBFlash_DrawGlyphs_Params { |
[email protected] | aa20e06 | 2010-12-07 23:07:27 | [diff] [blame] | 104 | PPBFlash_DrawGlyphs_Params(); |
105 | ~PPBFlash_DrawGlyphs_Params(); | ||||
106 | |||||
[email protected] | 859a7f3 | 2011-01-15 03:44:13 | [diff] [blame] | 107 | PP_Instance instance; |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 108 | ppapi::HostResource image_data; |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 109 | SerializedFontDescription font_desc; |
110 | uint32_t color; | ||||
111 | PP_Point position; | ||||
112 | PP_Rect clip; | ||||
113 | float transformation[3][3]; | ||||
[email protected] | 2e4361ae | 2011-12-15 00:03:35 | [diff] [blame] | 114 | PP_Bool allow_subpixel_aa; |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 115 | std::vector<uint16_t> glyph_indices; |
116 | std::vector<PP_Point> glyph_advances; | ||||
117 | }; | ||||
118 | |||||
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 119 | struct PPBURLLoader_UpdateProgress_Params { |
120 | PP_Instance instance; | ||||
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 121 | ppapi::HostResource resource; |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 122 | int64_t bytes_sent; |
123 | int64_t total_bytes_to_be_sent; | ||||
124 | int64_t bytes_received; | ||||
125 | int64_t total_bytes_to_be_received; | ||||
126 | }; | ||||
127 | |||||
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 128 | struct PPPDecryptor_Buffer { |
129 | ppapi::HostResource resource; | ||||
130 | uint32_t size; | ||||
131 | base::SharedMemoryHandle handle; | ||||
132 | }; | ||||
133 | |||||
[email protected] | f5869d8be | 2013-04-06 00:33:10 | [diff] [blame] | 134 | // TODO(raymes): Make ImageHandle compatible with SerializedHandle. |
[email protected] | 3acbbae4 | 2010-12-08 07:50:40 | [diff] [blame] | 135 | #if defined(OS_WIN) |
136 | typedef HANDLE ImageHandle; | ||||
[email protected] | 1dfb8bef | 2013-05-17 07:31:44 | [diff] [blame] | 137 | #else |
138 | typedef base::SharedMemoryHandle ImageHandle; | ||||
[email protected] | 3acbbae4 | 2010-12-08 07:50:40 | [diff] [blame] | 139 | #endif |
140 | |||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 141 | } // namespace proxy |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 142 | } // namespace ppapi |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 143 | |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 144 | #endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_ |