Rewrite AndroidSyncSettings to be significantly simpler.
[chromium-blink-merge.git] / remoting / client / plugin / pepper_input_handler.h
blob299077ff10e226d575f73429ea3b01cca62efd2a
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "remoting/protocol/input_stub.h"
11 namespace pp {
12 class InputEvent;
13 } // namespace pp
15 namespace remoting {
17 namespace protocol {
18 class InputStub;
19 } // namespace protocol
21 class PepperInputHandler {
22 public:
23 PepperInputHandler();
25 // Sets the input stub to which processed events will be passed.
26 void set_input_stub(protocol::InputStub* input_stub) {
27 input_stub_ = input_stub;
30 // Enable or disable sending mouse input when the plugin does not have input
31 // focus.
32 void set_send_mouse_input_when_unfocused(bool send) {
33 send_mouse_input_when_unfocused_ = send;
36 void set_send_mouse_move_deltas(bool enable) {
37 send_mouse_move_deltas_ = enable;
40 // Processes PPAPI events and dispatches them to |input_stub_|.
41 bool HandleInputEvent(const pp::InputEvent& event);
43 // Must be called when the plugin receives or loses focus.
44 void DidChangeFocus(bool has_focus);
46 private:
47 // Receives input events generated from PPAPI input.
48 protocol::InputStub* input_stub_;
50 // True if the plugin has focus.
51 bool has_focus_;
53 // True if the plugin should respond to mouse input even if it does not have
54 // keyboard focus.
55 bool send_mouse_input_when_unfocused_;
57 // True if the plugin should include mouse move deltas, in addition to
58 // absolute position information, in mouse events.
59 bool send_mouse_move_deltas_;
61 // Accumulated sub-pixel and sub-tick deltas from wheel events.
62 float wheel_delta_x_;
63 float wheel_delta_y_;
64 float wheel_ticks_x_;
65 float wheel_ticks_y_;
67 DISALLOW_COPY_AND_ASSIGN(PepperInputHandler);
70 } // namespace remoting
72 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_