summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/ppb_instance_api.h6
-rwxr-xr-xppapi/thunk/ppb_mouse_lock_thunk.cc44
-rw-r--r--ppapi/thunk/thunk.h2
3 files changed, 52 insertions, 0 deletions
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index dcf100dc..e9cacef 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -5,6 +5,7 @@
#ifndef PPAPI_THUNK_INSTANCE_API_H_
#define PPAPI_THUNK_INSTANCE_API_H_
+#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_size.h"
@@ -44,6 +45,11 @@ class PPB_Instance_FunctionAPI {
// Messaging.
virtual void PostMessage(PP_Instance instance, PP_Var message) = 0;
+ // MouseLock.
+ virtual int32_t LockMouse(PP_Instance instance,
+ PP_CompletionCallback callback) = 0;
+ virtual void UnlockMouse(PP_Instance instance) = 0;
+
// Zoom.
virtual void ZoomChanged(PP_Instance instance, double factor) = 0;
virtual void ZoomLimitsChanged(PP_Instance instance,
diff --git a/ppapi/thunk/ppb_mouse_lock_thunk.cc b/ppapi/thunk/ppb_mouse_lock_thunk.cc
new file mode 100755
index 0000000..d9116b0
--- /dev/null
+++ b/ppapi/thunk/ppb_mouse_lock_thunk.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 The Chromium 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 "ppapi/c/dev/ppb_mouse_lock_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/thunk/common.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t LockMouse(PP_Instance instance, PP_CompletionCallback callback) {
+ EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true);
+ if (enter.failed())
+ return MayForceCallback(callback, PP_ERROR_BADARGUMENT);
+ int32_t result = enter.functions()->LockMouse(instance, callback);
+ return MayForceCallback(callback, result);
+}
+
+void UnlockMouse(PP_Instance instance) {
+ EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true);
+ if (enter.failed())
+ return;
+ enter.functions()->UnlockMouse(instance);
+}
+
+const PPB_MouseLock_Dev g_ppb_mouse_lock_thunk = {
+ &LockMouse,
+ &UnlockMouse
+};
+
+} // namespace
+
+const PPB_MouseLock_Dev* GetPPB_MouseLock_Thunk() {
+ return &g_ppb_mouse_lock_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h
index a6d1dd9..94c31a7 100644
--- a/ppapi/thunk/thunk.h
+++ b/ppapi/thunk/thunk.h
@@ -43,6 +43,7 @@ struct PPB_LayerCompositor_Dev;
struct PPB_Messaging;
struct PPB_MouseInputEvent_1_0;
struct PPB_MouseInputEvent;
+struct PPB_MouseLock_Dev;
struct PPB_QueryPolicy_Dev;
struct PPB_Scrollbar_0_5_Dev;
struct PPB_Surface3D_Dev;
@@ -109,6 +110,7 @@ PPAPI_THUNK_EXPORT const PPB_MouseInputEvent_1_0*
GetPPB_MouseInputEvent_1_0_Thunk();
PPAPI_THUNK_EXPORT const PPB_MouseInputEvent*
GetPPB_MouseInputEvent_1_1_Thunk();
+PPAPI_THUNK_EXPORT const PPB_MouseLock_Dev* GetPPB_MouseLock_Thunk();
PPAPI_THUNK_EXPORT const PPB_Scrollbar_0_5_Dev* GetPPB_Scrollbar_Thunk();
PPAPI_THUNK_EXPORT const PPB_Surface3D_Dev* GetPPB_Surface3D_Thunk();
PPAPI_THUNK_EXPORT const PPB_Transport_Dev* GetPPB_Transport_Thunk();