Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: ppapi/proxy/ppb_cursor_control_proxy.cc

Issue 6282007: First pass at making the proxy handle multiple renderers. This associates the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_core_proxy.cc ('k') | ppapi/proxy/ppb_flash_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ppb_cursor_control_dev.h" 7 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
8 #include "ppapi/proxy/plugin_dispatcher.h" 8 #include "ppapi/proxy/plugin_dispatcher.h"
9 #include "ppapi/proxy/ppapi_messages.h" 9 #include "ppapi/proxy/ppapi_messages.h"
10 10
11 namespace pp { 11 namespace pp {
12 namespace proxy { 12 namespace proxy {
13 13
14 namespace { 14 namespace {
15 15
16 PP_Bool SetCursor(PP_Instance instance_id, 16 PP_Bool SetCursor(PP_Instance instance_id,
17 PP_CursorType_Dev type, 17 PP_CursorType_Dev type,
18 PP_Resource custom_image_id, 18 PP_Resource custom_image_id,
19 const PP_Point* hot_spot) { 19 const PP_Point* hot_spot) {
20 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
21 if (!dispatcher)
22 return PP_FALSE;
23
20 PP_Bool result = PP_FALSE; 24 PP_Bool result = PP_FALSE;
21 PP_Point empty_point = { 0, 0 }; 25 PP_Point empty_point = { 0, 0 };
22 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_SetCursor( 26 dispatcher->Send(new PpapiHostMsg_PPBCursorControl_SetCursor(
23 INTERFACE_ID_PPB_CURSORCONTROL, 27 INTERFACE_ID_PPB_CURSORCONTROL,
24 instance_id, static_cast<int32_t>(type), custom_image_id, 28 instance_id, static_cast<int32_t>(type), custom_image_id,
25 hot_spot ? *hot_spot : empty_point, &result)); 29 hot_spot ? *hot_spot : empty_point, &result));
26 return result; 30 return result;
27 } 31 }
28 32
29 PP_Bool LockCursor(PP_Instance instance_id) { 33 PP_Bool LockCursor(PP_Instance instance_id) {
34 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
35 if (!dispatcher)
36 return PP_FALSE;
37
30 PP_Bool result = PP_FALSE; 38 PP_Bool result = PP_FALSE;
31 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_LockCursor( 39 dispatcher->Send(new PpapiHostMsg_PPBCursorControl_LockCursor(
32 INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result)); 40 INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result));
33 return result; 41 return result;
34 } 42 }
35 43
36 PP_Bool UnlockCursor(PP_Instance instance_id) { 44 PP_Bool UnlockCursor(PP_Instance instance_id) {
45 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
46 if (!dispatcher)
47 return PP_FALSE;
48
37 PP_Bool result = PP_FALSE; 49 PP_Bool result = PP_FALSE;
38 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_UnlockCursor( 50 dispatcher->Send(new PpapiHostMsg_PPBCursorControl_UnlockCursor(
39 INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result)); 51 INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result));
40 return result; 52 return result;
41 } 53 }
42 54
43 PP_Bool HasCursorLock(PP_Instance instance_id) { 55 PP_Bool HasCursorLock(PP_Instance instance_id) {
56 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
57 if (!dispatcher)
58 return PP_FALSE;
59
44 PP_Bool result = PP_FALSE; 60 PP_Bool result = PP_FALSE;
45 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_HasCursorLock( 61 dispatcher->Send(new PpapiHostMsg_PPBCursorControl_HasCursorLock(
46 INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result)); 62 INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result));
47 return result; 63 return result;
48 } 64 }
49 65
50 PP_Bool CanLockCursor(PP_Instance instance_id) { 66 PP_Bool CanLockCursor(PP_Instance instance_id) {
67 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
68 if (!dispatcher)
69 return PP_FALSE;
70
51 PP_Bool result = PP_FALSE; 71 PP_Bool result = PP_FALSE;
52 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_CanLockCursor( 72 dispatcher->Send(new PpapiHostMsg_PPBCursorControl_CanLockCursor(
53 INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result)); 73 INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result));
54 return result; 74 return result;
55 } 75 }
56 76
57 const PPB_CursorControl_Dev cursor_control_interface = { 77 const PPB_CursorControl_Dev cursor_control_interface = {
58 &SetCursor, 78 &SetCursor,
59 &LockCursor, 79 &LockCursor,
60 &UnlockCursor, 80 &UnlockCursor,
61 &HasCursorLock, 81 &HasCursorLock,
62 &CanLockCursor 82 &CanLockCursor
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 *result = ppb_cursor_control_target()->HasCursorLock(instance); 143 *result = ppb_cursor_control_target()->HasCursorLock(instance);
124 } 144 }
125 145
126 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance, 146 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance,
127 PP_Bool* result) { 147 PP_Bool* result) {
128 *result = ppb_cursor_control_target()->CanLockCursor(instance); 148 *result = ppb_cursor_control_target()->CanLockCursor(instance);
129 } 149 }
130 150
131 } // namespace proxy 151 } // namespace proxy
132 } // namespace pp 152 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_core_proxy.cc ('k') | ppapi/proxy/ppb_flash_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698