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

Side by Side 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: feedback 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_ 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_ 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ppapi/cpp/mouse_lock.h"
11 #include "ppapi/cpp/point.h"
12 #include "ppapi/utility/completion_callback_factory.h"
9 #include "remoting/protocol/input_stub.h" 13 #include "remoting/protocol/input_stub.h"
10 14
11 namespace pp { 15 namespace pp {
16 class ImageData;
12 class InputEvent; 17 class InputEvent;
18 class Instance;
13 } // namespace pp 19 } // namespace pp
14 20
15 namespace remoting { 21 namespace remoting {
16 22
17 namespace protocol { 23 namespace protocol {
18 class InputStub; 24 class InputStub;
19 } // namespace protocol 25 } // namespace protocol
20 26
21 class PepperInputHandler { 27 class PepperInputHandler : public pp::MouseLock {
22 public: 28 public:
23 explicit PepperInputHandler(protocol::InputStub* input_stub); 29 // |instance| must outlive |this|.
30 PepperInputHandler(pp::Instance* instance, protocol::InputStub* input_stub);
24 virtual ~PepperInputHandler(); 31 virtual ~PepperInputHandler();
25 32
26 bool HandleInputEvent(const pp::InputEvent& event); 33 bool HandleInputEvent(const pp::InputEvent& event);
27 34
35 // Enables locking the mouse when the host sets a completely transparent mouse
36 // cursor.
37 void AllowMouseLock();
38
39 // Called when the plugin receives or loses focus.
40 void DidChangeFocus(bool has_focus);
41
42 // Sets the mouse cursor image. Passing NULL image will lock the mouse if
43 // mouse lock is enabled.
44 void SetMouseCursor(scoped_ptr<pp::ImageData> image,
45 const pp::Point& hotspot);
46
28 private: 47 private:
48 // pp::MouseLock interface.
49 virtual void MouseLockLost() OVERRIDE;
50
51 // Requests the browser to lock the mouse and hides the cursor.
52 void RequestMouseLock();
53
54 // Requests the browser to cancel mouse lock and restores the cursor once
55 // the lock is gone.
56 void CancelMouseLock();
57
58 // Applies |cursor_image_| as the custom pointer or uses the standard arrow
59 // pointer if |cursor_image_| is not available.
60 void UpdateMouseCursor();
61
62 // Handles completion of the mouse lock request issued by RequestMouseLock().
63 void OnMouseLocked(int error);
64
65 pp::Instance* instance_;
29 protocol::InputStub* input_stub_; 66 protocol::InputStub* input_stub_;
30 67
68 pp::CompletionCallbackFactory<PepperInputHandler> callback_factory_;
69
70 // Custom cursor image sent by the host. |cursor_image_| is set to NULL when
71 // the cursor image is completely transparent. This can be interpreted as
72 // a mouse lock request if enabled by the webapp.
73 scoped_ptr<pp::ImageData> cursor_image_;
74
75 // Hot spot for |cursor_image_|.
76 pp::Point cursor_hotspot_;
77
78 // True if the plugin has focus.
79 bool has_focus_;
80
81 enum MouseLockState {
Wez 2013/09/07 01:11:25 nit: This belongs at the top of the private sectio
alexeypa (please no reviews) 2013/09/09 18:29:46 Done.
82 MouseLockDisallowed,
83 MouseLockOff,
84 MouseLockRequestPending,
85 MouseLockOn,
86 MouseLockCancelling
87 };
88
89 MouseLockState mouse_lock_state_;
90
31 // Accumulated sub-pixel and sub-tick deltas from wheel events. 91 // Accumulated sub-pixel and sub-tick deltas from wheel events.
32 float wheel_delta_x_; 92 float wheel_delta_x_;
33 float wheel_delta_y_; 93 float wheel_delta_y_;
34 float wheel_ticks_x_; 94 float wheel_ticks_x_;
35 float wheel_ticks_y_; 95 float wheel_ticks_y_;
36 96
37 DISALLOW_COPY_AND_ASSIGN(PepperInputHandler); 97 DISALLOW_COPY_AND_ASSIGN(PepperInputHandler);
38 }; 98 };
39 99
40 } // namespace remoting 100 } // namespace remoting
41 101
42 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_ 102 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
OLDNEW
« 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