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_HOST_MOUSE_CLAMPING_FILTER_H_ | 5 #ifndef REMOTING_HOST_MOUSE_CLAMPING_FILTER_H_ |
6 #define REMOTING_HOST_MOUSE_CLAMPING_FILTER_H_ | 6 #define REMOTING_HOST_MOUSE_CLAMPING_FILTER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "remoting/protocol/mouse_input_filter.h" | 9 #include "remoting/protocol/mouse_input_filter.h" |
10 #include "remoting/protocol/video_stub.h" | |
11 | 10 |
12 namespace remoting { | 11 namespace remoting { |
13 | 12 |
14 // Filtering VideoStub implementation which configures a MouseInputFilter to | 13 class VideoFrameCapturer; |
15 // clamp mouse events to fall within the dimensions of the most-recently | 14 |
16 // received video frame. | 15 // Filtering InputStub implementation which clamps mouse each mouse event to |
17 class MouseClampingFilter : public protocol::VideoStub { | 16 // the current dimensions of a VideoFrameCapturer instance before passing |
| 17 // them on to the target |input_stub|. |
| 18 class MouseClampingFilter : public protocol::MouseInputFilter { |
18 public: | 19 public: |
19 MouseClampingFilter(protocol::InputStub* input_stub, | 20 MouseClampingFilter(VideoFrameCapturer* capturer, |
20 protocol::VideoStub* video_stub); | 21 protocol::InputStub* input_stub); |
21 virtual ~MouseClampingFilter(); | 22 virtual ~MouseClampingFilter(); |
22 | 23 |
23 protocol::InputStub* input_filter() { return &input_filter_; } | 24 // InputStub overrides. |
24 | 25 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
25 // protocol::VideoStub implementation. | |
26 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, | |
27 const base::Closure& done) OVERRIDE; | |
28 | 26 |
29 private: | 27 private: |
30 // Clamps mouse event coordinates to the video dimensions. | 28 VideoFrameCapturer* capturer_; |
31 protocol::MouseInputFilter input_filter_; | |
32 | |
33 protocol::VideoStub* video_stub_; | |
34 | 29 |
35 DISALLOW_COPY_AND_ASSIGN(MouseClampingFilter); | 30 DISALLOW_COPY_AND_ASSIGN(MouseClampingFilter); |
36 }; | 31 }; |
37 | 32 |
38 } // namespace remoting | 33 } // namespace remoting |
39 | 34 |
40 #endif // REMOTING_HOST_MOUSE_CLAMPING_FILTER_H_ | 35 #endif // REMOTING_HOST_MOUSE_CLAMPING_FILTER_H_ |
OLD | NEW |