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/shared_impl/ppb_view_shared.h" | 6 #include "ppapi/shared_impl/ppb_view_shared.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_instance_api.h" | 9 #include "ppapi/thunk/ppb_instance_api.h" |
10 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
11 | 11 |
12 namespace ppapi { | 12 namespace ppapi { |
13 namespace thunk { | 13 namespace thunk { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 PP_Bool IsFullscreen(PP_Instance instance) { | 17 PP_Bool IsFullscreen(PP_Instance instance) { |
18 EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); | 18 EnterInstance enter(instance); |
19 if (enter.failed()) | 19 if (enter.failed()) |
20 return PP_FALSE; | 20 return PP_FALSE; |
21 const ViewData* view = enter.functions()->GetViewData(instance); | 21 const ViewData* view = enter.functions()->GetViewData(instance); |
22 if (!view) | 22 if (!view) |
23 return PP_FALSE; | 23 return PP_FALSE; |
24 return PP_FromBool(view->is_fullscreen); | 24 return PP_FromBool(view->is_fullscreen); |
25 } | 25 } |
26 | 26 |
27 PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { | 27 PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { |
28 EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); | 28 EnterInstance enter(instance); |
29 if (enter.failed()) | 29 if (enter.failed()) |
30 return PP_FALSE; | 30 return PP_FALSE; |
31 return enter.functions()->SetFullscreen(instance, fullscreen); | 31 return enter.functions()->SetFullscreen(instance, fullscreen); |
32 } | 32 } |
33 | 33 |
34 PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) { | 34 PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) { |
35 EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); | 35 EnterInstance enter(instance); |
36 if (enter.failed()) | 36 if (enter.failed()) |
37 return PP_FALSE; | 37 return PP_FALSE; |
38 return enter.functions()->GetScreenSize(instance, size); | 38 return enter.functions()->GetScreenSize(instance, size); |
39 } | 39 } |
40 | 40 |
41 const PPB_Fullscreen g_ppb_fullscreen_thunk = { | 41 const PPB_Fullscreen g_ppb_fullscreen_thunk = { |
42 &IsFullscreen, | 42 &IsFullscreen, |
43 &SetFullscreen, | 43 &SetFullscreen, |
44 &GetScreenSize | 44 &GetScreenSize |
45 }; | 45 }; |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 const PPB_Fullscreen_1_0* GetPPB_Fullscreen_1_0_Thunk() { | 49 const PPB_Fullscreen_1_0* GetPPB_Fullscreen_1_0_Thunk() { |
50 return &g_ppb_fullscreen_thunk; | 50 return &g_ppb_fullscreen_thunk; |
51 } | 51 } |
52 | 52 |
53 } // namespace thunk | 53 } // namespace thunk |
54 } // namespace ppapi | 54 } // namespace ppapi |
OLD | NEW |