pepper_input_handler.h revision 90dce4d38c5ff5333bea97d859d4e484e27edf0c
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.
4
5#ifndef REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
6#define REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
7
8#include "base/compiler_specific.h"
9#include "remoting/protocol/input_stub.h"
10
11namespace pp {
12class InputEvent;
13}  // namespace pp
14
15namespace remoting {
16
17namespace protocol {
18class InputStub;
19} // namespace protocol
20
21class PepperInputHandler {
22 public:
23  explicit PepperInputHandler(protocol::InputStub* input_stub);
24  virtual ~PepperInputHandler();
25
26  // Called by ChromotingInstance::DidChangeFocus when the instance
27  // goes in or out of focus. Sets or clears the has_focus_ flag
28  // which controls whether the client passes mouse and wheel
29  // events to the remoting server.
30  void OnFocusChanged(bool has_focus);
31
32  bool HandleInputEvent(const pp::InputEvent& event);
33
34 private:
35  protocol::InputStub* input_stub_;
36
37  // Flag indicating whether the calling plugin has focus.
38  bool has_focus_;
39
40  // Accumulated sub-pixel deltas from wheel events.
41  float wheel_delta_x_;
42  float wheel_delta_y_;
43
44  DISALLOW_COPY_AND_ASSIGN(PepperInputHandler);
45};
46
47}  // namespace remoting
48
49#endif  // REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
50