OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_FLASH_FONT_FILE_RESOURCE_H_ |
| 6 #define PPAPI_PROXY_FLASH_FONT_FILE_RESOURCE_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/linked_ptr.h" |
| 14 #include "ppapi/c/private/pp_private_font_charset.h" |
| 15 #include "ppapi/proxy/plugin_resource.h" |
| 16 #include "ppapi/proxy/serialized_structs.h" |
| 17 #include "ppapi/thunk/ppb_flash_font_file_api.h" |
| 18 |
| 19 struct PP_FontDescription_Dev; |
| 20 |
| 21 namespace ppapi { |
| 22 namespace proxy { |
| 23 |
| 24 // TODO(yzshen): write unittest and browser test. |
| 25 class FlashFontFileResource : public PluginResource, |
| 26 public thunk::PPB_Flash_FontFile_API { |
| 27 public: |
| 28 FlashFontFileResource(Connection connection, |
| 29 PP_Instance instance, |
| 30 const PP_FontDescription_Dev* description, |
| 31 PP_PrivateFontCharset charset); |
| 32 virtual ~FlashFontFileResource(); |
| 33 |
| 34 // Resource overrides. |
| 35 virtual thunk::PPB_Flash_FontFile_API* AsPPB_Flash_FontFile_API() OVERRIDE; |
| 36 |
| 37 // PPB_Flash_FontFile_API. |
| 38 virtual PP_Bool GetFontTable(uint32_t table, |
| 39 void* output, |
| 40 uint32_t* output_length) OVERRIDE; |
| 41 |
| 42 private: |
| 43 // Sees if we have a cache of the font table and returns a pointer to it. |
| 44 // Returns NULL if we don't have it. |
| 45 std::string* GetFontTable(uint32_t table) const; |
| 46 |
| 47 std::string* AddFontTable(uint32_t table, const std::string& contents); |
| 48 |
| 49 typedef std::map<uint32_t, linked_ptr<std::string> > FontTableMap; |
| 50 FontTableMap font_tables_; |
| 51 |
| 52 SerializedFontDescription description_; |
| 53 PP_PrivateFontCharset charset_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(FlashFontFileResource); |
| 56 }; |
| 57 |
| 58 } // namespace proxy |
| 59 } // namespace ppapi |
| 60 |
| 61 #endif // PPAPI_PROXY_FLASH_FONT_FILE_RESOURCE_H_ |
OLD | NEW |