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" | |
11 #include "ppapi/proxy/plugin_resource_tracker.h" | 10 #include "ppapi/proxy/plugin_resource_tracker.h" |
12 #include "ppapi/proxy/ppapi_messages.h" | 11 #include "ppapi/proxy/ppapi_messages.h" |
13 #include "ppapi/thunk/enter.h" | 12 #include "ppapi/thunk/enter.h" |
14 #include "ppapi/thunk/thunk.h" | 13 #include "ppapi/thunk/thunk.h" |
15 | 14 |
16 using ppapi::HostResource; | 15 using ppapi::HostResource; |
| 16 using ppapi::Resource; |
17 using ppapi::thunk::EnterFunctionNoLock; | 17 using ppapi::thunk::EnterFunctionNoLock; |
18 using ppapi::thunk::PPB_CursorControl_FunctionAPI; | 18 using ppapi::thunk::PPB_CursorControl_FunctionAPI; |
19 | 19 |
20 namespace pp { | 20 namespace pp { |
21 namespace proxy { | 21 namespace proxy { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 InterfaceProxy* CreateCursorControlProxy(Dispatcher* dispatcher, | 25 InterfaceProxy* CreateCursorControlProxy(Dispatcher* dispatcher, |
26 const void* target_interface) { | 26 const void* target_interface) { |
(...skipping 27 matching lines...) Expand all Loading... |
54 return this; | 54 return this; |
55 } | 55 } |
56 | 56 |
57 PP_Bool PPB_CursorControl_Proxy::SetCursor(PP_Instance instance, | 57 PP_Bool PPB_CursorControl_Proxy::SetCursor(PP_Instance instance, |
58 PP_CursorType_Dev type, | 58 PP_CursorType_Dev type, |
59 PP_Resource custom_image_id, | 59 PP_Resource custom_image_id, |
60 const PP_Point* hot_spot) { | 60 const PP_Point* hot_spot) { |
61 // It's legal for the image ID to be null if the type is not custom. | 61 // It's legal for the image ID to be null if the type is not custom. |
62 HostResource cursor_image_resource; | 62 HostResource cursor_image_resource; |
63 if (type == PP_CURSORTYPE_CUSTOM) { | 63 if (type == PP_CURSORTYPE_CUSTOM) { |
64 PluginResource* cursor_image = PluginResourceTracker::GetInstance()-> | 64 Resource* cursor_image = PluginResourceTracker::GetInstance()-> |
65 GetResourceObject(custom_image_id); | 65 GetResource(custom_image_id); |
66 if (!cursor_image || cursor_image->instance() != instance) | 66 if (!cursor_image || cursor_image->pp_instance() != instance) |
67 return PP_FALSE; | 67 return PP_FALSE; |
68 cursor_image_resource = cursor_image->host_resource(); | 68 cursor_image_resource = cursor_image->host_resource(); |
69 } else { | 69 } else { |
70 if (custom_image_id) | 70 if (custom_image_id) |
71 return PP_FALSE; // Image specified for a predefined type. | 71 return PP_FALSE; // Image specified for a predefined type. |
72 } | 72 } |
73 | 73 |
74 PP_Bool result = PP_FALSE; | 74 PP_Bool result = PP_FALSE; |
75 PP_Point empty_point = { 0, 0 }; | 75 PP_Point empty_point = { 0, 0 }; |
76 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_SetCursor( | 76 dispatcher()->Send(new PpapiHostMsg_PPBCursorControl_SetCursor( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance, | 164 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance, |
165 PP_Bool* result) { | 165 PP_Bool* result) { |
166 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); | 166 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); |
167 if (enter.succeeded()) | 167 if (enter.succeeded()) |
168 *result = enter.functions()->CanLockCursor(instance); | 168 *result = enter.functions()->CanLockCursor(instance); |
169 } | 169 } |
170 | 170 |
171 } // namespace proxy | 171 } // namespace proxy |
172 } // namespace pp | 172 } // namespace pp |
OLD | NEW |