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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.cc

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.cc
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.cc (revision 0)
+++ ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.cc (revision 0)
@@ -0,0 +1,140 @@
+// 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.
+
+#include "native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.h"
+
+#include "native_client/src/include/portability.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
+#include "native_client/src/shared/ppapi_proxy/utility.h"
+#include "ppapi/c/dev/ppb_cursor_control_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "srpcgen/ppb_rpc.h"
+
+namespace ppapi_proxy {
+
+namespace {
+
+const nacl_abi_size_t kPPPointBytes =
+ static_cast<nacl_abi_size_t>(sizeof(struct PP_Point));
+
+PP_Bool SetCursor(PP_Instance instance,
+ enum PP_CursorType_Dev type,
+ PP_Resource custom_image,
+ const struct PP_Point* hot_spot) {
+ DebugPrintf("PPB_CursorControl::SetCursor: "
+ "instance=%"NACL_PRIu32"\n", instance);
+
+ int32_t hot_spot_size = (hot_spot != NULL) ? kPPPointBytes : 0;
+ int32_t success = 0;
+ NaClSrpcError srpc_result =
+ PpbCursorControlRpcClient::PPB_CursorControl_SetCursor(
+ GetMainSrpcChannel(),
+ instance,
+ type,
+ custom_image,
+ hot_spot_size,
+ reinterpret_cast<char*>(const_cast<struct PP_Point*>(hot_spot)),
+ &success);
+
+ DebugPrintf("PPB_CursorControl::SetCursor: %s\n",
+ NaClSrpcErrorString(srpc_result));
+ if (srpc_result == NACL_SRPC_RESULT_OK && success)
+ return PP_TRUE;
+ return PP_FALSE;
+}
+
+PP_Bool LockCursor(PP_Instance instance) {
+ DebugPrintf("PPB_CursorControl::LockCursor: "
+ "instance=%"NACL_PRIu32"\n", instance);
+
+ int32_t success = 0;
+ NaClSrpcError srpc_result =
+ PpbCursorControlRpcClient::PPB_CursorControl_LockCursor(
+ GetMainSrpcChannel(),
+ instance,
+ &success);
+
+ DebugPrintf("PPB_CursorControl::LockCursor: %s\n",
+ NaClSrpcErrorString(srpc_result));
+
+ if (srpc_result == NACL_SRPC_RESULT_OK && success)
+ return PP_TRUE;
+ return PP_FALSE;
+}
+
+PP_Bool UnlockCursor(PP_Instance instance) {
+ DebugPrintf("PPB_CursorControl::UnlockCursor: "
+ "instance=%"NACL_PRIu32"\n", instance);
+
+ int32_t success = 0;
+ NaClSrpcError srpc_result =
+ PpbCursorControlRpcClient::PPB_CursorControl_UnlockCursor(
+ GetMainSrpcChannel(),
+ instance,
+ &success);
+
+ DebugPrintf("PPB_CursorControl::UnlockCursor: %s\n",
+ NaClSrpcErrorString(srpc_result));
+
+ if (srpc_result == NACL_SRPC_RESULT_OK && success)
+ return PP_TRUE;
+ return PP_FALSE;
+}
+
+PP_Bool HasCursorLock(PP_Instance instance) {
+ DebugPrintf("PPB_CursorControl::HasCursorLock: "
+ "instance=%"NACL_PRIu32"\n", instance);
+
+ int32_t success = 0;
+ NaClSrpcError srpc_result =
+ PpbCursorControlRpcClient::PPB_CursorControl_HasCursorLock(
+ GetMainSrpcChannel(),
+ instance,
+ &success);
+
+ DebugPrintf("PPB_CursorControl::HasCursorLock: %s\n",
+ NaClSrpcErrorString(srpc_result));
+
+ if (srpc_result == NACL_SRPC_RESULT_OK && success)
+ return PP_TRUE;
+ return PP_FALSE;
+}
+
+PP_Bool CanLockCursor(PP_Instance instance) {
+ DebugPrintf("PPB_CursorControl::CanLockCursor: "
+ "instance=%"NACL_PRIu32"\n", instance);
+
+ int32_t success = 0;
+ NaClSrpcError srpc_result =
+ PpbCursorControlRpcClient::PPB_CursorControl_CanLockCursor(
+ GetMainSrpcChannel(),
+ instance,
+ &success);
+
+ DebugPrintf("PPB_CursorControl::CanLockCursor: %s\n",
+ NaClSrpcErrorString(srpc_result));
+
+ if (srpc_result == NACL_SRPC_RESULT_OK && success)
+ return PP_TRUE;
+ return PP_FALSE;
+}
+
+} // namespace
+
+const PPB_CursorControl_Dev* PluginCursorControl::GetInterface() {
+ static const PPB_CursorControl_Dev cursor_control_interface = {
+ SetCursor,
+ LockCursor,
+ UnlockCursor,
+ HasCursorLock,
+ CanLockCursor
+ };
+ return &cursor_control_interface;
+}
+
+} // namespace ppapi_proxy
+
+

Powered by Google App Engine
This is Rietveld 408576698