Elim cr-checkbox
[chromium-blink-merge.git] / ppapi / proxy / serialized_structs.h
blobefefadebefe40b05fc3b1c66e7ac5fb833702d82
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_SERIALIZED_STRUCTS_H_
6 #define PPAPI_PROXY_SERIALIZED_STRUCTS_H_
8 #include <string>
9 #include <vector>
11 #include "base/logging.h"
12 #include "base/memory/shared_memory.h"
13 #include "build/build_config.h"
14 #include "ppapi/c/dev/ppb_truetype_font_dev.h"
15 #include "ppapi/c/pp_bool.h"
16 #include "ppapi/c/pp_instance.h"
17 #include "ppapi/c/pp_point.h"
18 #include "ppapi/c/pp_rect.h"
19 #include "ppapi/c/ppb_network_list.h"
20 #include "ppapi/c/private/ppb_net_address_private.h"
21 #include "ppapi/proxy/ppapi_proxy_export.h"
22 #include "ppapi/shared_impl/host_resource.h"
24 struct PP_FontDescription_Dev;
25 struct PP_BrowserFont_Trusted_Description;
27 namespace ppapi {
28 namespace proxy {
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.
33 struct PPAPI_PROXY_EXPORT SerializedFontDescription {
34 SerializedFontDescription();
35 ~SerializedFontDescription();
37 // Converts a PP_FontDescription_Dev to a SerializedFontDescription.
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);
42 void SetFromPPBrowserFontDescription(
43 const PP_BrowserFont_Trusted_Description& desc);
45 // Converts to a PP_FontDescription_Dev. The face name will have one ref
46 // assigned to it. The caller is responsible for freeing it.
47 void SetToPPFontDescription(PP_FontDescription_Dev* desc) const;
48 void SetToPPBrowserFontDescription(
49 PP_BrowserFont_Trusted_Description* desc) const;
51 std::string face;
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;
61 struct PPAPI_PROXY_EXPORT SerializedNetworkInfo {
62 SerializedNetworkInfo();
63 ~SerializedNetworkInfo();
65 std::string name;
66 PP_NetworkList_Type type;
67 PP_NetworkList_State state;
68 std::vector<PP_NetAddress_Private> addresses;
69 std::string display_name;
70 int mtu;
72 typedef std::vector<SerializedNetworkInfo> SerializedNetworkList;
74 struct PPAPI_PROXY_EXPORT SerializedTrueTypeFontDesc {
75 SerializedTrueTypeFontDesc();
76 ~SerializedTrueTypeFontDesc();
78 // Sets this to correspond to the contents of a PP_TrueTypeFontDesc_Dev.
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);
84 // Converts this to a PP_FontDescription_Dev.
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;
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;
98 struct SerializedDirEntry {
99 std::string name;
100 bool is_dir;
103 struct PPAPI_PROXY_EXPORT PPBFlash_DrawGlyphs_Params {
104 PPBFlash_DrawGlyphs_Params();
105 ~PPBFlash_DrawGlyphs_Params();
107 PP_Instance instance;
108 ppapi::HostResource image_data;
109 SerializedFontDescription font_desc;
110 uint32_t color;
111 PP_Point position;
112 PP_Rect clip;
113 float transformation[3][3];
114 PP_Bool allow_subpixel_aa;
115 std::vector<uint16_t> glyph_indices;
116 std::vector<PP_Point> glyph_advances;
119 struct PPBURLLoader_UpdateProgress_Params {
120 PP_Instance instance;
121 ppapi::HostResource resource;
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;
128 struct PPPDecryptor_Buffer {
129 ppapi::HostResource resource;
130 uint32_t size;
131 base::SharedMemoryHandle handle;
134 // TODO(raymes): Make ImageHandle compatible with SerializedHandle.
135 #if defined(OS_WIN)
136 typedef HANDLE ImageHandle;
137 #else
138 typedef base::SharedMemoryHandle ImageHandle;
139 #endif
141 } // namespace proxy
142 } // namespace ppapi
144 #endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_