1 // Copyright (c) 2013 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_TRUETYPE_FONT_RESOURCE_H_
6 #define PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_
11 #include "ppapi/proxy/connection.h"
12 #include "ppapi/proxy/plugin_resource.h"
13 #include "ppapi/proxy/ppapi_proxy_export.h"
14 #include "ppapi/proxy/serialized_structs.h"
15 #include "ppapi/shared_impl/var.h"
16 #include "ppapi/thunk/ppb_truetype_font_api.h"
20 class TrackedCallback
;
24 struct SerializedTrueTypeFontDesc
;
26 class PPAPI_PROXY_EXPORT TrueTypeFontResource
27 : public PluginResource
,
28 public thunk::PPB_TrueTypeFont_API
{
30 TrueTypeFontResource(Connection connection
,
32 const PP_TrueTypeFontDesc_Dev
& desc
);
33 ~TrueTypeFontResource() override
;
35 // Resource implementation.
36 thunk::PPB_TrueTypeFont_API
* AsPPB_TrueTypeFont_API() override
;
38 // PPB_TrueTypeFont_API implementation.
40 PP_TrueTypeFontDesc_Dev
* desc
,
41 scoped_refptr
<TrackedCallback
> callback
) override
;
43 const PP_ArrayOutput
& output
,
44 scoped_refptr
<TrackedCallback
> callback
) override
;
48 int32_t max_data_length
,
49 const PP_ArrayOutput
& output
,
50 scoped_refptr
<TrackedCallback
> callback
) override
;
52 // PluginResource implementation.
53 void OnReplyReceived(const ResourceMessageReplyParams
& params
,
54 const IPC::Message
& msg
) override
;
57 void OnPluginMsgCreateComplete(
58 const ResourceMessageReplyParams
& params
,
59 const ppapi::proxy::SerializedTrueTypeFontDesc
& desc
,
61 void OnPluginMsgGetTableTagsComplete(
62 scoped_refptr
<TrackedCallback
> callback
,
63 PP_ArrayOutput array_output
,
64 const ResourceMessageReplyParams
& params
,
65 const std::vector
<uint32_t>& data
);
66 void OnPluginMsgGetTableComplete(
67 scoped_refptr
<TrackedCallback
> callback
,
68 PP_ArrayOutput array_output
,
69 const ResourceMessageReplyParams
& params
,
70 const std::string
& data
);
72 int32_t create_result_
;
73 // Valid only when create_result_ == PP_OK.
74 ppapi::proxy::SerializedTrueTypeFontDesc desc_
;
76 // Params for pending Describe call.
77 PP_TrueTypeFontDesc_Dev
* describe_desc_
;
78 scoped_refptr
<TrackedCallback
> describe_callback_
;
80 DISALLOW_COPY_AND_ASSIGN(TrueTypeFontResource
);
86 #endif // PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_