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