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_instance_proxy.h" | 5 #include "ppapi/proxy/ppb_instance_proxy.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_fullscreen_dev.h" | 7 #include "ppapi/c/dev/ppb_fullscreen_dev.h" |
8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
9 #include "ppapi/c/ppb_instance.h" | 9 #include "ppapi/c/ppb_instance.h" |
10 #include "ppapi/proxy/host_dispatcher.h" | 10 #include "ppapi/proxy/host_dispatcher.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, | 104 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, |
105 OnMsgBindGraphics) | 105 OnMsgBindGraphics) |
106 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, | 106 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, |
107 OnMsgIsFullFrame) | 107 OnMsgIsFullFrame) |
108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, | 108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, |
109 OnMsgExecuteScript) | 109 OnMsgExecuteScript) |
110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, | 110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, |
111 OnMsgSetFullscreen) | 111 OnMsgSetFullscreen) |
112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, | 112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, |
113 OnMsgGetScreenSize) | 113 OnMsgGetScreenSize) |
| 114 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, |
| 115 OnMsgRequestInputEvents) |
| 116 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, |
| 117 OnMsgClearInputEvents) |
114 IPC_MESSAGE_UNHANDLED(handled = false) | 118 IPC_MESSAGE_UNHANDLED(handled = false) |
115 IPC_END_MESSAGE_MAP() | 119 IPC_END_MESSAGE_MAP() |
116 return handled; | 120 return handled; |
117 } | 121 } |
118 | 122 |
119 PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() { | 123 PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() { |
120 return this; | 124 return this; |
121 } | 125 } |
122 | 126 |
123 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance, | 127 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 190 } |
187 | 191 |
188 PP_Bool PPB_Instance_Proxy::GetScreenSize(PP_Instance instance, | 192 PP_Bool PPB_Instance_Proxy::GetScreenSize(PP_Instance instance, |
189 PP_Size* size) { | 193 PP_Size* size) { |
190 PP_Bool result = PP_FALSE; | 194 PP_Bool result = PP_FALSE; |
191 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize( | 195 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize( |
192 INTERFACE_ID_PPB_INSTANCE, instance, &result, size)); | 196 INTERFACE_ID_PPB_INSTANCE, instance, &result, size)); |
193 return result; | 197 return result; |
194 } | 198 } |
195 | 199 |
| 200 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance, |
| 201 uint32_t event_classes) { |
| 202 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents( |
| 203 INTERFACE_ID_PPB_INSTANCE, instance, false, event_classes)); |
| 204 |
| 205 // We always register for the classes we can handle, this function validates |
| 206 // the flags so we can notify it if anything was invalid, without requiring |
| 207 // a sync reply. |
| 208 return ValidateRequestInputEvents(false, event_classes); |
| 209 } |
| 210 |
| 211 int32_t PPB_Instance_Proxy::RequestFilteringInputEvents( |
| 212 PP_Instance instance, |
| 213 uint32_t event_classes) { |
| 214 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents( |
| 215 INTERFACE_ID_PPB_INSTANCE, instance, true, event_classes)); |
| 216 |
| 217 // We always register for the classes we can handle, this function validates |
| 218 // the flags so we can notify it if anything was invalid, without requiring |
| 219 // a sync reply. |
| 220 return ValidateRequestInputEvents(true, event_classes); |
| 221 } |
| 222 |
| 223 void PPB_Instance_Proxy::ClearInputEventRequest(PP_Instance instance, |
| 224 uint32_t event_classes) { |
| 225 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ClearInputEvents( |
| 226 INTERFACE_ID_PPB_INSTANCE, instance, event_classes)); |
| 227 } |
| 228 |
196 void PPB_Instance_Proxy::OnMsgGetWindowObject( | 229 void PPB_Instance_Proxy::OnMsgGetWindowObject( |
197 PP_Instance instance, | 230 PP_Instance instance, |
198 SerializedVarReturnValue result) { | 231 SerializedVarReturnValue result) { |
199 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 232 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
200 if (enter.succeeded()) | 233 if (enter.succeeded()) |
201 result.Return(dispatcher(), enter.functions()->GetWindowObject(instance)); | 234 result.Return(dispatcher(), enter.functions()->GetWindowObject(instance)); |
202 } | 235 } |
203 | 236 |
204 void PPB_Instance_Proxy::OnMsgGetOwnerElementObject( | 237 void PPB_Instance_Proxy::OnMsgGetOwnerElementObject( |
205 PP_Instance instance, | 238 PP_Instance instance, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 290 } |
258 | 291 |
259 void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance, | 292 void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance, |
260 PP_Bool* result, | 293 PP_Bool* result, |
261 PP_Size* size) { | 294 PP_Size* size) { |
262 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 295 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
263 if (enter.succeeded()) | 296 if (enter.succeeded()) |
264 *result = enter.functions()->GetScreenSize(instance, size); | 297 *result = enter.functions()->GetScreenSize(instance, size); |
265 } | 298 } |
266 | 299 |
| 300 void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance, |
| 301 bool is_filtering, |
| 302 uint32_t event_classes) { |
| 303 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
| 304 if (enter.succeeded()) { |
| 305 if (is_filtering) |
| 306 enter.functions()->RequestFilteringInputEvents(instance, event_classes); |
| 307 else |
| 308 enter.functions()->RequestInputEvents(instance, event_classes); |
| 309 } |
| 310 } |
| 311 |
| 312 void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance, |
| 313 uint32_t event_classes) { |
| 314 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
| 315 if (enter.succeeded()) |
| 316 enter.functions()->ClearInputEventRequest(instance, event_classes); |
| 317 } |
| 318 |
267 } // namespace proxy | 319 } // namespace proxy |
268 } // namespace pp | 320 } // namespace pp |
OLD | NEW |