OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // SRPC-abstraction wrappers around PPB_InputEvent functions. |
| 6 |
| 7 #include "native_client/src/include/portability.h" |
| 8 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" |
| 9 #include "native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h" |
| 10 #include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h" |
| 11 #include "native_client/src/shared/ppapi_proxy/utility.h" |
| 12 #include "native_client/src/third_party/ppapi/c/pp_errors.h" |
| 13 #include "native_client/src/third_party/ppapi/c/ppb_input_event.h" |
| 14 |
| 15 |
| 16 using ppapi_proxy::DebugPrintf; |
| 17 |
| 18 void PpbInputEventRpcServer::PPB_InputEvent_RequestInputEvents( |
| 19 NaClSrpcRpc* rpc, |
| 20 NaClSrpcClosure* done, |
| 21 PP_Instance instance, |
| 22 int32_t event_classes, |
| 23 int32_t filtering, |
| 24 int32_t* success) { |
| 25 NaClSrpcClosureRunner runner(done); |
| 26 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
| 27 *success = PP_ERROR_FAILED; |
| 28 DebugPrintf("PPB_InputEvent::RequestInputEvents: instance=%"NACL_PRIu32", " |
| 29 "event_classes=%"NACL_PRIu32", filtering=%"NACL_PRId32"\n", |
| 30 instance, static_cast<uint32_t>(event_classes), filtering); |
| 31 const PPB_InputEvent* input_event_if = ppapi_proxy::PPBInputEventInterface(); |
| 32 if (!input_event_if) { |
| 33 *success = PP_ERROR_NOTSUPPORTED; |
| 34 DebugPrintf("PPB_InputEvent::RequestInputEvents: success=%"NACL_PRId32"\n", |
| 35 *success); |
| 36 return; |
| 37 } |
| 38 if (filtering) { |
| 39 *success = input_event_if->RequestFilteringInputEvents( |
| 40 instance, |
| 41 static_cast<uint32_t>(event_classes)); |
| 42 } else { |
| 43 *success = input_event_if->RequestInputEvents( |
| 44 instance, |
| 45 static_cast<uint32_t>(event_classes)); |
| 46 } |
| 47 DebugPrintf("PPB_InputEvent::RequestInputEvents: success=%"NACL_PRId32"\n", |
| 48 *success); |
| 49 rpc->result = NACL_SRPC_RESULT_OK; |
| 50 } |
| 51 |
| 52 void PpbInputEventRpcServer::PPB_InputEvent_ClearInputEventRequest( |
| 53 NaClSrpcRpc* rpc, |
| 54 NaClSrpcClosure* done, |
| 55 PP_Instance instance, |
| 56 int32_t event_classes) { |
| 57 NaClSrpcClosureRunner runner(done); |
| 58 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
| 59 DebugPrintf("PPB_InputEvent::ClearInputEventRequest: instance=%"NACL_PRIu32 |
| 60 ", event_classes=%"NACL_PRIu32"\n", |
| 61 instance, static_cast<uint32_t>(event_classes)); |
| 62 const PPB_InputEvent* input_event_if = ppapi_proxy::PPBInputEventInterface(); |
| 63 if (!input_event_if) { |
| 64 return; |
| 65 } |
| 66 input_event_if->ClearInputEventRequest(instance, |
| 67 static_cast<uint32_t>(event_classes)); |
| 68 rpc->result = NACL_SRPC_RESULT_OK; |
| 69 } |
| 70 |
OLD | NEW |