| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // From private/ppb_flash_font_file.idl modified Thu Oct 22 22:02:40 2015. |
| 6 |
| 7 #include "ppapi/c/pp_errors.h" |
| 5 #include "ppapi/c/private/ppb_flash_font_file.h" | 8 #include "ppapi/c/private/ppb_flash_font_file.h" |
| 9 #include "ppapi/shared_impl/tracked_callback.h" |
| 6 #include "ppapi/thunk/enter.h" | 10 #include "ppapi/thunk/enter.h" |
| 11 #include "ppapi/thunk/ppapi_thunk_export.h" |
| 7 #include "ppapi/thunk/ppb_flash_font_file_api.h" | 12 #include "ppapi/thunk/ppb_flash_font_file_api.h" |
| 8 #include "ppapi/thunk/resource_creation_api.h" | |
| 9 #include "ppapi/thunk/thunk.h" | |
| 10 | 13 |
| 11 namespace ppapi { | 14 namespace ppapi { |
| 12 namespace thunk { | 15 namespace thunk { |
| 13 | 16 |
| 14 namespace { | 17 namespace { |
| 15 | 18 |
| 16 PP_Resource Create(PP_Instance instance, | 19 PP_Resource Create(PP_Instance instance, |
| 17 const PP_BrowserFont_Trusted_Description* description, | 20 const struct PP_BrowserFont_Trusted_Description* description, |
| 18 PP_PrivateFontCharset charset) { | 21 PP_PrivateFontCharset charset) { |
| 22 VLOG(4) << "PPB_Flash_FontFile::Create()"; |
| 19 EnterResourceCreation enter(instance); | 23 EnterResourceCreation enter(instance); |
| 20 if (enter.failed()) | 24 if (enter.failed()) |
| 21 return 0; | 25 return 0; |
| 22 return enter.functions()->CreateFlashFontFile(instance, description, charset); | 26 return enter.functions()->CreateFlashFontFile(instance, description, charset); |
| 23 } | 27 } |
| 24 | 28 |
| 25 PP_Bool IsFlashFontFile(PP_Resource resource) { | 29 PP_Bool IsFlashFontFile(PP_Resource resource) { |
| 30 VLOG(4) << "PPB_Flash_FontFile::IsFlashFontFile()"; |
| 26 EnterResource<PPB_Flash_FontFile_API> enter(resource, false); | 31 EnterResource<PPB_Flash_FontFile_API> enter(resource, false); |
| 27 return PP_FromBool(enter.succeeded()); | 32 return PP_FromBool(enter.succeeded()); |
| 28 } | 33 } |
| 29 | 34 |
| 30 PP_Bool GetFontTable(PP_Resource font_file, | 35 PP_Bool GetFontTable(PP_Resource font_file, |
| 31 uint32_t table, | 36 uint32_t table, |
| 32 void* output, | 37 void* output, |
| 33 uint32_t* output_length) { | 38 uint32_t* output_length) { |
| 39 VLOG(4) << "PPB_Flash_FontFile::GetFontTable()"; |
| 34 EnterResource<PPB_Flash_FontFile_API> enter(font_file, true); | 40 EnterResource<PPB_Flash_FontFile_API> enter(font_file, true); |
| 35 if (enter.failed()) | 41 if (enter.failed()) |
| 36 return PP_FALSE; | 42 return PP_FALSE; |
| 37 return enter.object()->GetFontTable(table, output, output_length); | 43 return enter.object()->GetFontTable(table, output, output_length); |
| 38 } | 44 } |
| 39 | 45 |
| 40 const PPB_Flash_FontFile g_ppb_flash_fontfile_thunk = { | 46 PP_Bool IsSupportedForWindows(void) { |
| 41 &Create, | 47 VLOG(4) << "PPB_Flash_FontFile::IsSupportedForWindows()"; |
| 42 &IsFlashFontFile, | 48 return PP_TRUE; |
| 43 &GetFontTable | 49 } |
| 44 }; | 50 |
| 51 const PPB_Flash_FontFile_0_1 g_ppb_flash_fontfile_thunk_0_1 = { |
| 52 &Create, &IsFlashFontFile, &GetFontTable}; |
| 53 |
| 54 const PPB_Flash_FontFile_0_2 g_ppb_flash_fontfile_thunk_0_2 = { |
| 55 &Create, &IsFlashFontFile, &GetFontTable, &IsSupportedForWindows}; |
| 45 | 56 |
| 46 } // namespace | 57 } // namespace |
| 47 | 58 |
| 48 const PPB_Flash_FontFile_0_1* GetPPB_Flash_FontFile_0_1_Thunk() { | 59 PPAPI_THUNK_EXPORT const PPB_Flash_FontFile_0_1* |
| 49 return &g_ppb_flash_fontfile_thunk; | 60 GetPPB_Flash_FontFile_0_1_Thunk() { |
| 61 return &g_ppb_flash_fontfile_thunk_0_1; |
| 62 } |
| 63 |
| 64 PPAPI_THUNK_EXPORT const PPB_Flash_FontFile_0_2* |
| 65 GetPPB_Flash_FontFile_0_2_Thunk() { |
| 66 return &g_ppb_flash_fontfile_thunk_0_2; |
| 50 } | 67 } |
| 51 | 68 |
| 52 } // namespace thunk | 69 } // namespace thunk |
| 53 } // namespace ppapi | 70 } // namespace ppapi |
| OLD | NEW |