From 1314f5f673e337ec559c973be90abf5db7ebf17e Mon Sep 17 00:00:00 2001 From: "yzshen@chromium.org" Date: Sun, 16 Oct 2011 02:26:56 +0000 Subject: Move PPB/PPP_MouseLock out of dev/. BUG=41781 TEST=None Review URL: http://codereview.chromium.org/8295023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105707 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/api/dev/ppb_mouse_lock_dev.idl | 57 ---------------- ppapi/api/dev/ppp_mouse_lock_dev.idl | 28 -------- ppapi/api/ppb_mouse_lock.idl | 57 ++++++++++++++++ ppapi/api/ppp_mouse_lock.idl | 28 ++++++++ ppapi/c/dev/ppb_mouse_lock_dev.h | 77 ---------------------- ppapi/c/dev/ppp_mouse_lock_dev.h | 47 ------------- ppapi/c/ppb_mouse_lock.h | 77 ++++++++++++++++++++++ ppapi/c/ppp_mouse_lock.h | 47 +++++++++++++ ppapi/cpp/dev/mouse_lock_dev.cc | 63 ------------------ ppapi/cpp/dev/mouse_lock_dev.h | 57 ---------------- ppapi/cpp/mouse_lock.cc | 63 ++++++++++++++++++ ppapi/cpp/mouse_lock.h | 56 ++++++++++++++++ ppapi/examples/mouse_lock/mouse_lock.cc | 6 +- .../src/shared/ppapi_proxy/browser_globals.cc | 7 +- .../src/shared/ppapi_proxy/browser_globals.h | 4 +- .../browser_ppb_mouse_lock_rpc_server.cc | 4 +- .../src/shared/ppapi_proxy/browser_ppp.cc | 4 +- .../shared/ppapi_proxy/browser_ppp_mouse_lock.cc | 4 +- .../shared/ppapi_proxy/browser_ppp_mouse_lock.h | 6 +- .../src/shared/ppapi_proxy/plugin_globals.cc | 6 +- .../src/shared/ppapi_proxy/plugin_globals.h | 4 +- .../src/shared/ppapi_proxy/plugin_ppb.cc | 2 +- .../shared/ppapi_proxy/plugin_ppb_mouse_lock.cc | 6 +- .../src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h | 6 +- .../plugin_ppp_mouse_lock_rpc_server.cc | 4 +- .../src/shared/ppapi_proxy/ppb_mouse_lock.srpc | 4 +- .../src/shared/ppapi_proxy/ppp_mouse_lock.srpc | 4 +- ppapi/native_client/src/trusted/plugin/plugin.cc | 16 ++--- ppapi/native_client/src/trusted/plugin/plugin.h | 4 +- .../tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc | 2 - ppapi/ppapi_cpp.gypi | 8 +-- ppapi/proxy/interface_id.h | 2 +- ppapi/proxy/interface_list.cc | 2 +- ppapi/proxy/ppapi_messages.h | 2 +- ppapi/proxy/ppb_instance_proxy.cc | 2 +- ppapi/proxy/ppp_mouse_lock_proxy.cc | 14 ++-- ppapi/proxy/ppp_mouse_lock_proxy.h | 4 +- ppapi/tests/all_c_includes.h | 4 +- ppapi/tests/all_cpp_includes.h | 2 +- ppapi/thunk/interfaces_ppb_public_dev.h | 2 - ppapi/thunk/interfaces_ppb_public_stable.h | 1 + ppapi/thunk/ppb_mouse_lock_thunk.cc | 6 +- webkit/plugins/ppapi/plugin_module.cc | 2 +- webkit/plugins/ppapi/ppapi_plugin_instance.cc | 6 +- webkit/plugins/ppapi/ppapi_plugin_instance.h | 4 +- 45 files changed, 403 insertions(+), 408 deletions(-) delete mode 100644 ppapi/api/dev/ppb_mouse_lock_dev.idl delete mode 100644 ppapi/api/dev/ppp_mouse_lock_dev.idl create mode 100644 ppapi/api/ppb_mouse_lock.idl create mode 100644 ppapi/api/ppp_mouse_lock.idl delete mode 100644 ppapi/c/dev/ppb_mouse_lock_dev.h delete mode 100644 ppapi/c/dev/ppp_mouse_lock_dev.h create mode 100644 ppapi/c/ppb_mouse_lock.h create mode 100644 ppapi/c/ppp_mouse_lock.h delete mode 100644 ppapi/cpp/dev/mouse_lock_dev.cc delete mode 100644 ppapi/cpp/dev/mouse_lock_dev.h create mode 100644 ppapi/cpp/mouse_lock.cc create mode 100644 ppapi/cpp/mouse_lock.h diff --git a/ppapi/api/dev/ppb_mouse_lock_dev.idl b/ppapi/api/dev/ppb_mouse_lock_dev.idl deleted file mode 100644 index 7898994..0000000 --- a/ppapi/api/dev/ppb_mouse_lock_dev.idl +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - */ - -/** - * This file defines the PPB_MouseLock_Dev interface. - */ - -label Chrome { - M15 = 0.1 -}; - -/** - * The PPB_MouseLock_Dev interface is implemented by the browser. - * It provides a way of locking the target of mouse events to a single plugin - * instance and removing the cursor from view. This is a useful input mode for - * certain classes of applications, especially first person perspective 3D - * applications and 3D modelling software. - */ -interface PPB_MouseLock_Dev { - /** - * Requests the mouse to be locked. The browser will permit mouse lock only - * while the tab is in fullscreen mode. - * - * While the mouse is locked, the cursor is implicitly hidden from the user. - * Any movement of the mouse will generate a - * PP_INPUTEVENT_TYPE_MOUSEMOVE. The GetPosition of - * PPB_MouseInputEvent reports the last known mouse position just - * as mouse lock was entered; while the GetMovement provides - * relative movement information, which indicates what the change in position - * of the mouse would be had it not been locked. - * - * The browser may revoke mouse lock for reasons including but not limited to - * the user pressing the ESC key, the user activating another program via a - * reserved keystroke (e.g., ALT+TAB), or some other system event. - * - * @param[in] instance A PP_Instance identifying one instance - * of a module. - * @param[in] callback A PP_CompletionCallback to be called upon - * completion. - * - * @return An int32_t containing an error code from pp_errors.h. - */ - int32_t LockMouse([in] PP_Instance instance, - [in] PP_CompletionCallback callback); - - /** - * Causes the mouse to be unlocked, allowing it to track user movement again. - * This is an asynchronous operation. The plugin instance will be notified via - * the PPP_MouseLock interface when it has lost the mouse lock. - * - * @param[in] instance A PP_Instance identifying one instance - * of a module. - */ - void UnlockMouse([in] PP_Instance instance); -}; diff --git a/ppapi/api/dev/ppp_mouse_lock_dev.idl b/ppapi/api/dev/ppp_mouse_lock_dev.idl deleted file mode 100644 index 0ebeb97..0000000 --- a/ppapi/api/dev/ppp_mouse_lock_dev.idl +++ /dev/null @@ -1,28 +0,0 @@ -/* 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. - */ - -/** - * This file defines the PPP_MouseLock_Dev interface. - */ - -label Chrome { - M15 = 0.1 -}; - -/** - * The PPP_MouseLock_Dev interface contains pointers to functions - * that you must implement to receive mouse lock events from the browser. - */ -interface PPP_MouseLock_Dev { - /** - * Called when the instance loses the mouse lock, e.g. because the user - * pressed the ESC key. - * - * @param[in] instance A PP_Instance identifying one instance - * of a module. - */ - void MouseLockLost([in] PP_Instance instance); -}; - diff --git a/ppapi/api/ppb_mouse_lock.idl b/ppapi/api/ppb_mouse_lock.idl new file mode 100644 index 0000000..8c5a96f --- /dev/null +++ b/ppapi/api/ppb_mouse_lock.idl @@ -0,0 +1,57 @@ +/* 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. + */ + +/** + * This file defines the PPB_MouseLock interface. + */ + +label Chrome { + M16 = 1.0 +}; + +/** + * The PPB_MouseLock interface is implemented by the browser. + * It provides a way of locking the target of mouse events to a single plugin + * instance and removing the cursor from view. This is a useful input mode for + * certain classes of applications, especially first person perspective 3D + * applications and 3D modelling software. + */ +interface PPB_MouseLock { + /** + * Requests the mouse to be locked. The browser will permit mouse lock only + * while the tab is in fullscreen mode. + * + * While the mouse is locked, the cursor is implicitly hidden from the user. + * Any movement of the mouse will generate a + * PP_INPUTEVENT_TYPE_MOUSEMOVE. The GetPosition of + * PPB_MouseInputEvent reports the last known mouse position just + * as mouse lock was entered; while the GetMovement provides + * relative movement information, which indicates what the change in position + * of the mouse would be had it not been locked. + * + * The browser may revoke mouse lock for reasons including but not limited to + * the user pressing the ESC key, the user activating another program via a + * reserved keystroke (e.g., ALT+TAB), or some other system event. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t LockMouse([in] PP_Instance instance, + [in] PP_CompletionCallback callback); + + /** + * Causes the mouse to be unlocked, allowing it to track user movement again. + * This is an asynchronous operation. The plugin instance will be notified via + * the PPP_MouseLock interface when it has lost the mouse lock. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void UnlockMouse([in] PP_Instance instance); +}; diff --git a/ppapi/api/ppp_mouse_lock.idl b/ppapi/api/ppp_mouse_lock.idl new file mode 100644 index 0000000..07f0ea6 --- /dev/null +++ b/ppapi/api/ppp_mouse_lock.idl @@ -0,0 +1,28 @@ +/* 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. + */ + +/** + * This file defines the PPP_MouseLock interface. + */ + +label Chrome { + M16 = 1.0 +}; + +/** + * The PPP_MouseLock interface contains pointers to functions + * that you must implement to receive mouse lock events from the browser. + */ +interface PPP_MouseLock { + /** + * Called when the instance loses the mouse lock, e.g. because the user + * pressed the ESC key. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void MouseLockLost([in] PP_Instance instance); +}; + diff --git a/ppapi/c/dev/ppb_mouse_lock_dev.h b/ppapi/c/dev/ppb_mouse_lock_dev.h deleted file mode 100644 index f5e2a884..0000000 --- a/ppapi/c/dev/ppb_mouse_lock_dev.h +++ /dev/null @@ -1,77 +0,0 @@ -/* 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. - */ - -/* From dev/ppb_mouse_lock_dev.idl modified Tue Sep 6 16:06:47 2011. */ - -#ifndef PPAPI_C_DEV_PPB_MOUSE_LOCK_DEV_H_ -#define PPAPI_C_DEV_PPB_MOUSE_LOCK_DEV_H_ - -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_stdint.h" - -#define PPB_MOUSELOCK_DEV_INTERFACE_0_1 "PPB_MouseLock(Dev);0.1" -#define PPB_MOUSELOCK_DEV_INTERFACE PPB_MOUSELOCK_DEV_INTERFACE_0_1 - -/** - * @file - * This file defines the PPB_MouseLock_Dev interface. - */ - - -/** - * @addtogroup Interfaces - * @{ - */ -/** - * The PPB_MouseLock_Dev interface is implemented by the browser. - * It provides a way of locking the target of mouse events to a single plugin - * instance and removing the cursor from view. This is a useful input mode for - * certain classes of applications, especially first person perspective 3D - * applications and 3D modelling software. - */ -struct PPB_MouseLock_Dev { - /** - * Requests the mouse to be locked. The browser will permit mouse lock only - * while the tab is in fullscreen mode. - * - * While the mouse is locked, the cursor is implicitly hidden from the user. - * Any movement of the mouse will generate a - * PP_INPUTEVENT_TYPE_MOUSEMOVE. The GetPosition of - * PPB_MouseInputEvent reports the last known mouse position just - * as mouse lock was entered; while the GetMovement provides - * relative movement information, which indicates what the change in position - * of the mouse would be had it not been locked. - * - * The browser may revoke mouse lock for reasons including but not limited to - * the user pressing the ESC key, the user activating another program via a - * reserved keystroke (e.g., ALT+TAB), or some other system event. - * - * @param[in] instance A PP_Instance identifying one instance - * of a module. - * @param[in] callback A PP_CompletionCallback to be called upon - * completion. - * - * @return An int32_t containing an error code from pp_errors.h. - */ - int32_t (*LockMouse)(PP_Instance instance, - struct PP_CompletionCallback callback); - /** - * Causes the mouse to be unlocked, allowing it to track user movement again. - * This is an asynchronous operation. The plugin instance will be notified via - * the PPP_MouseLock interface when it has lost the mouse lock. - * - * @param[in] instance A PP_Instance identifying one instance - * of a module. - */ - void (*UnlockMouse)(PP_Instance instance); -}; -/** - * @} - */ - -#endif /* PPAPI_C_DEV_PPB_MOUSE_LOCK_DEV_H_ */ - diff --git a/ppapi/c/dev/ppp_mouse_lock_dev.h b/ppapi/c/dev/ppp_mouse_lock_dev.h deleted file mode 100644 index fee1ce7..0000000 --- a/ppapi/c/dev/ppp_mouse_lock_dev.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - */ - -/* From dev/ppp_mouse_lock_dev.idl modified Tue Sep 6 16:07:16 2011. */ - -#ifndef PPAPI_C_DEV_PPP_MOUSE_LOCK_DEV_H_ -#define PPAPI_C_DEV_PPP_MOUSE_LOCK_DEV_H_ - -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_stdint.h" - -#define PPP_MOUSELOCK_DEV_INTERFACE_0_1 "PPP_MouseLock(Dev);0.1" -#define PPP_MOUSELOCK_DEV_INTERFACE PPP_MOUSELOCK_DEV_INTERFACE_0_1 - -/** - * @file - * This file defines the PPP_MouseLock_Dev interface. - */ - - -/** - * @addtogroup Interfaces - * @{ - */ -/** - * The PPP_MouseLock_Dev interface contains pointers to functions - * that you must implement to receive mouse lock events from the browser. - */ -struct PPP_MouseLock_Dev { - /** - * Called when the instance loses the mouse lock, e.g. because the user - * pressed the ESC key. - * - * @param[in] instance A PP_Instance identifying one instance - * of a module. - */ - void (*MouseLockLost)(PP_Instance instance); -}; -/** - * @} - */ - -#endif /* PPAPI_C_DEV_PPP_MOUSE_LOCK_DEV_H_ */ - diff --git a/ppapi/c/ppb_mouse_lock.h b/ppapi/c/ppb_mouse_lock.h new file mode 100644 index 0000000..c7b074d --- /dev/null +++ b/ppapi/c/ppb_mouse_lock.h @@ -0,0 +1,77 @@ +/* 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. + */ + +/* From ppb_mouse_lock.idl modified Fri Oct 14 18:59:25 2011. */ + +#ifndef PPAPI_C_PPB_MOUSE_LOCK_H_ +#define PPAPI_C_PPB_MOUSE_LOCK_H_ + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_MOUSELOCK_INTERFACE_1_0 "PPB_MouseLock;1.0" +#define PPB_MOUSELOCK_INTERFACE PPB_MOUSELOCK_INTERFACE_1_0 + +/** + * @file + * This file defines the PPB_MouseLock interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_MouseLock interface is implemented by the browser. + * It provides a way of locking the target of mouse events to a single plugin + * instance and removing the cursor from view. This is a useful input mode for + * certain classes of applications, especially first person perspective 3D + * applications and 3D modelling software. + */ +struct PPB_MouseLock { + /** + * Requests the mouse to be locked. The browser will permit mouse lock only + * while the tab is in fullscreen mode. + * + * While the mouse is locked, the cursor is implicitly hidden from the user. + * Any movement of the mouse will generate a + * PP_INPUTEVENT_TYPE_MOUSEMOVE. The GetPosition of + * PPB_MouseInputEvent reports the last known mouse position just + * as mouse lock was entered; while the GetMovement provides + * relative movement information, which indicates what the change in position + * of the mouse would be had it not been locked. + * + * The browser may revoke mouse lock for reasons including but not limited to + * the user pressing the ESC key, the user activating another program via a + * reserved keystroke (e.g., ALT+TAB), or some other system event. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*LockMouse)(PP_Instance instance, + struct PP_CompletionCallback callback); + /** + * Causes the mouse to be unlocked, allowing it to track user movement again. + * This is an asynchronous operation. The plugin instance will be notified via + * the PPP_MouseLock interface when it has lost the mouse lock. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void (*UnlockMouse)(PP_Instance instance); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_MOUSE_LOCK_H_ */ + diff --git a/ppapi/c/ppp_mouse_lock.h b/ppapi/c/ppp_mouse_lock.h new file mode 100644 index 0000000..850813a --- /dev/null +++ b/ppapi/c/ppp_mouse_lock.h @@ -0,0 +1,47 @@ +/* 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. + */ + +/* From ppp_mouse_lock.idl modified Fri Oct 14 19:00:26 2011. */ + +#ifndef PPAPI_C_PPP_MOUSE_LOCK_H_ +#define PPAPI_C_PPP_MOUSE_LOCK_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_MOUSELOCK_INTERFACE_1_0 "PPP_MouseLock;1.0" +#define PPP_MOUSELOCK_INTERFACE PPP_MOUSELOCK_INTERFACE_1_0 + +/** + * @file + * This file defines the PPP_MouseLock interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPP_MouseLock interface contains pointers to functions + * that you must implement to receive mouse lock events from the browser. + */ +struct PPP_MouseLock { + /** + * Called when the instance loses the mouse lock, e.g. because the user + * pressed the ESC key. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void (*MouseLockLost)(PP_Instance instance); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPP_MOUSE_LOCK_H_ */ + diff --git a/ppapi/cpp/dev/mouse_lock_dev.cc b/ppapi/cpp/dev/mouse_lock_dev.cc deleted file mode 100644 index 57b724d..0000000 --- a/ppapi/cpp/dev/mouse_lock_dev.cc +++ /dev/null @@ -1,63 +0,0 @@ -// 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/cpp/dev/mouse_lock_dev.h" - -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/module.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -static const char kPPPMouseLockInterface[] = PPP_MOUSELOCK_DEV_INTERFACE; - -void MouseLockLost(PP_Instance instance) { - void* object = - pp::Instance::GetPerInstanceObject(instance, kPPPMouseLockInterface); - if (!object) - return; - static_cast(object)->MouseLockLost(); -} - -const PPP_MouseLock_Dev ppp_mouse_lock = { - &MouseLockLost -}; - -template <> const char* interface_name() { - return PPB_MOUSELOCK_DEV_INTERFACE; -} - -} // namespace - -MouseLock_Dev::MouseLock_Dev(Instance* instance) - : associated_instance_(instance) { - pp::Module::Get()->AddPluginInterface(kPPPMouseLockInterface, - &ppp_mouse_lock); - associated_instance_->AddPerInstanceObject(kPPPMouseLockInterface, this); -} - -MouseLock_Dev::~MouseLock_Dev() { - associated_instance_->RemovePerInstanceObject(kPPPMouseLockInterface, this); -} - -int32_t MouseLock_Dev::LockMouse(const CompletionCallback& cc) { - if (!has_interface()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface()->LockMouse( - associated_instance_->pp_instance(), cc.pp_completion_callback()); -} - -void MouseLock_Dev::UnlockMouse() { - if (has_interface()) { - get_interface()->UnlockMouse( - associated_instance_->pp_instance()); - } -} - -} // namespace pp diff --git a/ppapi/cpp/dev/mouse_lock_dev.h b/ppapi/cpp/dev/mouse_lock_dev.h deleted file mode 100644 index 7585de0..0000000 --- a/ppapi/cpp/dev/mouse_lock_dev.h +++ /dev/null @@ -1,57 +0,0 @@ -// 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. - -#ifndef PPAPI_CPP_DEV_MOUSE_LOCK_DEV_H_ -#define PPAPI_CPP_DEV_MOUSE_LOCK_DEV_H_ - -#include "ppapi/c/pp_stdint.h" - -namespace pp { - -class CompletionCallback; -class Instance; - -// This class allows you to associate the PPP_MouseLock_Dev and -// PPB_MouseLock_Dev C-based interfaces with an object. It associates itself -// with the given instance, and registers as the global handler for handling the -// PPP_MouseLock_Dev interface that the browser calls. -// -// You would typically use this either via inheritance on your instance: -// class MyInstance : public pp::Instance, public pp::MouseLock_Dev { -// class MyInstance() : pp::MouseLock_Dev(this) { -// } -// ... -// }; -// -// or by composition: -// class MyMouseLock : public pp::MouseLock_Dev { -// ... -// }; -// -// class MyInstance : public pp::Instance { -// MyInstance() : mouse_lock_(this) { -// } -// -// MyMouseLock mouse_lock_; -// }; -class MouseLock_Dev { - public: - explicit MouseLock_Dev(Instance* instance); - virtual ~MouseLock_Dev(); - - // PPP_MouseLock_Dev functions exposed as virtual functions for you to - // override. - virtual void MouseLockLost() = 0; - - // PPB_MouseLock_Dev functions for you to call. - int32_t LockMouse(const CompletionCallback& cc); - void UnlockMouse(); - - private: - Instance* associated_instance_; -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_MOUSE_LOCK_DEV_H_ diff --git a/ppapi/cpp/mouse_lock.cc b/ppapi/cpp/mouse_lock.cc new file mode 100644 index 0000000..4d3b9bf --- /dev/null +++ b/ppapi/cpp/mouse_lock.cc @@ -0,0 +1,63 @@ +// 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/cpp/mouse_lock.h" + +#include "ppapi/c/ppb_mouse_lock.h" +#include "ppapi/c/ppp_mouse_lock.h" +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +static const char kPPPMouseLockInterface[] = PPP_MOUSELOCK_INTERFACE; + +void MouseLockLost(PP_Instance instance) { + void* object = + pp::Instance::GetPerInstanceObject(instance, kPPPMouseLockInterface); + if (!object) + return; + static_cast(object)->MouseLockLost(); +} + +const PPP_MouseLock ppp_mouse_lock = { + &MouseLockLost +}; + +template <> const char* interface_name() { + return PPB_MOUSELOCK_INTERFACE; +} + +} // namespace + +MouseLock::MouseLock(Instance* instance) + : associated_instance_(instance) { + pp::Module::Get()->AddPluginInterface(kPPPMouseLockInterface, + &ppp_mouse_lock); + associated_instance_->AddPerInstanceObject(kPPPMouseLockInterface, this); +} + +MouseLock::~MouseLock() { + associated_instance_->RemovePerInstanceObject(kPPPMouseLockInterface, this); +} + +int32_t MouseLock::LockMouse(const CompletionCallback& cc) { + if (!has_interface()) + return cc.MayForce(PP_ERROR_NOINTERFACE); + return get_interface()->LockMouse( + associated_instance_->pp_instance(), cc.pp_completion_callback()); +} + +void MouseLock::UnlockMouse() { + if (has_interface()) { + get_interface()->UnlockMouse( + associated_instance_->pp_instance()); + } +} + +} // namespace pp diff --git a/ppapi/cpp/mouse_lock.h b/ppapi/cpp/mouse_lock.h new file mode 100644 index 0000000..b04c07c --- /dev/null +++ b/ppapi/cpp/mouse_lock.h @@ -0,0 +1,56 @@ +// 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. + +#ifndef PPAPI_CPP_MOUSE_LOCK_H_ +#define PPAPI_CPP_MOUSE_LOCK_H_ + +#include "ppapi/c/pp_stdint.h" + +namespace pp { + +class CompletionCallback; +class Instance; + +// This class allows you to associate the PPP_MouseLock and PPB_MouseLock +// C-based interfaces with an object. It associates itself with the given +// instance, and registers as the global handler for handling the PPP_MouseLock +// interface that the browser calls. +// +// You would typically use this either via inheritance on your instance: +// class MyInstance : public pp::Instance, public pp::MouseLock { +// class MyInstance() : pp::MouseLock(this) { +// } +// ... +// }; +// +// or by composition: +// class MyMouseLock : public pp::MouseLock { +// ... +// }; +// +// class MyInstance : public pp::Instance { +// MyInstance() : mouse_lock_(this) { +// } +// +// MyMouseLock mouse_lock_; +// }; +class MouseLock { + public: + explicit MouseLock(Instance* instance); + virtual ~MouseLock(); + + // PPP_MouseLock functions exposed as virtual functions for you to override. + virtual void MouseLockLost() = 0; + + // PPB_MouseLock functions for you to call. + int32_t LockMouse(const CompletionCallback& cc); + void UnlockMouse(); + + private: + Instance* associated_instance_; +}; + +} // namespace pp + +#endif // PPAPI_CPP_MOUSE_LOCK_H_ diff --git a/ppapi/examples/mouse_lock/mouse_lock.cc b/ppapi/examples/mouse_lock/mouse_lock.cc index 395cbf8..68aa4ac 100644 --- a/ppapi/examples/mouse_lock/mouse_lock.cc +++ b/ppapi/examples/mouse_lock/mouse_lock.cc @@ -9,21 +9,21 @@ #include "ppapi/c/dev/ppb_console_dev.h" #include "ppapi/c/ppb_input_event.h" #include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/mouse_lock_dev.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" #include "ppapi/cpp/input_event.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/module.h" +#include "ppapi/cpp/mouse_lock.h" #include "ppapi/cpp/rect.h" #include "ppapi/cpp/var.h" -class MyInstance : public pp::Instance, public pp::MouseLock_Dev { +class MyInstance : public pp::Instance, public pp::MouseLock { public: explicit MyInstance(PP_Instance instance) : pp::Instance(instance), - pp::MouseLock_Dev(this), + pp::MouseLock(this), width_(0), height_(0), mouse_locked_(false), diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc index ab94ccf..c167591 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc @@ -394,10 +394,9 @@ const PPB_Fullscreen* PPBFullscreenInterface() { return ppb; } -const PPB_MouseLock_Dev* PPBMouseLockInterface() { - static const PPB_MouseLock_Dev* ppb = - static_cast( - GetBrowserInterfaceSafe(PPB_MOUSELOCK_DEV_INTERFACE)); +const PPB_MouseLock* PPBMouseLockInterface() { + static const PPB_MouseLock* ppb = static_cast( + GetBrowserInterfaceSafe(PPB_MOUSELOCK_INTERFACE)); return ppb; } diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h index 6ce901b..804968d 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h @@ -9,7 +9,6 @@ #include "ppapi/c/dev/ppb_find_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" @@ -29,6 +28,7 @@ #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" @@ -117,7 +117,7 @@ const PPB_KeyboardInputEvent* PPBKeyboardInputEventInterface(); const PPB_Memory_Dev* PPBMemoryInterface(); // shared const PPB_MouseInputEvent* PPBMouseInputEventInterface(); const PPB_Messaging* PPBMessagingInterface(); -const PPB_MouseLock_Dev* PPBMouseLockInterface(); +const PPB_MouseLock* PPBMouseLockInterface(); const PPB_PDF* PPBPDFInterface(); const PPB_Scrollbar_Dev* PPBScrollbarInterface(); const PPB_Testing_Dev* PPBTestingInterface(); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_lock_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_lock_rpc_server.cc index b85bf09..2951d66 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_lock_rpc_server.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_mouse_lock_rpc_server.cc @@ -2,7 +2,7 @@ // 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_MouseLock_Dev functions. +// SRPC-abstraction wrappers around PPB_MouseLock functions. #include "native_client/src/include/nacl_macros.h" #include "native_client/src/include/nacl_scoped_ptr.h" @@ -11,8 +11,8 @@ #include "native_client/src/shared/ppapi_proxy/browser_globals.h" #include "native_client/src/shared/ppapi_proxy/utility.h" #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_mouse_lock.h" #include "srpcgen/ppb_rpc.h" using ppapi_proxy::DebugPrintf; diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc index 69bdc14..d31de782 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc @@ -27,7 +27,6 @@ #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" #include "native_client/src/trusted/plugin/plugin.h" #include "ppapi/c/dev/ppp_find_dev.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" #include "ppapi/c/dev/ppp_printing_dev.h" #include "ppapi/c/dev/ppp_scrollbar_dev.h" #include "ppapi/c/dev/ppp_selection_dev.h" @@ -36,6 +35,7 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_input_event.h" +#include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/ppb_nacl_private.h" namespace ppapi_proxy { @@ -173,7 +173,7 @@ const void* BrowserPpp::GetPluginInterface(const char* interface_name) { } else if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) { ppp_interface = reinterpret_cast(BrowserMessaging::GetInterface()); - } else if (strcmp(interface_name, PPP_MOUSELOCK_DEV_INTERFACE) == 0) { + } else if (strcmp(interface_name, PPP_MOUSELOCK_INTERFACE) == 0) { ppp_interface = reinterpret_cast(BrowserMouseLock::GetInterface()); } else if (strcmp(interface_name, PPP_INPUT_EVENT_INTERFACE) == 0) { diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.cc index 75cc38c..88cf406 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.cc @@ -29,8 +29,8 @@ void MouseLockLost(PP_Instance instance) { } // namespace -const PPP_MouseLock_Dev* BrowserMouseLock::GetInterface() { - static const PPP_MouseLock_Dev mouse_lock_interface = { +const PPP_MouseLock* BrowserMouseLock::GetInterface() { + static const PPP_MouseLock mouse_lock_interface = { MouseLockLost }; return &mouse_lock_interface; diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h index 94ffffc..c5abff7 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_mouse_lock.h @@ -6,14 +6,14 @@ #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_MOUSE_LOCK_H_ #include "native_client/src/include/nacl_macros.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" +#include "ppapi/c/ppp_mouse_lock.h" namespace ppapi_proxy { -// Implements the trusted side of the PPP_MouseLock_Dev interface. +// Implements the trusted side of the PPP_MouseLock interface. class BrowserMouseLock { public: - static const PPP_MouseLock_Dev* GetInterface(); + static const PPP_MouseLock* GetInterface(); private: NACL_DISALLOW_COPY_AND_ASSIGN(BrowserMouseLock); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc index 79c5b25..8efe062 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.cc @@ -119,9 +119,9 @@ const PPP_Messaging* PPPMessagingInterface() { return static_cast(ppp); } -const PPP_MouseLock_Dev* PPPMouseLockInterface() { - static const void* ppp = GetPluginInterfaceSafe(PPP_MOUSELOCK_DEV_INTERFACE); - return static_cast(ppp); +const PPP_MouseLock* PPPMouseLockInterface() { + static const void* ppp = GetPluginInterfaceSafe(PPP_MOUSELOCK_INTERFACE); + return static_cast(ppp); } const PPP_Printing_Dev* PPPPrintingInterface() { diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h index c3a4665..b470400 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h @@ -7,7 +7,6 @@ #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppp_find_dev.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" #include "ppapi/c/dev/ppp_printing_dev.h" #include "ppapi/c/dev/ppp_scrollbar_dev.h" #include "ppapi/c/dev/ppp_selection_dev.h" @@ -20,6 +19,7 @@ #include "ppapi/c/ppp_input_event.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/ppp_messaging.h" +#include "ppapi/c/ppp_mouse_lock.h" #include "native_client/src/untrusted/irt/irt_ppapi.h" struct NaClSrpcChannel; @@ -63,7 +63,7 @@ const PPP_Find_Dev* PPPFindInterface(); const PPP_InputEvent* PPPInputEventInterface(); const PPP_Instance* PPPInstanceInterface(); const PPP_Messaging* PPPMessagingInterface(); -const PPP_MouseLock_Dev* PPPMouseLockInterface(); +const PPP_MouseLock* PPPMouseLockInterface(); const PPP_Printing_Dev* PPPPrintingInterface(); const PPP_Scrollbar_Dev* PPPScrollbarInterface(); const PPP_Selection_Dev* PPPSelectionInterface(); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc index fa24d45..8c571e2b 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc @@ -74,7 +74,7 @@ InterfaceMapElement interface_map[] = { PluginInputEvent::GetMouseInterface1_0(), true }, { PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1, PluginInputEvent::GetMouseInterface1_1(), true }, - { PPB_MOUSELOCK_DEV_INTERFACE, PluginMouseLock::GetInterface(), true }, + { PPB_MOUSELOCK_INTERFACE, PluginMouseLock::GetInterface(), true }, { PPB_OPENGLES2_INTERFACE, PluginGraphics3D::GetOpenGLESInterface(), true }, { PPB_PDF_INTERFACE, PluginPDF::GetInterface(), true }, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.cc index f528813..d60d2fd 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.cc @@ -8,9 +8,9 @@ #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_mouse_lock_dev.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_mouse_lock.h" #include "srpcgen/ppb_rpc.h" namespace ppapi_proxy { @@ -57,8 +57,8 @@ void UnlockMouse(PP_Instance instance) { } // namespace -const PPB_MouseLock_Dev* PluginMouseLock::GetInterface() { - static const PPB_MouseLock_Dev mouse_lock_interface = { +const PPB_MouseLock* PluginMouseLock::GetInterface() { + static const PPB_MouseLock mouse_lock_interface = { LockMouse, UnlockMouse }; diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h index bb64a72..cd54e01 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h @@ -6,15 +6,15 @@ #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_MOUSE_LOCK_H_ #include "native_client/src/include/nacl_macros.h" -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" +#include "ppapi/c/ppb_mouse_lock.h" namespace ppapi_proxy { -// Implements the untrusted side of the PPB_MouseLock_Dev interface. +// Implements the untrusted side of the PPB_MouseLock interface. class PluginMouseLock { public: PluginMouseLock(); - static const PPB_MouseLock_Dev* GetInterface(); + static const PPB_MouseLock* GetInterface(); private: NACL_DISALLOW_COPY_AND_ASSIGN(PluginMouseLock); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_mouse_lock_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_mouse_lock_rpc_server.cc index 9d5a6dc..da3220d 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_mouse_lock_rpc_server.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_mouse_lock_rpc_server.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// SRPC-abstraction wrappers around PPP_MouseLock_Dev functions. +// SRPC-abstraction wrappers around PPP_MouseLock functions. #include "native_client/src/include/portability.h" #include "native_client/src/include/portability_process.h" #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" #include "native_client/src/shared/ppapi_proxy/utility.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" +#include "ppapi/c/ppp_mouse_lock.h" #include "srpcgen/ppp_rpc.h" using ppapi_proxy::DebugPrintf; diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_lock.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_lock.srpc index 715c748..ffa601c 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_lock.srpc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppb_mouse_lock.srpc @@ -2,8 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # -# RPC methods used to implement PPB_MouseLock_Dev calls from the plugin. -# See ppapi/c/dev/ppb_mouse_lock_dev.h for interface details. +# RPC methods used to implement PPB_MouseLock calls from the plugin. +# See ppapi/c/ppb_mouse_lock.h for interface details. { 'name': 'PpbMouseLockRpc', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_mouse_lock.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_mouse_lock.srpc index da370a5..32f2e34 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_mouse_lock.srpc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_mouse_lock.srpc @@ -2,8 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# RPC methods used to implement PPP_MouseLock_Dev calls to the plugin. -# See ppapi/c/dev/ppp_mouse_lock_dev.h for interface details. +# RPC methods used to implement PPP_MouseLock calls to the plugin. +# See ppapi/c/ppp_mouse_lock.h for interface details. { 'name': 'PppMouseLockRpc', 'rpcs': [ diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index 1648d2e..e67e2c8 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -53,7 +53,6 @@ #include "native_client/src/trusted/service_runtime/nacl_error_code.h" #include "ppapi/c/dev/ppp_find_dev.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" #include "ppapi/c/dev/ppp_printing_dev.h" #include "ppapi/c/dev/ppp_scrollbar_dev.h" #include "ppapi/c/dev/ppp_selection_dev.h" @@ -62,9 +61,9 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppp_input_event.h" #include "ppapi/c/ppp_instance.h" +#include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/ppb_uma_private.h" #include "ppapi/cpp/dev/find_dev.h" -#include "ppapi/cpp/dev/mouse_lock_dev.h" #include "ppapi/cpp/dev/printing_dev.h" #include "ppapi/cpp/dev/scrollbar_dev.h" #include "ppapi/cpp/dev/selection_dev.h" @@ -74,6 +73,7 @@ #include "ppapi/cpp/image_data.h" #include "ppapi/cpp/input_event.h" #include "ppapi/cpp/module.h" +#include "ppapi/cpp/mouse_lock.h" #include "ppapi/cpp/rect.h" using ppapi_proxy::BrowserPpp; @@ -306,17 +306,17 @@ class FindAdapter : public pp::Find_Dev { }; -// Derive a class from pp::MouseLock_Dev to forward PPP_MouseLock_Dev calls to +// Derive a class from pp::MouseLock to forward PPP_MouseLock calls to // the plugin. -class MouseLockAdapter : public pp::MouseLock_Dev { +class MouseLockAdapter : public pp::MouseLock { public: explicit MouseLockAdapter(Plugin* plugin) - : pp::MouseLock_Dev(plugin), + : pp::MouseLock(plugin), plugin_(plugin) { BrowserPpp* proxy = plugin_->ppapi_proxy(); CHECK(proxy != NULL); - ppp_mouse_lock_ = static_cast( - proxy->GetPluginInterface(PPP_MOUSELOCK_DEV_INTERFACE)); + ppp_mouse_lock_ = static_cast( + proxy->GetPluginInterface(PPP_MOUSELOCK_INTERFACE)); } void MouseLockLost() { @@ -326,7 +326,7 @@ class MouseLockAdapter : public pp::MouseLock_Dev { private: Plugin* plugin_; - const PPP_MouseLock_Dev* ppp_mouse_lock_; + const PPP_MouseLock* ppp_mouse_lock_; NACL_DISALLOW_COPY_AND_ASSIGN(MouseLockAdapter); }; diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index 5c528a3..1fde3bf 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -44,7 +44,7 @@ class DescWrapperFactory; namespace pp { class Find_Dev; -class MouseLock_Dev; +class MouseLock; class Printing_Dev; class Selection_Dev; class URLLoader; @@ -532,7 +532,7 @@ class Plugin : public pp::InstancePrivate { // Adapter class constructors require a reference to 'this', so we can't // contain them directly. nacl::scoped_ptr find_adapter_; - nacl::scoped_ptr mouse_lock_adapter_; + nacl::scoped_ptr mouse_lock_adapter_; nacl::scoped_ptr printing_adapter_; nacl::scoped_ptr selection_adapter_; nacl::scoped_ptr widget_client_adapter_; diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc b/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc index efa544e..d1e6d6a 100644 --- a/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc +++ b/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc @@ -31,7 +31,6 @@ #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" #include "ppapi/c/dev/ppb_layer_compositor_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" #include "ppapi/c/dev/ppb_surface_3d_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" @@ -68,7 +67,6 @@ void TestGetDevInterfaces() { PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE) == NULL); CHECK(GetBrowserInterface(PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == NULL); CHECK(GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE) == NULL); - CHECK(GetBrowserInterface(PPB_MOUSELOCK_DEV_INTERFACE) == NULL); CHECK(GetBrowserInterface(PPB_SCROLLBAR_DEV_INTERFACE) == NULL); CHECK(GetBrowserInterface(PPB_SURFACE_3D_DEV_INTERFACE) == NULL); CHECK(GetBrowserInterface(PPB_TESTING_DEV_INTERFACE) == NULL); diff --git a/ppapi/ppapi_cpp.gypi b/ppapi/ppapi_cpp.gypi index 9f5124d..5c7ca07 100644 --- a/ppapi/ppapi_cpp.gypi +++ b/ppapi/ppapi_cpp.gypi @@ -43,6 +43,7 @@ 'c/ppb_input_event.h', 'c/ppb_instance.h', 'c/ppb_messaging.h', + 'c/ppb_mouse_lock.h', 'c/ppb_opengles2.h', 'c/ppb_url_loader.h', 'c/ppb_url_request_info.h', @@ -53,6 +54,7 @@ 'c/ppp_input_event.h', 'c/ppp_instance.h', 'c/ppp_messaging.h', + 'c/ppp_mouse_lock.h', # Dev interfaces. 'c/dev/pp_cursor_type_dev.h', @@ -70,7 +72,6 @@ 'c/dev/ppb_fullscreen_dev.h', 'c/dev/ppb_ime_input_event_dev.h', 'c/dev/ppb_memory_dev.h', - 'c/dev/ppb_mouse_lock_dev.h', 'c/dev/ppb_query_policy_dev.h', 'c/dev/ppb_scrollbar_dev.h', 'c/dev/ppb_surface_3d_dev.h', @@ -81,7 +82,6 @@ 'c/dev/ppb_zoom_dev.h', 'c/dev/ppp_cursor_control_dev.h', 'c/dev/ppp_find_dev.h', - 'c/dev/ppp_mouse_lock_dev.h', 'c/dev/ppp_network_state_dev.h', 'c/dev/ppp_policy_update_dev.h', 'c/dev/ppp_printing_dev.h', @@ -174,6 +174,8 @@ 'cpp/module.cc', 'cpp/module.h', 'cpp/module_impl.h', + 'cpp/mouse_lock.cc', + 'cpp/mouse_lock.h', 'cpp/non_thread_safe_ref_count.h', 'cpp/paint_aggregator.cc', 'cpp/paint_aggregator.h', @@ -215,8 +217,6 @@ 'cpp/dev/ime_input_event_dev.h', 'cpp/dev/memory_dev.cc', 'cpp/dev/memory_dev.h', - 'cpp/dev/mouse_lock_dev.cc', - 'cpp/dev/mouse_lock_dev.h', 'cpp/dev/printing_dev.cc', 'cpp/dev/printing_dev.h', 'cpp/dev/scrollbar_dev.cc', diff --git a/ppapi/proxy/interface_id.h b/ppapi/proxy/interface_id.h index 08ef071..4b5c29e 100644 --- a/ppapi/proxy/interface_id.h +++ b/ppapi/proxy/interface_id.h @@ -53,7 +53,7 @@ enum InterfaceID { INTERFACE_ID_PPP_INSTANCE, INTERFACE_ID_PPP_INSTANCE_PRIVATE, INTERFACE_ID_PPP_MESSAGING, - INTERFACE_ID_PPP_MOUSE_LOCK_DEV, + INTERFACE_ID_PPP_MOUSE_LOCK, INTERFACE_ID_PPP_VIDEO_CAPTURE_DEV, INTERFACE_ID_PPP_VIDEO_DECODER_DEV, diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index fc2c266..351790c 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -16,7 +16,6 @@ #include "ppapi/c/dev/ppb_fullscreen_dev.h" #include "ppapi/c/dev/ppb_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" #include "ppapi/c/dev/ppb_surface_3d_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" @@ -35,6 +34,7 @@ #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/c/ppb_opengles2.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 3b61d1a..9bf77d6 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -399,7 +399,7 @@ IPC_MESSAGE_ROUTED2(PpapiMsg_PPPMessaging_HandleMessage, PP_Instance /* instance */, ppapi::proxy::SerializedVar /* message */) -// PPP_MouseLock_Dev. +// PPP_MouseLock. IPC_MESSAGE_ROUTED1(PpapiMsg_PPPMouseLock_MouseLockLost, PP_Instance /* instance */) diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 1856c82..1a99b47 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -4,11 +4,11 @@ #include "ppapi/proxy/ppb_instance_proxy.h" -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_var.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/proxy/host_dispatcher.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_resource_tracker.h" diff --git a/ppapi/proxy/ppp_mouse_lock_proxy.cc b/ppapi/proxy/ppp_mouse_lock_proxy.cc index e39a914..6983c64 100644 --- a/ppapi/proxy/ppp_mouse_lock_proxy.cc +++ b/ppapi/proxy/ppp_mouse_lock_proxy.cc @@ -4,7 +4,7 @@ #include "ppapi/proxy/ppp_mouse_lock_proxy.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" +#include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/proxy/host_dispatcher.h" #include "ppapi/proxy/ppapi_messages.h" @@ -22,10 +22,10 @@ void MouseLockLost(PP_Instance instance) { } dispatcher->Send(new PpapiMsg_PPPMouseLock_MouseLockLost( - INTERFACE_ID_PPP_MOUSE_LOCK_DEV, instance)); + INTERFACE_ID_PPP_MOUSE_LOCK, instance)); } -static const PPP_MouseLock_Dev mouse_lock_interface = { +static const PPP_MouseLock mouse_lock_interface = { &MouseLockLost }; @@ -38,8 +38,8 @@ InterfaceProxy* CreateMouseLockProxy(Dispatcher* dispatcher) { PPP_MouseLock_Proxy::PPP_MouseLock_Proxy(Dispatcher* dispatcher) : InterfaceProxy(dispatcher) { if (dispatcher->IsPlugin()) { - ppp_mouse_lock_impl_ = static_cast( - dispatcher->local_get_interface()(PPP_MOUSELOCK_DEV_INTERFACE)); + ppp_mouse_lock_impl_ = static_cast( + dispatcher->local_get_interface()(PPP_MOUSELOCK_INTERFACE)); } } @@ -50,8 +50,8 @@ PPP_MouseLock_Proxy::~PPP_MouseLock_Proxy() { const InterfaceProxy::Info* PPP_MouseLock_Proxy::GetInfo() { static const Info info = { &mouse_lock_interface, - PPP_MOUSELOCK_DEV_INTERFACE, - INTERFACE_ID_PPP_MOUSE_LOCK_DEV, + PPP_MOUSELOCK_INTERFACE, + INTERFACE_ID_PPP_MOUSE_LOCK, false, &CreateMouseLockProxy, }; diff --git a/ppapi/proxy/ppp_mouse_lock_proxy.h b/ppapi/proxy/ppp_mouse_lock_proxy.h index 752e97a..75a84f7 100644 --- a/ppapi/proxy/ppp_mouse_lock_proxy.h +++ b/ppapi/proxy/ppp_mouse_lock_proxy.h @@ -8,7 +8,7 @@ #include "ppapi/c/pp_instance.h" #include "ppapi/proxy/interface_proxy.h" -struct PPP_MouseLock_Dev; +struct PPP_MouseLock; namespace ppapi { namespace proxy { @@ -30,7 +30,7 @@ class PPP_MouseLock_Proxy : public InterfaceProxy { // When this proxy is in the plugin side, this value caches the interface // pointer so we don't have to retrieve it from the dispatcher each time. // In the host, this value is always NULL. - const PPP_MouseLock_Dev* ppp_mouse_lock_impl_; + const PPP_MouseLock* ppp_mouse_lock_impl_; DISALLOW_COPY_AND_ASSIGN(PPP_MouseLock_Proxy); }; diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index 516d0d9..b2e69c3 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -26,7 +26,6 @@ #include "ppapi/c/dev/ppb_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_layer_compositor_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" #include "ppapi/c/dev/ppb_query_policy_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" #include "ppapi/c/dev/ppb_surface_3d_dev.h" @@ -42,7 +41,6 @@ #include "ppapi/c/dev/ppp_class_deprecated.h" #include "ppapi/c/dev/ppp_cursor_control_dev.h" #include "ppapi/c/dev/ppp_find_dev.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" #include "ppapi/c/dev/ppp_policy_update_dev.h" #include "ppapi/c/dev/ppp_printing_dev.h" #include "ppapi/c/dev/ppp_scrollbar_dev.h" @@ -81,6 +79,7 @@ #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/c/ppb_opengles2.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" @@ -90,6 +89,7 @@ #include "ppapi/c/ppp_input_event.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/ppp_messaging.h" +#include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/ppb_flash.h" #include "ppapi/c/private/ppb_flash_menu.h" #include "ppapi/c/private/ppb_flash_tcp_socket.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index 5308926..50df529 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -22,7 +22,6 @@ #include "ppapi/cpp/dev/fullscreen_dev.h" #include "ppapi/cpp/dev/ime_input_event_dev.h" #include "ppapi/cpp/dev/memory_dev.h" -#include "ppapi/cpp/dev/mouse_lock_dev.h" #include "ppapi/cpp/dev/printing_dev.h" #include "ppapi/cpp/dev/scriptable_object_deprecated.h" #include "ppapi/cpp/dev/scrollbar_dev.h" @@ -47,6 +46,7 @@ #include "ppapi/cpp/logging.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/mouse_lock.h" #include "ppapi/cpp/non_thread_safe_ref_count.h" #include "ppapi/cpp/paint_aggregator.h" #include "ppapi/cpp/paint_manager.h" diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index 81e4fb9..93ebce9 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -41,8 +41,6 @@ PROXIED_IFACE(PPB_FileChooser, PPB_FILECHOOSER_DEV_INTERFACE_0_5, PROXIED_IFACE(PPB_Font, PPB_FONT_DEV_INTERFACE_0_6, PPB_Font_Dev) PROXIED_IFACE(PPB_Instance, PPB_CHAR_SET_DEV_INTERFACE_0_4, PPB_CharSet_Dev) PROXIED_IFACE(PPB_Instance, PPB_CONSOLE_DEV_INTERFACE, PPB_Console_Dev) -PROXIED_IFACE(PPB_Instance, PPB_MOUSELOCK_DEV_INTERFACE_0_1, - PPB_MouseLock_Dev) UNPROXIED_IFACE(PPB_Instance, PPB_QUERYPOLICY_DEV_INTERFACE_0_1, PPB_QueryPolicy_Dev) PROXIED_IFACE(PPB_Instance, PPB_URLUTIL_DEV_INTERFACE_0_6, PPB_URLUtil_Dev) diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h index 815a2b1..1a91038 100644 --- a/ppapi/thunk/interfaces_ppb_public_stable.h +++ b/ppapi/thunk/interfaces_ppb_public_stable.h @@ -70,6 +70,7 @@ PROXIED_IFACE(NoAPIName, PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0, PPB_WheelInputEvent) PROXIED_IFACE(PPB_Instance, PPB_FULLSCREEN_INTERFACE_1_0, PPB_Fullscreen) PROXIED_IFACE(PPB_Instance, PPB_MESSAGING_INTERFACE_1_0, PPB_Messaging) +PROXIED_IFACE(PPB_Instance, PPB_MOUSELOCK_INTERFACE_1_0, PPB_MouseLock) PROXIED_IFACE(PPB_URLLoader, PPB_URLLOADER_INTERFACE_1_0, PPB_URLLoader) PROXIED_IFACE(NoAPIName, PPB_URLREQUESTINFO_INTERFACE_1_0, PPB_URLRequestInfo) PROXIED_IFACE(PPB_URLResponseInfo, PPB_URLRESPONSEINFO_INTERFACE_1_0, diff --git a/ppapi/thunk/ppb_mouse_lock_thunk.cc b/ppapi/thunk/ppb_mouse_lock_thunk.cc index 3f1d6d3..a26e789 100644 --- a/ppapi/thunk/ppb_mouse_lock_thunk.cc +++ b/ppapi/thunk/ppb_mouse_lock_thunk.cc @@ -2,8 +2,8 @@ // 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/c/ppb_mouse_lock.h" #include "ppapi/thunk/common.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_instance_api.h" @@ -29,14 +29,14 @@ void UnlockMouse(PP_Instance instance) { enter.functions()->UnlockMouse(instance); } -const PPB_MouseLock_Dev g_ppb_mouse_lock_thunk = { +const PPB_MouseLock g_ppb_mouse_lock_thunk = { &LockMouse, &UnlockMouse }; } // namespace -const PPB_MouseLock_Dev* GetPPB_MouseLock_Dev_Thunk() { +const PPB_MouseLock* GetPPB_MouseLock_Thunk() { return &g_ppb_mouse_lock_thunk; } diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 9742f89..f4db023 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -28,7 +28,6 @@ #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" #include "ppapi/c/dev/ppb_layer_compositor_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" -#include "ppapi/c/dev/ppb_mouse_lock_dev.h" #include "ppapi/c/dev/ppb_query_policy_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" #include "ppapi/c/dev/ppb_surface_3d_dev.h" @@ -57,6 +56,7 @@ #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_lock.h" #include "ppapi/c/ppb_opengles2.h" #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index df74b5d..5ec687d 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -18,7 +18,6 @@ #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_zoom_dev.h" #include "ppapi/c/dev/ppp_find_dev.h" -#include "ppapi/c/dev/ppp_mouse_lock_dev.h" #include "ppapi/c/dev/ppp_policy_update_dev.h" #include "ppapi/c/dev/ppp_selection_dev.h" #include "ppapi/c/dev/ppp_zoom_dev.h" @@ -32,6 +31,7 @@ #include "ppapi/c/ppp_input_event.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/ppp_messaging.h" +#include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/ppb_instance_private.h" #include "ppapi/c/private/ppp_instance_private.h" #include "ppapi/shared_impl/input_event_impl.h" @@ -966,8 +966,8 @@ bool PluginInstance::LoadMessagingInterface() { bool PluginInstance::LoadMouseLockInterface() { if (!plugin_mouse_lock_interface_) { plugin_mouse_lock_interface_ = - static_cast(module_->GetPluginInterface( - PPP_MOUSELOCK_DEV_INTERFACE)); + static_cast(module_->GetPluginInterface( + PPP_MOUSELOCK_INTERFACE)); } return !!plugin_mouse_lock_interface_; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index 8cfc5e3d..73a334d 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -42,7 +42,7 @@ struct PPP_Find_Dev; struct PPP_InputEvent; struct PPP_Instance_Private; struct PPP_Messaging; -struct PPP_MouseLock_Dev; +struct PPP_MouseLock; struct PPP_Pdf; struct PPP_PolicyUpdate_Dev; struct PPP_Selection_Dev; @@ -508,7 +508,7 @@ class PluginInstance : public base::RefCounted, // The plugin-provided interfaces. const PPP_Find_Dev* plugin_find_interface_; const PPP_Messaging* plugin_messaging_interface_; - const PPP_MouseLock_Dev* plugin_mouse_lock_interface_; + const PPP_MouseLock* plugin_mouse_lock_interface_; const PPP_InputEvent* plugin_input_event_interface_; const PPP_Instance_Private* plugin_private_interface_; const PPP_Pdf* plugin_pdf_interface_; -- cgit v1.1