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_SESSION_EVENT_EXECUTOR_WIN_H_ | 5 #ifndef REMOTING_HOST_SESSION_EVENT_EXECUTOR_WIN_H_ |
6 #define REMOTING_HOST_SESSION_EVENT_EXECUTOR_WIN_H_ | 6 #define REMOTING_HOST_SESSION_EVENT_EXECUTOR_WIN_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_channel.h" |
14 | 14 |
15 #include "remoting/host/event_executor.h" | 15 #include "remoting/host/event_executor.h" |
16 #include "remoting/host/scoped_thread_desktop_win.h" | 16 #include "remoting/host/scoped_thread_desktop_win.h" |
17 #include "remoting/protocol/host_event_stub.h" | 17 #include "remoting/protocol/host_event_stub.h" |
18 | 18 |
19 class MessageLoop; | |
20 | |
21 namespace base { | 19 namespace base { |
22 class MessageLoopProxy; | 20 class SingleThreadTaskRunner; |
23 } // namespace base | 21 } // namespace base |
24 | 22 |
25 namespace IPC { | 23 namespace IPC { |
26 class ChannelProxy; | 24 class ChannelProxy; |
27 } // namespace IPC | 25 } // namespace IPC |
28 | 26 |
29 namespace remoting { | 27 namespace remoting { |
30 | 28 |
31 class SessionEventExecutorWin : public EventExecutor, | 29 class SessionEventExecutorWin : public EventExecutor, |
32 public IPC::Listener { | 30 public IPC::Listener { |
33 public: | 31 public: |
34 SessionEventExecutorWin(MessageLoop* message_loop, | 32 SessionEventExecutorWin( |
35 base::MessageLoopProxy* io_message_loop, | 33 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
36 scoped_ptr<EventExecutor> nested_executor); | 34 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 35 scoped_ptr<EventExecutor> nested_executor); |
37 ~SessionEventExecutorWin(); | 36 ~SessionEventExecutorWin(); |
38 | 37 |
39 // EventExecutor implementation. | 38 // EventExecutor implementation. |
40 virtual void OnSessionStarted( | 39 virtual void OnSessionStarted( |
41 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; | 40 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; |
42 virtual void OnSessionFinished() OVERRIDE; | 41 virtual void OnSessionFinished() OVERRIDE; |
43 | 42 |
44 // protocol::HostStub implementation. | 43 // protocol::HostStub implementation. |
45 virtual void InjectClipboardEvent( | 44 virtual void InjectClipboardEvent( |
46 const protocol::ClipboardEvent& event) OVERRIDE; | 45 const protocol::ClipboardEvent& event) OVERRIDE; |
47 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 46 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
48 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 47 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
49 | 48 |
50 // IPC::Listener implementation. | 49 // IPC::Listener implementation. |
51 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
52 | 51 |
53 private: | 52 private: |
54 // Switches to the desktop receiving a user input if different from | 53 // Switches to the desktop receiving a user input if different from |
55 // the current one. | 54 // the current one. |
56 void SwitchToInputDesktop(); | 55 void SwitchToInputDesktop(); |
57 | 56 |
58 // Pointer to the next event executor. | 57 // Pointer to the next event executor. |
59 scoped_ptr<EventExecutor> nested_executor_; | 58 scoped_ptr<EventExecutor> nested_executor_; |
60 | 59 |
61 MessageLoop* message_loop_; | 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
62 | 61 |
63 ScopedThreadDesktopWin desktop_; | 62 ScopedThreadDesktopWin desktop_; |
64 | 63 |
65 // The Chromoting IPC channel connecting the host with the service. | 64 // The Chromoting IPC channel connecting the host with the service. |
66 scoped_ptr<IPC::ChannelProxy> chromoting_channel_; | 65 scoped_ptr<IPC::ChannelProxy> chromoting_channel_; |
67 | 66 |
68 // 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. |
69 std::set<uint32> pressed_keys_; | 68 std::set<uint32> pressed_keys_; |
70 | 69 |
71 base::WeakPtrFactory<SessionEventExecutorWin> weak_ptr_factory_; | 70 base::WeakPtrFactory<SessionEventExecutorWin> weak_ptr_factory_; |
72 base::WeakPtr<SessionEventExecutorWin> weak_ptr_; | 71 base::WeakPtr<SessionEventExecutorWin> weak_ptr_; |
73 | 72 |
74 DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); | 73 DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); |
75 }; | 74 }; |
76 | 75 |
77 } // namespace remoting | 76 } // namespace remoting |
78 | 77 |
79 #endif // REMOTING_HOST_SESSION_EVENT_EXECUTOR_WIN_H_ | 78 #endif // REMOTING_HOST_SESSION_EVENT_EXECUTOR_WIN_H_ |
OLD | NEW |