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_LOCAL_INPUT_MONITOR_H_ | 5 #ifndef REMOTING_HOST_LOCAL_INPUT_MONITOR_H_ |
6 #define REMOTING_HOST_LOCAL_INPUT_MONITOR_H_ | 6 #define REMOTING_HOST_LOCAL_INPUT_MONITOR_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "remoting/host/session_controller.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 class SingleThreadTaskRunner; | 14 class SingleThreadTaskRunner; |
14 } // namespace base | 15 } // namespace base |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 | 18 |
18 class MouseMoveObserver; | 19 // Monitors the local input to notify about mouse movements. On Mac and Linux |
19 | 20 // catches the disconnection keyboard shortcut (Ctlr-Alt-Esc) and invokes |
20 class LocalInputMonitor { | 21 // SessionController::Delegate::DisconnectSession() when this key combination is |
| 22 // pressed. |
| 23 // |
| 24 // TODO(sergeyu): Refactor shortcut code to a separate class. |
| 25 class LocalInputMonitor : public SessionController { |
21 public: | 26 public: |
22 virtual ~LocalInputMonitor() {} | 27 virtual ~LocalInputMonitor() {} |
23 | 28 |
24 // Starts local input monitoring. This class is also responsible for | 29 // Creates a platform-specific instance of LocalInputMonitor. |
25 // of catching the disconnection keyboard shortcut on Mac and Linux | |
26 // (Ctlr-Alt-Esc). The |disconnect_callback| is called when this key | |
27 // combination is pressed. | |
28 // | |
29 // TODO(sergeyu): Refactor shortcut code to a separate class. | |
30 virtual void Start(MouseMoveObserver* mouse_move_observer, | |
31 const base::Closure& disconnect_callback) = 0; | |
32 virtual void Stop() = 0; | |
33 | |
34 static scoped_ptr<LocalInputMonitor> Create( | 30 static scoped_ptr<LocalInputMonitor> Create( |
35 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 31 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
36 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 32 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
37 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 33 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 34 SessionController::Delegate* delegate); |
| 35 |
| 36 protected: |
| 37 LocalInputMonitor() {} |
38 }; | 38 }; |
39 | 39 |
40 } // namespace remoting | 40 } // namespace remoting |
41 | 41 |
42 #endif // REMOTING_HOST_LOCAL_INPUT_MONITOR_H_ | 42 #endif // REMOTING_HOST_LOCAL_INPUT_MONITOR_H_ |
OLD | NEW |