| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy/ppb_cursor_control_proxy.h" | 5 #include "ppapi/proxy/ppb_cursor_control_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/pp_cursor_type_dev.h" | 7 #include "ppapi/c/dev/pp_cursor_type_dev.h" |
| 8 #include "ppapi/c/dev/ppb_cursor_control_dev.h" | 8 #include "ppapi/c/dev/ppb_cursor_control_dev.h" |
| 9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
| 10 #include "ppapi/proxy/plugin_resource.h" | 10 #include "ppapi/proxy/plugin_resource.h" |
| 11 #include "ppapi/proxy/plugin_resource_tracker.h" | 11 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 12 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
| 13 #include "ppapi/thunk/enter.h" | 13 #include "ppapi/thunk/enter.h" |
| 14 #include "ppapi/thunk/thunk.h" | 14 #include "ppapi/thunk/thunk.h" |
| 15 | 15 |
| 16 using ppapi::HostResource; |
| 16 using ppapi::thunk::EnterFunctionNoLock; | 17 using ppapi::thunk::EnterFunctionNoLock; |
| 17 using ppapi::thunk::PPB_CursorControl_FunctionAPI; | 18 using ppapi::thunk::PPB_CursorControl_FunctionAPI; |
| 18 | 19 |
| 19 namespace pp { | 20 namespace pp { |
| 20 namespace proxy { | 21 namespace proxy { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 InterfaceProxy* CreateCursorControlProxy(Dispatcher* dispatcher, | 25 InterfaceProxy* CreateCursorControlProxy(Dispatcher* dispatcher, |
| 25 const void* target_interface) { | 26 const void* target_interface) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_CanLockCursor, | 122 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_CanLockCursor, |
| 122 OnMsgCanLockCursor) | 123 OnMsgCanLockCursor) |
| 123 IPC_MESSAGE_UNHANDLED(handled = false) | 124 IPC_MESSAGE_UNHANDLED(handled = false) |
| 124 IPC_END_MESSAGE_MAP() | 125 IPC_END_MESSAGE_MAP() |
| 125 // TODO(brettw): handle bad messages! | 126 // TODO(brettw): handle bad messages! |
| 126 return handled; | 127 return handled; |
| 127 } | 128 } |
| 128 | 129 |
| 129 void PPB_CursorControl_Proxy::OnMsgSetCursor(PP_Instance instance, | 130 void PPB_CursorControl_Proxy::OnMsgSetCursor(PP_Instance instance, |
| 130 int32_t type, | 131 int32_t type, |
| 131 HostResource custom_image, | 132 const HostResource& custom_image, |
| 132 const PP_Point& hot_spot, | 133 const PP_Point& hot_spot, |
| 133 PP_Bool* result) { | 134 PP_Bool* result) { |
| 134 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); | 135 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); |
| 135 if (enter.succeeded()) { | 136 if (enter.succeeded()) { |
| 136 *result = enter.functions()->SetCursor( | 137 *result = enter.functions()->SetCursor( |
| 137 instance, static_cast<PP_CursorType_Dev>(type), | 138 instance, static_cast<PP_CursorType_Dev>(type), |
| 138 custom_image.host_resource(), &hot_spot); | 139 custom_image.host_resource(), &hot_spot); |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 162 | 163 |
| 163 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance, | 164 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance, |
| 164 PP_Bool* result) { | 165 PP_Bool* result) { |
| 165 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); | 166 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); |
| 166 if (enter.succeeded()) | 167 if (enter.succeeded()) |
| 167 *result = enter.functions()->CanLockCursor(instance); | 168 *result = enter.functions()->CanLockCursor(instance); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace proxy | 171 } // namespace proxy |
| 171 } // namespace pp | 172 } // namespace pp |
| OLD | NEW |