blob: efefadebefe40b05fc3b1c66e7ac5fb833702d82 [file] [log] [blame]
[email protected]a0e1adc52012-01-27 07:21:131// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]fb35dcf2010-11-14 17:08:002// 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]246fc492012-08-27 20:28:1811#include "base/logging.h"
[email protected]8299b712013-07-17 19:55:2312#include "base/memory/shared_memory.h"
[email protected]3acbbae42010-12-08 07:50:4013#include "build/build_config.h"
[email protected]725056b72013-03-16 09:57:5114#include "ppapi/c/dev/ppb_truetype_font_dev.h"
[email protected]fb35dcf2010-11-14 17:08:0015#include "ppapi/c/pp_bool.h"
[email protected]859a7f32011-01-15 03:44:1316#include "ppapi/c/pp_instance.h"
[email protected]fb35dcf2010-11-14 17:08:0017#include "ppapi/c/pp_point.h"
18#include "ppapi/c/pp_rect.h"
[email protected]86fbad282013-09-22 06:34:0319#include "ppapi/c/ppb_network_list.h"
[email protected]07d0a6bf2013-09-17 04:15:1020#include "ppapi/c/private/ppb_net_address_private.h"
[email protected]cb65f132012-10-09 17:06:0921#include "ppapi/proxy/ppapi_proxy_export.h"
[email protected]be0a84b2011-08-13 04:18:4422#include "ppapi/shared_impl/host_resource.h"
[email protected]fb35dcf2010-11-14 17:08:0023
24struct PP_FontDescription_Dev;
[email protected]d0e3b4a2012-12-07 22:31:4425struct PP_BrowserFont_Trusted_Description;
[email protected]fb35dcf2010-11-14 17:08:0026
[email protected]4d2efd22011-08-18 21:58:0227namespace ppapi {
[email protected]fb35dcf2010-11-14 17:08:0028namespace proxy {
29
[email protected]d0e3b4a2012-12-07 22:31:4430// 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]f0a04c42011-08-26 22:43:2033struct PPAPI_PROXY_EXPORT SerializedFontDescription {
[email protected]aa20e062010-12-07 23:07:2734 SerializedFontDescription();
35 ~SerializedFontDescription();
36
[email protected]fb35dcf2010-11-14 17:08:0037 // Converts a PP_FontDescription_Dev to a SerializedFontDescription.
38 //
[email protected]cb65f132012-10-09 17:06:0939 // 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]d0e3b4a2012-12-07 22:31:4442 void SetFromPPBrowserFontDescription(
43 const PP_BrowserFont_Trusted_Description& desc);
[email protected]fb35dcf2010-11-14 17:08:0044
45 // Converts to a PP_FontDescription_Dev. The face name will have one ref
[email protected]cb65f132012-10-09 17:06:0946 // assigned to it. The caller is responsible for freeing it.
47 void SetToPPFontDescription(PP_FontDescription_Dev* desc) const;
[email protected]d0e3b4a2012-12-07 22:31:4448 void SetToPPBrowserFontDescription(
49 PP_BrowserFont_Trusted_Description* desc) const;
[email protected]fb35dcf2010-11-14 17:08:0050
[email protected]cb65f132012-10-09 17:06:0951 std::string face;
[email protected]fb35dcf2010-11-14 17:08:0052 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]07d0a6bf2013-09-17 04:15:1061struct PPAPI_PROXY_EXPORT SerializedNetworkInfo {
62 SerializedNetworkInfo();
63 ~SerializedNetworkInfo();
64
65 std::string name;
[email protected]86fbad282013-09-22 06:34:0366 PP_NetworkList_Type type;
67 PP_NetworkList_State state;
[email protected]07d0a6bf2013-09-17 04:15:1068 std::vector<PP_NetAddress_Private> addresses;
69 std::string display_name;
70 int mtu;
71};
72typedef std::vector<SerializedNetworkInfo> SerializedNetworkList;
73
[email protected]725056b72013-03-16 09:57:5174struct 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]fb35dcf2010-11-14 17:08:0098struct SerializedDirEntry {
99 std::string name;
100 bool is_dir;
101};
102
[email protected]24f40c12012-12-19 20:17:42103struct PPAPI_PROXY_EXPORT PPBFlash_DrawGlyphs_Params {
[email protected]aa20e062010-12-07 23:07:27104 PPBFlash_DrawGlyphs_Params();
105 ~PPBFlash_DrawGlyphs_Params();
106
[email protected]859a7f32011-01-15 03:44:13107 PP_Instance instance;
[email protected]be0a84b2011-08-13 04:18:44108 ppapi::HostResource image_data;
[email protected]fb35dcf2010-11-14 17:08:00109 SerializedFontDescription font_desc;
110 uint32_t color;
111 PP_Point position;
112 PP_Rect clip;
113 float transformation[3][3];
[email protected]2e4361ae2011-12-15 00:03:35114 PP_Bool allow_subpixel_aa;
[email protected]fb35dcf2010-11-14 17:08:00115 std::vector<uint16_t> glyph_indices;
116 std::vector<PP_Point> glyph_advances;
117};
118
[email protected]f24448db2011-01-27 20:40:39119struct PPBURLLoader_UpdateProgress_Params {
120 PP_Instance instance;
[email protected]be0a84b2011-08-13 04:18:44121 ppapi::HostResource resource;
[email protected]f24448db2011-01-27 20:40:39122 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]e5aeef02012-08-17 00:18:43128struct PPPDecryptor_Buffer {
129 ppapi::HostResource resource;
130 uint32_t size;
131 base::SharedMemoryHandle handle;
132};
133
[email protected]f5869d8be2013-04-06 00:33:10134// TODO(raymes): Make ImageHandle compatible with SerializedHandle.
[email protected]3acbbae42010-12-08 07:50:40135#if defined(OS_WIN)
136typedef HANDLE ImageHandle;
[email protected]1dfb8bef2013-05-17 07:31:44137#else
138typedef base::SharedMemoryHandle ImageHandle;
[email protected]3acbbae42010-12-08 07:50:40139#endif
140
[email protected]fb35dcf2010-11-14 17:08:00141} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02142} // namespace ppapi
[email protected]fb35dcf2010-11-14 17:08:00143
[email protected]fb35dcf2010-11-14 17:08:00144#endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_