| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_MOUSE_INPUT_FILTER_H_ | 5 #ifndef REMOTING_CLIENT_MOUSE_INPUT_FILTER_H_ |
| 6 #define REMOTING_CLIENT_MOUSE_INPUT_FILTER_H_ | 6 #define REMOTING_CLIENT_MOUSE_INPUT_FILTER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "remoting/protocol/input_stub.h" | 10 #include "remoting/protocol/input_stub.h" |
| 11 #include "third_party/skia/include/core/SkTypes.h" | 11 #include "third_party/skia/include/core/SkTypes.h" |
| 12 #include "third_party/skia/include/core/SkSize.h" | 12 #include "third_party/skia/include/core/SkSize.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 | 15 |
| 16 // Filtering InputStub implementation which scales mouse events based on the | 16 // Filtering InputStub implementation which scales mouse events based on the |
| 17 // supplied input and output dimensions, and clamps their coordinates to the | 17 // supplied input and output dimensions, and clamps their coordinates to the |
| 18 // output dimensions, before passing events on to |input_stub|. | 18 // output dimensions, before passing events on to |input_stub|. |
| 19 class MouseInputFilter : public protocol::InputStub { | 19 class MouseInputFilter : public protocol::InputStub { |
| 20 public: | 20 public: |
| 21 MouseInputFilter(protocol::InputStub* input_stub); | 21 explicit MouseInputFilter(protocol::InputStub* input_stub); |
| 22 virtual ~MouseInputFilter(); | 22 virtual ~MouseInputFilter(); |
| 23 | 23 |
| 24 // Specify the input dimensions for mouse events. | 24 // Specify the input dimensions for mouse events. |
| 25 void set_input_size(const SkISize& size); | 25 void set_input_size(const SkISize& size); |
| 26 | 26 |
| 27 // Specify the output dimensions. | 27 // Specify the output dimensions. |
| 28 void set_output_size(const SkISize& size); | 28 void set_output_size(const SkISize& size); |
| 29 | 29 |
| 30 // InputStub interface. | 30 // InputStub interface. |
| 31 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 31 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
| 32 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 32 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 protocol::InputStub* input_stub_; | 35 protocol::InputStub* input_stub_; |
| 36 | 36 |
| 37 SkISize input_max_; | 37 SkISize input_max_; |
| 38 SkISize output_max_; | 38 SkISize output_max_; |
| 39 | 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(MouseInputFilter); | 40 DISALLOW_COPY_AND_ASSIGN(MouseInputFilter); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace remoting | 43 } // namespace remoting |
| 44 | 44 |
| 45 #endif // REMOTING_CLIENT_MOUSE_INPUT_FILTER_H_ | 45 #endif // REMOTING_CLIENT_MOUSE_INPUT_FILTER_H_ |
| OLD | NEW |