| 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 #include "ppapi/c/private/ppb_flash_menu.h" | 5 #include "ppapi/c/private/ppb_flash_menu.h" |
| 6 #include "ppapi/c/pp_completion_callback.h" | 6 #include "ppapi/c/pp_completion_callback.h" |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/thunk/common.h" | |
| 9 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
| 10 #include "ppapi/thunk/thunk.h" | 9 #include "ppapi/thunk/thunk.h" |
| 11 #include "ppapi/thunk/ppb_flash_menu_api.h" | 10 #include "ppapi/thunk/ppb_flash_menu_api.h" |
| 12 #include "ppapi/thunk/resource_creation_api.h" | 11 #include "ppapi/thunk/resource_creation_api.h" |
| 13 | 12 |
| 14 namespace ppapi { | 13 namespace ppapi { |
| 15 namespace thunk { | 14 namespace thunk { |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 PP_Resource Create(PP_Instance instance, const PP_Flash_Menu* menu_data) { | 18 PP_Resource Create(PP_Instance instance, const PP_Flash_Menu* menu_data) { |
| 20 EnterFunction<ResourceCreationAPI> enter(instance, true); | 19 EnterResourceCreation enter(instance); |
| 21 if (enter.failed()) | 20 if (enter.failed()) |
| 22 return 0; | 21 return 0; |
| 23 return enter.functions()->CreateFlashMenu(instance, menu_data); | 22 return enter.functions()->CreateFlashMenu(instance, menu_data); |
| 24 } | 23 } |
| 25 | 24 |
| 26 PP_Bool IsFlashMenu(PP_Resource resource) { | 25 PP_Bool IsFlashMenu(PP_Resource resource) { |
| 27 EnterResource<PPB_Flash_Menu_API> enter(resource, false); | 26 EnterResource<PPB_Flash_Menu_API> enter(resource, false); |
| 28 return PP_FromBool(enter.succeeded()); | 27 return PP_FromBool(enter.succeeded()); |
| 29 } | 28 } |
| 30 | 29 |
| 31 int32_t Show(PP_Resource resource, | 30 int32_t Show(PP_Resource resource, |
| 32 const PP_Point* location, | 31 const PP_Point* location, |
| 33 int32_t* selected_id, | 32 int32_t* selected_id, |
| 34 PP_CompletionCallback callback) { | 33 PP_CompletionCallback callback) { |
| 35 EnterResource<PPB_Flash_Menu_API> enter(resource, true); | 34 EnterResource<PPB_Flash_Menu_API> enter(resource, callback, true); |
| 36 if (enter.failed()) | 35 if (enter.failed()) |
| 37 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 36 return enter.retval(); |
| 38 int32_t result = enter.object()->Show(location, selected_id, callback); | 37 return enter.SetResult(enter.object()->Show(location, selected_id, callback)); |
| 39 return MayForceCallback(callback, result); | |
| 40 } | 38 } |
| 41 | 39 |
| 42 const PPB_Flash_Menu g_ppb_flash_menu_thunk = { | 40 const PPB_Flash_Menu g_ppb_flash_menu_thunk = { |
| 43 &Create, | 41 &Create, |
| 44 &IsFlashMenu, | 42 &IsFlashMenu, |
| 45 &Show | 43 &Show |
| 46 }; | 44 }; |
| 47 | 45 |
| 48 } // namespace | 46 } // namespace |
| 49 | 47 |
| 50 const PPB_Flash_Menu_0_2* GetPPB_Flash_Menu_0_2_Thunk() { | 48 const PPB_Flash_Menu_0_2* GetPPB_Flash_Menu_0_2_Thunk() { |
| 51 return &g_ppb_flash_menu_thunk; | 49 return &g_ppb_flash_menu_thunk; |
| 52 } | 50 } |
| 53 | 51 |
| 54 } // namespace thunk | 52 } // namespace thunk |
| 55 } // namespace ppapi | 53 } // namespace ppapi |
| OLD | NEW |