| 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/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
| 6 #include "ppapi/c/ppb_mouse_lock.h" | 6 #include "ppapi/c/ppb_mouse_lock.h" |
| 7 #include "ppapi/shared_impl/tracked_callback.h" |
| 7 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
| 8 #include "ppapi/thunk/ppb_instance_api.h" | 9 #include "ppapi/thunk/ppb_instance_api.h" |
| 9 #include "ppapi/thunk/thunk.h" | 10 #include "ppapi/thunk/thunk.h" |
| 10 | 11 |
| 11 namespace ppapi { | 12 namespace ppapi { |
| 12 namespace thunk { | 13 namespace thunk { |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 int32_t LockMouse(PP_Instance instance, PP_CompletionCallback callback) { | 17 int32_t LockMouse(PP_Instance instance, PP_CompletionCallback callback) { |
| 17 EnterInstance enter(instance, callback); | 18 EnterInstance enter(instance, callback); |
| 18 if (enter.failed()) | 19 if (enter.failed()) |
| 19 return enter.retval(); | 20 return enter.retval(); |
| 20 return enter.SetResult(enter.functions()->LockMouse(instance, callback)); | 21 return enter.SetResult(enter.functions()->LockMouse(instance, |
| 22 enter.callback())); |
| 21 } | 23 } |
| 22 | 24 |
| 23 void UnlockMouse(PP_Instance instance) { | 25 void UnlockMouse(PP_Instance instance) { |
| 24 EnterInstance enter(instance); | 26 EnterInstance enter(instance); |
| 25 if (enter.failed()) | 27 if (enter.failed()) |
| 26 return; | 28 return; |
| 27 enter.functions()->UnlockMouse(instance); | 29 enter.functions()->UnlockMouse(instance); |
| 28 } | 30 } |
| 29 | 31 |
| 30 const PPB_MouseLock g_ppb_mouse_lock_thunk = { | 32 const PPB_MouseLock g_ppb_mouse_lock_thunk = { |
| 31 &LockMouse, | 33 &LockMouse, |
| 32 &UnlockMouse | 34 &UnlockMouse |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 } // namespace | 37 } // namespace |
| 36 | 38 |
| 37 const PPB_MouseLock_1_0* GetPPB_MouseLock_1_0_Thunk() { | 39 const PPB_MouseLock_1_0* GetPPB_MouseLock_1_0_Thunk() { |
| 38 return &g_ppb_mouse_lock_thunk; | 40 return &g_ppb_mouse_lock_thunk; |
| 39 } | 41 } |
| 40 | 42 |
| 41 } // namespace thunk | 43 } // namespace thunk |
| 42 } // namespace ppapi | 44 } // namespace ppapi |
| OLD | NEW |