| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_ |
| 6 #define PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_ | 6 #define PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_ |
| 7 | 7 |
| 8 #include <queue> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "ppapi/proxy/connection.h" | 11 #include "ppapi/proxy/connection.h" |
| 11 #include "ppapi/proxy/plugin_resource.h" | 12 #include "ppapi/proxy/plugin_resource.h" |
| 12 #include "ppapi/proxy/ppapi_proxy_export.h" | 13 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 14 #include "ppapi/proxy/serialized_structs.h" |
| 13 #include "ppapi/shared_impl/var.h" | 15 #include "ppapi/shared_impl/var.h" |
| 14 #include "ppapi/thunk/ppb_truetype_font_api.h" | 16 #include "ppapi/thunk/ppb_truetype_font_api.h" |
| 15 | 17 |
| 16 namespace ppapi { | 18 namespace ppapi { |
| 17 | 19 |
| 18 class TrackedCallback; | 20 class TrackedCallback; |
| 19 | 21 |
| 20 namespace proxy { | 22 namespace proxy { |
| 21 | 23 |
| 22 struct SerializedTrueTypeFontDesc; | 24 struct SerializedTrueTypeFontDesc; |
| 23 | 25 |
| 24 class PPAPI_PROXY_EXPORT TrueTypeFontResource | 26 class PPAPI_PROXY_EXPORT TrueTypeFontResource |
| 25 : public PluginResource, | 27 : public PluginResource, |
| 26 public thunk::PPB_TrueTypeFont_API { | 28 public thunk::PPB_TrueTypeFont_API { |
| 27 public: | 29 public: |
| 28 TrueTypeFontResource(Connection connection, | 30 TrueTypeFontResource(Connection connection, |
| 29 PP_Instance instance, | 31 PP_Instance instance, |
| 30 const PP_TrueTypeFontDesc_Dev& desc); | 32 const PP_TrueTypeFontDesc_Dev& desc); |
| 31 virtual ~TrueTypeFontResource(); | 33 virtual ~TrueTypeFontResource(); |
| 32 | 34 |
| 33 // Resource overrides. | 35 // Resource implementation. |
| 34 virtual thunk::PPB_TrueTypeFont_API* AsPPB_TrueTypeFont_API() OVERRIDE; | 36 virtual thunk::PPB_TrueTypeFont_API* AsPPB_TrueTypeFont_API() OVERRIDE; |
| 35 | 37 |
| 36 // PPB_TrueTypeFont_API implementation. | 38 // PPB_TrueTypeFont_API implementation. |
| 37 virtual int32_t Describe( | 39 virtual int32_t Describe( |
| 38 PP_TrueTypeFontDesc_Dev* desc, | 40 PP_TrueTypeFontDesc_Dev* desc, |
| 39 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 41 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 40 virtual int32_t GetTableTags( | 42 virtual int32_t GetTableTags( |
| 41 const PP_ArrayOutput& output, | 43 const PP_ArrayOutput& output, |
| 42 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 44 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 43 virtual int32_t GetTable( | 45 virtual int32_t GetTable( |
| 44 uint32_t table, | 46 uint32_t table, |
| 45 int32_t offset, | 47 int32_t offset, |
| 46 int32_t max_data_length, | 48 int32_t max_data_length, |
| 47 const PP_ArrayOutput& output, | 49 const PP_ArrayOutput& output, |
| 48 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 50 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 49 | 51 |
| 52 // PluginResource implementation. |
| 53 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, |
| 54 const IPC::Message& msg) OVERRIDE; |
| 55 |
| 50 private: | 56 private: |
| 51 void OnPluginMsgDescribeComplete( | 57 void OnPluginMsgCreateComplete( |
| 52 scoped_refptr<TrackedCallback> callback, | |
| 53 PP_TrueTypeFontDesc_Dev* pp_desc, | |
| 54 const ResourceMessageReplyParams& params, | 58 const ResourceMessageReplyParams& params, |
| 55 const ppapi::proxy::SerializedTrueTypeFontDesc& desc); | 59 const ppapi::proxy::SerializedTrueTypeFontDesc& desc, |
| 60 int32_t result); |
| 56 void OnPluginMsgGetTableTagsComplete( | 61 void OnPluginMsgGetTableTagsComplete( |
| 57 scoped_refptr<TrackedCallback> callback, | 62 scoped_refptr<TrackedCallback> callback, |
| 58 PP_ArrayOutput array_output, | 63 PP_ArrayOutput array_output, |
| 59 const ResourceMessageReplyParams& params, | 64 const ResourceMessageReplyParams& params, |
| 60 const std::vector<uint32_t>& data); | 65 const std::vector<uint32_t>& data); |
| 61 void OnPluginMsgGetTableComplete( | 66 void OnPluginMsgGetTableComplete( |
| 62 scoped_refptr<TrackedCallback> callback, | 67 scoped_refptr<TrackedCallback> callback, |
| 63 PP_ArrayOutput array_output, | 68 PP_ArrayOutput array_output, |
| 64 const ResourceMessageReplyParams& params, | 69 const ResourceMessageReplyParams& params, |
| 65 const std::string& data); | 70 const std::string& data); |
| 66 | 71 |
| 72 int32_t create_result_; |
| 73 // Valid only when create_result_ == PP_OK. |
| 74 ppapi::proxy::SerializedTrueTypeFontDesc desc_; |
| 75 |
| 76 // Params for pending Describe call. |
| 77 PP_TrueTypeFontDesc_Dev* describe_desc_; |
| 78 scoped_refptr<TrackedCallback> describe_callback_; |
| 79 |
| 67 DISALLOW_COPY_AND_ASSIGN(TrueTypeFontResource); | 80 DISALLOW_COPY_AND_ASSIGN(TrueTypeFontResource); |
| 68 }; | 81 }; |
| 69 | 82 |
| 70 } // namespace proxy | 83 } // namespace proxy |
| 71 } // namespace ppapi | 84 } // namespace ppapi |
| 72 | 85 |
| 73 #endif // PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_ | 86 #endif // PPAPI_PROXY_TRUETYPE_FONT_RESOURCE_H_ |
| OLD | NEW |