| 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_tracker.h" | 10 #include "ppapi/proxy/plugin_resource_tracker.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return PP_FALSE; | 44 return PP_FALSE; |
| 45 cursor_image_resource = cursor_image->host_resource(); | 45 cursor_image_resource = cursor_image->host_resource(); |
| 46 } else { | 46 } else { |
| 47 if (custom_image_id) | 47 if (custom_image_id) |
| 48 return PP_FALSE; // Image specified for a predefined type. | 48 return PP_FALSE; // Image specified for a predefined type. |
| 49 } | 49 } |
| 50 | 50 |
| 51 PP_Bool result = PP_FALSE; | 51 PP_Bool result = PP_FALSE; |
| 52 PP_Point empty_point = { 0, 0 }; | 52 PP_Point empty_point = { 0, 0 }; |
| 53 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_SetCursor( | 53 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_SetCursor( |
| 54 INTERFACE_ID_PPB_CURSORCONTROL, | 54 API_ID_PPB_CURSORCONTROL, |
| 55 instance, static_cast<int32_t>(type), cursor_image_resource, | 55 instance, static_cast<int32_t>(type), cursor_image_resource, |
| 56 hot_spot ? *hot_spot : empty_point, &result)); | 56 hot_spot ? *hot_spot : empty_point, &result)); |
| 57 return result; | 57 return result; |
| 58 } | 58 } |
| 59 | 59 |
| 60 PP_Bool PPB_CursorControl_Proxy::LockCursor(PP_Instance instance) { | 60 PP_Bool PPB_CursorControl_Proxy::LockCursor(PP_Instance instance) { |
| 61 PP_Bool result = PP_FALSE; | 61 PP_Bool result = PP_FALSE; |
| 62 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_LockCursor( | 62 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_LockCursor( |
| 63 INTERFACE_ID_PPB_CURSORCONTROL, instance, &result)); | 63 API_ID_PPB_CURSORCONTROL, instance, &result)); |
| 64 return result; | 64 return result; |
| 65 } | 65 } |
| 66 | 66 |
| 67 PP_Bool PPB_CursorControl_Proxy::UnlockCursor(PP_Instance instance) { | 67 PP_Bool PPB_CursorControl_Proxy::UnlockCursor(PP_Instance instance) { |
| 68 PP_Bool result = PP_FALSE; | 68 PP_Bool result = PP_FALSE; |
| 69 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_UnlockCursor( | 69 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_UnlockCursor( |
| 70 INTERFACE_ID_PPB_CURSORCONTROL, instance, &result)); | 70 API_ID_PPB_CURSORCONTROL, instance, &result)); |
| 71 return result; | 71 return result; |
| 72 } | 72 } |
| 73 | 73 |
| 74 PP_Bool PPB_CursorControl_Proxy::HasCursorLock(PP_Instance instance) { | 74 PP_Bool PPB_CursorControl_Proxy::HasCursorLock(PP_Instance instance) { |
| 75 PP_Bool result = PP_FALSE; | 75 PP_Bool result = PP_FALSE; |
| 76 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_HasCursorLock( | 76 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_HasCursorLock( |
| 77 INTERFACE_ID_PPB_CURSORCONTROL, instance, &result)); | 77 API_ID_PPB_CURSORCONTROL, instance, &result)); |
| 78 return result; | 78 return result; |
| 79 } | 79 } |
| 80 | 80 |
| 81 PP_Bool PPB_CursorControl_Proxy::CanLockCursor(PP_Instance instance) { | 81 PP_Bool PPB_CursorControl_Proxy::CanLockCursor(PP_Instance instance) { |
| 82 PP_Bool result = PP_FALSE; | 82 PP_Bool result = PP_FALSE; |
| 83 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_CanLockCursor( | 83 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_CanLockCursor( |
| 84 INTERFACE_ID_PPB_CURSORCONTROL, instance, &result)); | 84 API_ID_PPB_CURSORCONTROL, instance, &result)); |
| 85 return result; | 85 return result; |
| 86 } | 86 } |
| 87 | 87 |
| 88 bool PPB_CursorControl_Proxy::OnMessageReceived(const IPC::Message& msg) { | 88 bool PPB_CursorControl_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 89 bool handled = true; | 89 bool handled = true; |
| 90 IPC_BEGIN_MESSAGE_MAP(PPB_CursorControl_Proxy, msg) | 90 IPC_BEGIN_MESSAGE_MAP(PPB_CursorControl_Proxy, msg) |
| 91 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_SetCursor, | 91 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_SetCursor, |
| 92 OnMsgSetCursor) | 92 OnMsgSetCursor) |
| 93 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_LockCursor, | 93 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_LockCursor, |
| 94 OnMsgLockCursor) | 94 OnMsgLockCursor) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance, | 141 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance, |
| 142 PP_Bool* result) { | 142 PP_Bool* result) { |
| 143 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); | 143 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); |
| 144 if (enter.succeeded()) | 144 if (enter.succeeded()) |
| 145 *result = enter.functions()->CanLockCursor(instance); | 145 *result = enter.functions()->CanLockCursor(instance); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace proxy | 148 } // namespace proxy |
| 149 } // namespace ppapi | 149 } // namespace ppapi |
| OLD | NEW |