Elim cr-checkbox
[chromium-blink-merge.git] / ppapi / proxy / truetype_font_resource.h
blob2f44365b027898da66c194749dfe4dfec482ef86
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_
8 #include <queue>
9 #include <string>
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"
18 namespace ppapi {
20 class TrackedCallback;
22 namespace proxy {
24 struct SerializedTrueTypeFontDesc;
26 class PPAPI_PROXY_EXPORT TrueTypeFontResource
27 : public PluginResource,
28 public thunk::PPB_TrueTypeFont_API {
29 public:
30 TrueTypeFontResource(Connection connection,
31 PP_Instance instance,
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.
39 int32_t Describe(
40 PP_TrueTypeFontDesc_Dev* desc,
41 scoped_refptr<TrackedCallback> callback) override;
42 int32_t GetTableTags(
43 const PP_ArrayOutput& output,
44 scoped_refptr<TrackedCallback> callback) override;
45 int32_t GetTable(
46 uint32_t table,
47 int32_t offset,
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;
56 private:
57 void OnPluginMsgCreateComplete(
58 const ResourceMessageReplyParams& params,
59 const ppapi::proxy::SerializedTrueTypeFontDesc& desc,
60 int32_t result);
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);
83 } // namespace proxy
84 } // namespace ppapi
86 #endif // PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_