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

Unified Diff: src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc

Issue 7395005: Proxy PPB_Input_Event, PPP_Input_Event, and associated IFs. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Another gyp fix, windows build fix Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc
diff --git a/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc b/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b034089d18e221cffc556f9d03a58e8c78434d95
--- /dev/null
+++ b/src/shared/ppapi_proxy/browser_ppb_input_event_rpc_server.cc
@@ -0,0 +1,84 @@
+// Copyright (c) 2011 The Native Client Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SRPC-abstraction wrappers around PPB_InputEvent functions.
+
+#include "native_client/src/include/portability.h"
+#include "native_client/src/shared/ppapi_proxy/browser_globals.h"
+#include "native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h"
+#include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppb_rpc.h"
+#include "native_client/src/shared/ppapi_proxy/utility.h"
+#include "native_client/src/third_party/ppapi/c/pp_errors.h"
+#include "native_client/src/third_party/ppapi/c/ppb_input_event.h"
+
+
+using ppapi_proxy::DebugPrintf;
+
+void PpbInputEventRpcServer::PPB_InputEvent_RequestInputEvents(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ int32_t event_classes,
+ bool filtering,
+ int32_t* success) {
+ NaClSrpcClosureRunner runner(done);
+ rpc->result = NACL_SRPC_RESULT_APP_ERROR;
+ *success = PP_ERROR_FAILED;
+ DebugPrintf("PPB_InputEvent::RequestInputEvents: instance=%"NACL_PRIu32", "
+ "event_classes=%"NACL_PRIu32", filtering=%s\n",
+ instance, static_cast<uint32_t>(event_classes),
+ filtering ? "true" : "false");
+ const PPB_InputEvent* interface = ppapi_proxy::PPBInputEventInterface();
+ if (!interface) {
+ *success = PP_ERROR_NOTSUPPORTED;
+ DebugPrintf("PPB_InputEvent::RequestInputEvents: success=%"NACL_PRId32"\n",
+ *success);
+ return;
+ }
+ if (filtering) {
+ *success = interface->RequestFilteringInputEvents(
+ instance,
+ static_cast<uint32_t>(event_classes));
+ } else {
+ *success = interface->RequestInputEvents(
+ instance,
+ static_cast<uint32_t>(event_classes));
+ }
+ // Note, according to ppb_input_event.h, if a bit is invalid,
+ // PP_ERROR_NOTSUPPORTED is returned, but the valid bits are still set.
+ // Hence, we set our local bitfields appropriately in case of returns of PP_OK
+ // or PP_ERROR_NOTSUPPORTED.
+ if ((*success == PP_OK) || (*success == PP_ERROR_NOTSUPPORTED)) {
+ ppapi_proxy::BrowserInputEvent::InputEventsRequested(
+ instance,
+ static_cast<uint32_t>(event_classes),
+ filtering);
+ }
+ DebugPrintf("PPB_InputEvent::RequestInputEvents: success=%"NACL_PRId32"\n",
+ *success);
+ rpc->result = NACL_SRPC_RESULT_OK;
+}
+
+void PpbInputEventRpcServer::PPB_InputEvent_ClearInputEventRequest(
+ NaClSrpcRpc* rpc,
+ NaClSrpcClosure* done,
+ PP_Instance instance,
+ int32_t event_classes) {
+ NaClSrpcClosureRunner runner(done);
+ rpc->result = NACL_SRPC_RESULT_APP_ERROR;
+ DebugPrintf("PPB_InputEvent::ClearInputEventRequest: instance=%"NACL_PRIu32
+ ", event_classes=%"NACL_PRIu32"\n",
+ instance, static_cast<uint32_t>(event_classes));
+ const PPB_InputEvent* interface = ppapi_proxy::PPBInputEventInterface();
+ if (!interface) {
+ return;
+ }
+ interface->ClearInputEventRequest(instance,
+ static_cast<uint32_t>(event_classes));
+ ppapi_proxy::BrowserInputEvent::InputEventsCleared(
+ instance,
+ static_cast<uint32_t>(event_classes));
+ rpc->result = NACL_SRPC_RESULT_OK;
+}
+

Powered by Google App Engine
This is Rietveld 408576698