| 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/dev/ppb_cursor_control_dev.h" |
| 5 #include "ppapi/thunk/thunk.h" | 6 #include "ppapi/thunk/thunk.h" |
| 6 #include "ppapi/thunk/enter.h" | 7 #include "ppapi/thunk/enter.h" |
| 7 #include "ppapi/thunk/ppb_cursor_control_api.h" | 8 #include "ppapi/thunk/ppb_instance_api.h" |
| 9 |
| 10 // This interface is only for temporary backwards compat and currently just |
| 11 // forwards to the stable interfaces that implement these features. |
| 8 | 12 |
| 9 namespace ppapi { | 13 namespace ppapi { |
| 10 namespace thunk { | 14 namespace thunk { |
| 11 | 15 |
| 12 namespace { | 16 namespace { |
| 13 | 17 |
| 14 PP_Bool SetCursor(PP_Instance instance, | 18 PP_Bool SetCursor(PP_Instance instance, |
| 15 PP_CursorType_Dev type, | 19 PP_CursorType_Dev type, |
| 16 PP_Resource custom_image, | 20 PP_Resource custom_image, |
| 17 const PP_Point* hot_spot) { | 21 const PP_Point* hot_spot) { |
| 18 EnterFunction<PPB_CursorControl_FunctionAPI> enter(instance, true); | 22 EnterInstance enter(instance); |
| 19 if (enter.failed()) | 23 if (enter.failed()) |
| 20 return PP_FALSE; | 24 return PP_FALSE; |
| 21 return enter.functions()->SetCursor(instance, type, custom_image, hot_spot); | 25 return enter.functions()->SetCursor(instance, |
| 26 static_cast<PP_MouseCursor_Type>(type), custom_image, hot_spot); |
| 22 } | 27 } |
| 23 | 28 |
| 24 PP_Bool LockCursor(PP_Instance instance) { | 29 PP_Bool LockCursor(PP_Instance instance) { |
| 25 EnterFunction<PPB_CursorControl_FunctionAPI> enter(instance, true); | 30 return PP_FALSE; |
| 26 if (enter.failed()) | |
| 27 return PP_FALSE; | |
| 28 return enter.functions()->LockCursor(instance); | |
| 29 } | 31 } |
| 30 | 32 |
| 31 PP_Bool UnlockCursor(PP_Instance instance) { | 33 PP_Bool UnlockCursor(PP_Instance instance) { |
| 32 EnterFunction<PPB_CursorControl_FunctionAPI> enter(instance, true); | 34 return PP_FALSE; |
| 33 if (enter.failed()) | |
| 34 return PP_FALSE; | |
| 35 return enter.functions()->UnlockCursor(instance); | |
| 36 } | 35 } |
| 37 | 36 |
| 38 PP_Bool HasCursorLock(PP_Instance instance) { | 37 PP_Bool HasCursorLock(PP_Instance instance) { |
| 39 EnterFunction<PPB_CursorControl_FunctionAPI> enter(instance, true); | 38 return PP_FALSE; |
| 40 if (enter.failed()) | |
| 41 return PP_FALSE; | |
| 42 return enter.functions()->HasCursorLock(instance); | |
| 43 } | 39 } |
| 44 | 40 |
| 45 PP_Bool CanLockCursor(PP_Instance instance) { | 41 PP_Bool CanLockCursor(PP_Instance instance) { |
| 46 EnterFunction<PPB_CursorControl_FunctionAPI> enter(instance, true); | 42 return PP_FALSE; |
| 47 if (enter.failed()) | |
| 48 return PP_FALSE; | |
| 49 return enter.functions()->CanLockCursor(instance); | |
| 50 } | 43 } |
| 51 | 44 |
| 52 const PPB_CursorControl_Dev g_ppb_cursor_control_thunk = { | 45 const PPB_CursorControl_Dev g_ppb_cursor_control_thunk = { |
| 53 &SetCursor, | 46 &SetCursor, |
| 54 &LockCursor, | 47 &LockCursor, |
| 55 &UnlockCursor, | 48 &UnlockCursor, |
| 56 &HasCursorLock, | 49 &HasCursorLock, |
| 57 &CanLockCursor | 50 &CanLockCursor |
| 58 }; | 51 }; |
| 59 | 52 |
| 60 } // namespace | 53 } // namespace |
| 61 | 54 |
| 62 const PPB_CursorControl_Dev_0_4* GetPPB_CursorControl_Dev_0_4_Thunk() { | 55 const PPB_CursorControl_Dev_0_4* GetPPB_CursorControl_Dev_0_4_Thunk() { |
| 63 return &g_ppb_cursor_control_thunk; | 56 return &g_ppb_cursor_control_thunk; |
| 64 } | 57 } |
| 65 | 58 |
| 66 } // namespace thunk | 59 } // namespace thunk |
| 67 } // namespace ppapi | 60 } // namespace ppapi |
| OLD | NEW |