| 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/ppb_fullscreen.h" | 5 #include "ppapi/c/ppb_fullscreen.h" |
| 6 #include "ppapi/c/private/ppb_flash_fullscreen.h" | 6 #include "ppapi/c/private/ppb_flash_fullscreen.h" |
| 7 #include "ppapi/thunk/thunk.h" | 7 #include "ppapi/thunk/thunk.h" |
| 8 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_flash_fullscreen_api.h" |
| 9 #include "ppapi/thunk/ppb_instance_api.h" | 10 #include "ppapi/thunk/ppb_instance_api.h" |
| 10 #include "ppapi/thunk/ppb_flash_api.h" | |
| 11 #include "ppapi/thunk/resource_creation_api.h" | 11 #include "ppapi/thunk/resource_creation_api.h" |
| 12 | 12 |
| 13 namespace ppapi { | 13 namespace ppapi { |
| 14 namespace thunk { | 14 namespace thunk { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 PP_Bool IsFullscreen(PP_Instance instance) { | 18 PP_Bool IsFullscreen(PP_Instance instance) { |
| 19 EnterInstance enter(instance); | 19 EnterInstanceAPI<PPB_Flash_Fullscreen_API> enter(instance); |
| 20 if (enter.failed()) | 20 if (enter.failed()) |
| 21 return PP_FALSE; | 21 return PP_FALSE; |
| 22 return enter.functions()->GetFlashAPI()->FlashIsFullscreen(instance); | 22 return enter.functions()->IsFullscreen(instance); |
| 23 } | 23 } |
| 24 | 24 |
| 25 PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { | 25 PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { |
| 26 EnterInstance enter(instance); | 26 EnterInstanceAPI<PPB_Flash_Fullscreen_API> enter(instance); |
| 27 if (enter.failed()) | 27 if (enter.failed()) |
| 28 return PP_FALSE; | 28 return PP_FALSE; |
| 29 return enter.functions()->GetFlashAPI()->FlashSetFullscreen(instance, | 29 return enter.functions()->SetFullscreen(instance, fullscreen); |
| 30 fullscreen); | |
| 31 } | 30 } |
| 32 | 31 |
| 32 // TODO(raymes): The codepaths for GetScreenSize in PPB_Fullscreen and |
| 33 // PPB_Flash_Fullscreen are the same. Consider deprecating the flash version. |
| 33 PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) { | 34 PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) { |
| 34 EnterInstance enter(instance); | 35 EnterInstance enter(instance); |
| 35 if (enter.failed()) | 36 if (enter.failed()) |
| 36 return PP_FALSE; | 37 return PP_FALSE; |
| 37 return enter.functions()->GetFlashAPI()->FlashGetScreenSize(instance, size); | 38 return enter.functions()->GetScreenSize(instance, size); |
| 38 } | 39 } |
| 39 | 40 |
| 40 const PPB_FlashFullscreen_0_1 g_ppb_flash_fullscreen_thunk = { | 41 const PPB_FlashFullscreen_0_1 g_ppb_flash_fullscreen_thunk = { |
| 41 &IsFullscreen, | 42 &IsFullscreen, |
| 42 &SetFullscreen, | 43 &SetFullscreen, |
| 43 &GetScreenSize | 44 &GetScreenSize |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 } // namespace | 47 } // namespace |
| 47 | 48 |
| 48 const PPB_FlashFullscreen_0_1* GetPPB_FlashFullscreen_0_1_Thunk() { | 49 const PPB_FlashFullscreen_0_1* GetPPB_FlashFullscreen_0_1_Thunk() { |
| 49 return &g_ppb_flash_fullscreen_thunk; | 50 return &g_ppb_flash_fullscreen_thunk; |
| 50 } | 51 } |
| 51 | 52 |
| 52 } // namespace thunk | 53 } // namespace thunk |
| 53 } // namespace ppapi | 54 } // namespace ppapi |
| OLD | NEW |