OLD | NEW |
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" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ppapi/cpp/mouse_lock.h" | 10 #include "ppapi/cpp/mouse_lock.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 void AllowMouseLock(); | 41 void AllowMouseLock(); |
42 | 42 |
43 // Called when the plugin receives or loses focus. | 43 // Called when the plugin receives or loses focus. |
44 void DidChangeFocus(bool has_focus); | 44 void DidChangeFocus(bool has_focus); |
45 | 45 |
46 // Sets the mouse cursor image. Passing NULL image will lock the mouse if | 46 // Sets the mouse cursor image. Passing NULL image will lock the mouse if |
47 // mouse lock is enabled. | 47 // mouse lock is enabled. |
48 void SetMouseCursor(scoped_ptr<pp::ImageData> image, | 48 void SetMouseCursor(scoped_ptr<pp::ImageData> image, |
49 const pp::Point& hotspot); | 49 const pp::Point& hotspot); |
50 | 50 |
| 51 // Enable or disable sending mouse input when the plugin does not have input |
| 52 // focus. |
| 53 void set_send_mouse_input_when_unfocused(bool send) { |
| 54 send_mouse_input_when_unfocused_ = send; |
| 55 } |
| 56 |
51 private: | 57 private: |
52 enum MouseLockState { | 58 enum MouseLockState { |
53 MouseLockDisallowed, | 59 MouseLockDisallowed, |
54 MouseLockOff, | 60 MouseLockOff, |
55 MouseLockRequestPending, | 61 MouseLockRequestPending, |
56 MouseLockOn, | 62 MouseLockOn, |
57 MouseLockCancelling | 63 MouseLockCancelling |
58 }; | 64 }; |
59 | 65 |
60 // pp::MouseLock interface. | 66 // pp::MouseLock interface. |
(...skipping 22 matching lines...) Expand all Loading... |
83 // the cursor image is completely transparent. This can be interpreted as | 89 // the cursor image is completely transparent. This can be interpreted as |
84 // a mouse lock request if enabled by the webapp. | 90 // a mouse lock request if enabled by the webapp. |
85 scoped_ptr<pp::ImageData> cursor_image_; | 91 scoped_ptr<pp::ImageData> cursor_image_; |
86 | 92 |
87 // Hot spot for |cursor_image_|. | 93 // Hot spot for |cursor_image_|. |
88 pp::Point cursor_hotspot_; | 94 pp::Point cursor_hotspot_; |
89 | 95 |
90 // True if the plugin has focus. | 96 // True if the plugin has focus. |
91 bool has_focus_; | 97 bool has_focus_; |
92 | 98 |
| 99 // True if the plugin should respond to mouse input even if it does not have |
| 100 // keyboard focus. |
| 101 bool send_mouse_input_when_unfocused_; |
| 102 |
93 MouseLockState mouse_lock_state_; | 103 MouseLockState mouse_lock_state_; |
94 | 104 |
95 // Accumulated sub-pixel and sub-tick deltas from wheel events. | 105 // Accumulated sub-pixel and sub-tick deltas from wheel events. |
96 float wheel_delta_x_; | 106 float wheel_delta_x_; |
97 float wheel_delta_y_; | 107 float wheel_delta_y_; |
98 float wheel_ticks_x_; | 108 float wheel_ticks_x_; |
99 float wheel_ticks_y_; | 109 float wheel_ticks_y_; |
100 | 110 |
101 DISALLOW_COPY_AND_ASSIGN(PepperInputHandler); | 111 DISALLOW_COPY_AND_ASSIGN(PepperInputHandler); |
102 }; | 112 }; |
103 | 113 |
104 } // namespace remoting | 114 } // namespace remoting |
105 | 115 |
106 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_ | 116 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_ |
OLD | NEW |