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 |
24 class SessionEventExecutorWin : public EventExecutor { | 25 class SessionEventExecutorWin : public EventExecutor { |
25 public: | 26 public: |
26 SessionEventExecutorWin( | 27 SessionEventExecutorWin( |
27 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 28 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
28 scoped_ptr<EventExecutor> nested_executor); | 29 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
Wez
2012/11/01 20:12:21
nit: sas_task_runner; the fact it's a UI TaskRunne
alexeypa (please no reviews)
2012/11/01 20:56:12
Done.
| |
30 scoped_ptr<EventExecutor> nested_executor, | |
31 const base::Closure& inject_sas); | |
Wez
2012/11/01 20:12:21
nit: Add a comment explaining that |inject_sas| wi
Wez
2012/11/01 20:12:21
nit: Pass the SAS TaskRunner and inject-SAS closur
alexeypa (please no reviews)
2012/11/01 20:56:12
Done.
alexeypa (please no reviews)
2012/11/01 20:56:12
Done.
| |
29 ~SessionEventExecutorWin(); | 32 ~SessionEventExecutorWin(); |
30 | 33 |
31 // EventExecutor implementation. | 34 // EventExecutor implementation. |
32 virtual void Start( | 35 virtual void Start( |
33 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; | 36 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; |
34 virtual void StopAndDelete() OVERRIDE; | 37 virtual void StopAndDelete() OVERRIDE; |
35 | 38 |
36 // protocol::ClipboardStub implementation. | 39 // protocol::ClipboardStub implementation. |
37 virtual void InjectClipboardEvent( | 40 virtual void InjectClipboardEvent( |
38 const protocol::ClipboardEvent& event) OVERRIDE; | 41 const protocol::ClipboardEvent& event) OVERRIDE; |
39 | 42 |
40 // protocol::InputStub implementation. | 43 // protocol::InputStub implementation. |
41 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 44 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
42 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 45 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
43 | 46 |
44 private: | 47 private: |
45 // Switches to the desktop receiving a user input if different from | 48 // Switches to the desktop receiving a user input if different from |
46 // the current one. | 49 // the current one. |
47 void SwitchToInputDesktop(); | 50 void SwitchToInputDesktop(); |
48 | 51 |
49 // Pointer to the next event executor. | 52 // Pointer to the next event executor. |
50 scoped_ptr<EventExecutor> nested_executor_; | 53 scoped_ptr<EventExecutor> nested_executor_; |
51 | 54 |
52 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 55 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
56 | |
57 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | |
Wez
2012/11/01 20:12:21
nit: Consider re-ordering these wrt |nested_execut
alexeypa (please no reviews)
2012/11/01 20:56:12
Done.
| |
53 | 58 |
54 ScopedThreadDesktop desktop_; | 59 ScopedThreadDesktop desktop_; |
55 | 60 |
61 // Used to inject Secure Attention Sequence on Vista+. | |
62 base::Closure inject_sas_; | |
63 | |
64 // Used to inject Secure Attention Sequence on XP. | |
56 scoped_ptr<SasInjector> sas_injector_; | 65 scoped_ptr<SasInjector> sas_injector_; |
57 | 66 |
58 // Keys currently pressed by the client, used to detect Ctrl-Alt-Del. | 67 // Keys currently pressed by the client, used to detect Ctrl-Alt-Del. |
59 std::set<uint32> pressed_keys_; | 68 std::set<uint32> pressed_keys_; |
60 | 69 |
61 base::WeakPtrFactory<SessionEventExecutorWin> weak_ptr_factory_; | 70 base::WeakPtrFactory<SessionEventExecutorWin> weak_ptr_factory_; |
62 base::WeakPtr<SessionEventExecutorWin> weak_ptr_; | 71 base::WeakPtr<SessionEventExecutorWin> weak_ptr_; |
63 | 72 |
64 DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); | 73 DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); |
65 }; | 74 }; |
66 | 75 |
67 } // namespace remoting | 76 } // namespace remoting |
68 | 77 |
69 #endif // REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ | 78 #endif // REMOTING_HOST_WIN_SESSION_EVENT_EXECUTOR_H_ |
OLD | NEW |