OLD | NEW |
---|---|
(Empty) | |
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_HOST_REMOTE_INPUT_FILTER_H_ | |
6 #define REMOTING_HOST_REMOTE_INPUT_FILTER_H_ | |
7 | |
8 #include <list> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "base/time.h" | |
13 #include "remoting/protocol/input_event_tracker.h" | |
14 #include "remoting/protocol/input_stub.h" | |
15 #include "third_party/skia/include/core/SkPoint.h" | |
16 | |
17 namespace remoting { | |
18 | |
19 // Filtering InputStub that filters remotely-injected input if it has been | |
20 // notified of local input recently. | |
21 class RemoteInputFilter : public protocol::InputStub { | |
22 public: | |
23 // Creates a filter forwarding events to the specified InputEventTracker. | |
24 // The filter needs a tracker to release buttons & keys when blocking input. | |
25 RemoteInputFilter(protocol::InputEventTracker* event_tracker); | |
26 virtual ~RemoteInputFilter(); | |
27 | |
28 // Informs the filter than local mouse activity has been detected. If local | |
29 // the activity does not match events we injected then we assume that it is | |
30 // local, and block remote input for a short while. | |
Jamie
2012/03/15 18:38:56
You might want to re-read this comment :)
Wez
2012/03/15 22:25:29
Done.
| |
31 void LocalMouseMoved(const SkIPoint& mouse_pos); | |
32 | |
33 // InputStub overrides. | |
34 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | |
35 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | |
36 | |
37 private: | |
38 bool ShouldIgnoreInput() const; | |
39 | |
40 protocol::InputEventTracker* event_tracker_; | |
41 | |
42 // Queue of recently-injected mouse positions used to distinguish echos of | |
Jamie
2012/03/15 18:38:56
s/echos/echoes/
Wez
2012/03/15 22:25:29
Done.
| |
43 // injected events from movements from a local input device. | |
44 std::list<SkIPoint> injected_mouse_positions_; | |
45 | |
46 // Time at which local input events were most recently observed. | |
47 base::TimeTicks latest_local_input_time_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(RemoteInputFilter); | |
50 }; | |
51 | |
52 } // namespace remoting | |
53 | |
54 #endif // REMOTING_HOST_REMOTE_INPUT_FILTER_H_ | |
OLD | NEW |