Home | History | Annotate | Download | only in proxy
      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.
      4 
      5 #ifndef PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_
      6 #define PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_
      7 
      8 #include <string>
      9 
     10 #include "ppapi/proxy/connection.h"
     11 #include "ppapi/proxy/plugin_resource.h"
     12 #include "ppapi/proxy/ppapi_proxy_export.h"
     13 #include "ppapi/shared_impl/var.h"
     14 #include "ppapi/thunk/ppb_truetype_font_api.h"
     15 
     16 namespace ppapi {
     17 
     18 class TrackedCallback;
     19 
     20 namespace proxy {
     21 
     22 struct SerializedTrueTypeFontDesc;
     23 
     24 class PPAPI_PROXY_EXPORT TrueTypeFontResource
     25     : public PluginResource,
     26       public thunk::PPB_TrueTypeFont_API {
     27  public:
     28   TrueTypeFontResource(Connection connection,
     29                        PP_Instance instance,
     30                        const PP_TrueTypeFontDesc_Dev& desc);
     31   virtual ~TrueTypeFontResource();
     32 
     33   // Resource overrides.
     34   virtual thunk::PPB_TrueTypeFont_API* AsPPB_TrueTypeFont_API() OVERRIDE;
     35 
     36   // PPB_TrueTypeFont_API implementation.
     37   virtual int32_t Describe(
     38       PP_TrueTypeFontDesc_Dev* desc,
     39       scoped_refptr<TrackedCallback> callback) OVERRIDE;
     40   virtual int32_t GetTableTags(
     41       const PP_ArrayOutput& output,
     42       scoped_refptr<TrackedCallback> callback) OVERRIDE;
     43   virtual int32_t GetTable(
     44       uint32_t table,
     45       int32_t offset,
     46       int32_t max_data_length,
     47       const PP_ArrayOutput& output,
     48       scoped_refptr<TrackedCallback> callback) OVERRIDE;
     49 
     50  private:
     51   void OnPluginMsgDescribeComplete(
     52       scoped_refptr<TrackedCallback> callback,
     53       PP_TrueTypeFontDesc_Dev* pp_desc,
     54       const ResourceMessageReplyParams& params,
     55       const ppapi::proxy::SerializedTrueTypeFontDesc& desc);
     56   void OnPluginMsgGetTableTagsComplete(
     57       scoped_refptr<TrackedCallback> callback,
     58       PP_ArrayOutput array_output,
     59       const ResourceMessageReplyParams& params,
     60       const std::vector<uint32_t>& data);
     61   void OnPluginMsgGetTableComplete(
     62       scoped_refptr<TrackedCallback> callback,
     63       PP_ArrayOutput array_output,
     64       const ResourceMessageReplyParams& params,
     65       const std::string& data);
     66 
     67   DISALLOW_COPY_AND_ASSIGN(TrueTypeFontResource);
     68 };
     69 
     70 }  // namespace proxy
     71 }  // namespace ppapi
     72 
     73 #endif  // PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_
     74