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

Unified Diff: remoting/client/plugin/pepper_input_handler.h

Issue 23484015: Added support of relative mouse motion in Chromoting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback and rebased Created 7 years, 3 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
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | remoting/client/plugin/pepper_input_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/pepper_input_handler.h
diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h
index 0e63e0f10e90471edd0bc016d08f82bd2e36c9ec..c72243e5a0e8f924413a279533c2f56be4ff53a3 100644
--- a/remoting/client/plugin/pepper_input_handler.h
+++ b/remoting/client/plugin/pepper_input_handler.h
@@ -6,10 +6,16 @@
#define REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "ppapi/cpp/mouse_lock.h"
+#include "ppapi/cpp/point.h"
+#include "ppapi/utility/completion_callback_factory.h"
#include "remoting/protocol/input_stub.h"
namespace pp {
+class ImageData;
class InputEvent;
+class Instance;
} // namespace pp
namespace remoting {
@@ -18,16 +24,70 @@ namespace protocol {
class InputStub;
} // namespace protocol
-class PepperInputHandler {
+class PepperInputHandler : public pp::MouseLock {
public:
- explicit PepperInputHandler(protocol::InputStub* input_stub);
+ // |instance| must outlive |this|.
+ PepperInputHandler(pp::Instance* instance, protocol::InputStub* input_stub);
virtual ~PepperInputHandler();
bool HandleInputEvent(const pp::InputEvent& event);
+ // Enables locking the mouse when the host sets a completely transparent mouse
+ // cursor.
+ void AllowMouseLock();
+
+ // Called when the plugin receives or loses focus.
+ void DidChangeFocus(bool has_focus);
+
+ // Sets the mouse cursor image. Passing NULL image will lock the mouse if
+ // mouse lock is enabled.
+ void SetMouseCursor(scoped_ptr<pp::ImageData> image,
+ const pp::Point& hotspot);
+
private:
+ enum MouseLockState {
+ MouseLockDisallowed,
+ MouseLockOff,
+ MouseLockRequestPending,
+ MouseLockOn,
+ MouseLockCancelling
+ };
+
+ // pp::MouseLock interface.
+ virtual void MouseLockLost() OVERRIDE;
+
+ // Requests the browser to lock the mouse and hides the cursor.
+ void RequestMouseLock();
+
+ // Requests the browser to cancel mouse lock and restores the cursor once
+ // the lock is gone.
+ void CancelMouseLock();
+
+ // Applies |cursor_image_| as the custom pointer or uses the standard arrow
+ // pointer if |cursor_image_| is not available.
+ void UpdateMouseCursor();
+
+ // Handles completion of the mouse lock request issued by RequestMouseLock().
+ void OnMouseLocked(int error);
+
+ pp::Instance* instance_;
protocol::InputStub* input_stub_;
+ pp::CompletionCallbackFactory<PepperInputHandler> callback_factory_;
+
+ // Custom cursor image sent by the host. |cursor_image_| is set to NULL when
+ // the cursor image is completely transparent. This can be interpreted as
+ // a mouse lock request if enabled by the webapp.
+ scoped_ptr<pp::ImageData> cursor_image_;
+
+ // Hot spot for |cursor_image_|.
+ pp::Point cursor_hotspot_;
+
+ // True if the plugin has focus.
+ bool has_focus_;
+
+ MouseLockState mouse_lock_state_;
+
// Accumulated sub-pixel and sub-tick deltas from wheel events.
float wheel_delta_x_;
float wheel_delta_y_;
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | remoting/client/plugin/pepper_input_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698