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_WIN_SESSION_EVENT_EXECUTOR_H_ | 5 #ifndef REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ |
6 #define REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ | 6 #define REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "remoting/host/event_executor.h" | 14 #include "remoting/host/event_executor.h" |
14 #include "remoting/host/win/scoped_thread_desktop.h" | 15 #include "remoting/host/win/scoped_thread_desktop.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; |
18 } // namespace base | 19 } // namespace base |
19 | 20 |
20 namespace remoting { | 21 namespace remoting { |
21 | 22 |
22 class SasInjector; | 23 class SasInjector; |
23 | 24 |
| 25 // Monitors and passes key/mouse events to a nested event executor. Injects |
| 26 // Secure Attention Sequence (SAS) when Ctrl+Alt+Del key combination has been |
| 27 // detected. |
24 class SessionEventExecutorWin : public EventExecutor { | 28 class SessionEventExecutorWin : public EventExecutor { |
25 public: | 29 public: |
| 30 // |inject_sas| is invoked on |inject_sas_task_runner| to generate SAS on |
| 31 // Vista+. |
26 SessionEventExecutorWin( | 32 SessionEventExecutorWin( |
27 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 33 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
28 scoped_ptr<EventExecutor> nested_executor); | 34 scoped_ptr<EventExecutor> nested_executor, |
| 35 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, |
| 36 const base::Closure& inject_sas); |
29 ~SessionEventExecutorWin(); | 37 ~SessionEventExecutorWin(); |
30 | 38 |
31 // EventExecutor implementation. | 39 // EventExecutor implementation. |
32 virtual void Start( | 40 virtual void Start( |
33 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; | 41 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; |
34 virtual void StopAndDelete() OVERRIDE; | 42 virtual void StopAndDelete() OVERRIDE; |
35 | 43 |
36 // protocol::ClipboardStub implementation. | 44 // protocol::ClipboardStub implementation. |
37 virtual void InjectClipboardEvent( | 45 virtual void InjectClipboardEvent( |
38 const protocol::ClipboardEvent& event) OVERRIDE; | 46 const protocol::ClipboardEvent& event) OVERRIDE; |
39 | 47 |
40 // protocol::InputStub implementation. | 48 // protocol::InputStub implementation. |
41 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 49 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
42 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 50 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
43 | 51 |
44 private: | 52 private: |
45 // Switches to the desktop receiving a user input if different from | 53 // Switches to the desktop receiving a user input if different from |
46 // the current one. | 54 // the current one. |
47 void SwitchToInputDesktop(); | 55 void SwitchToInputDesktop(); |
48 | 56 |
| 57 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
| 58 |
49 // Pointer to the next event executor. | 59 // Pointer to the next event executor. |
50 scoped_ptr<EventExecutor> nested_executor_; | 60 scoped_ptr<EventExecutor> nested_executor_; |
51 | 61 |
52 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 62 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner_; |
53 | 63 |
54 ScopedThreadDesktop desktop_; | 64 ScopedThreadDesktop desktop_; |
55 | 65 |
| 66 // Used to inject Secure Attention Sequence on Vista+. |
| 67 base::Closure inject_sas_; |
| 68 |
| 69 // Used to inject Secure Attention Sequence on XP. |
56 scoped_ptr<SasInjector> sas_injector_; | 70 scoped_ptr<SasInjector> sas_injector_; |
57 | 71 |
58 // Keys currently pressed by the client, used to detect Ctrl-Alt-Del. | 72 // Keys currently pressed by the client, used to detect Ctrl-Alt-Del. |
59 std::set<uint32> pressed_keys_; | 73 std::set<uint32> pressed_keys_; |
60 | 74 |
61 base::WeakPtrFactory<SessionEventExecutorWin> weak_ptr_factory_; | 75 base::WeakPtrFactory<SessionEventExecutorWin> weak_ptr_factory_; |
62 base::WeakPtr<SessionEventExecutorWin> weak_ptr_; | 76 base::WeakPtr<SessionEventExecutorWin> weak_ptr_; |
63 | 77 |
64 DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); | 78 DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); |
65 }; | 79 }; |
66 | 80 |
67 } // namespace remoting | 81 } // namespace remoting |
68 | 82 |
69 #endif // REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ | 83 #endif // REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ |
OLD | NEW |