| 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" | |
| 14 #include "remoting/host/event_executor.h" | 13 #include "remoting/host/event_executor.h" |
| 15 #include "remoting/host/win/scoped_thread_desktop.h" | 14 #include "remoting/host/win/scoped_thread_desktop.h" |
| 16 | 15 |
| 17 namespace base { | 16 namespace base { |
| 18 class SingleThreadTaskRunner; | 17 class SingleThreadTaskRunner; |
| 19 } // namespace base | 18 } // namespace base |
| 20 | 19 |
| 21 namespace IPC { | 20 namespace IPC { |
| 22 class ChannelProxy; | 21 class ChannelProxy; |
| 23 } // namespace IPC | 22 } // namespace IPC |
| 24 | 23 |
| 25 namespace remoting { | 24 namespace remoting { |
| 26 | 25 |
| 27 class SessionEventExecutorWin : public EventExecutor, | 26 class SessionEventExecutorWin : public EventExecutor { |
| 28 public IPC::Listener { | |
| 29 public: | 27 public: |
| 28 // |daemon_channel| must outlive this object. |
| 30 SessionEventExecutorWin( | 29 SessionEventExecutorWin( |
| 31 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 30 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 32 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 31 IPC::ChannelProxy* daemon_channel, |
| 33 scoped_ptr<EventExecutor> nested_executor); | 32 scoped_ptr<EventExecutor> nested_executor); |
| 34 ~SessionEventExecutorWin(); | 33 ~SessionEventExecutorWin(); |
| 35 | 34 |
| 36 // EventExecutor implementation. | 35 // EventExecutor implementation. |
| 37 virtual void OnSessionStarted( | 36 virtual void OnSessionStarted( |
| 38 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; | 37 scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; |
| 39 virtual void OnSessionFinished() OVERRIDE; | 38 virtual void OnSessionFinished() OVERRIDE; |
| 40 | 39 |
| 41 // protocol::ClipboardStub implementation. | 40 // protocol::ClipboardStub implementation. |
| 42 virtual void InjectClipboardEvent( | 41 virtual void InjectClipboardEvent( |
| 43 const protocol::ClipboardEvent& event) OVERRIDE; | 42 const protocol::ClipboardEvent& event) OVERRIDE; |
| 44 | 43 |
| 45 // protocol::InputStub implementation. | 44 // protocol::InputStub implementation. |
| 46 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 45 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
| 47 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 46 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
| 48 | 47 |
| 49 // IPC::Listener implementation. | |
| 50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 51 | |
| 52 private: | 48 private: |
| 53 // Switches to the desktop receiving a user input if different from | 49 // Switches to the desktop receiving a user input if different from |
| 54 // the current one. | 50 // the current one. |
| 55 void SwitchToInputDesktop(); | 51 void SwitchToInputDesktop(); |
| 56 | 52 |
| 57 // Pointer to the next event executor. | 53 // Pointer to the next event executor. |
| 58 scoped_ptr<EventExecutor> nested_executor_; | 54 scoped_ptr<EventExecutor> nested_executor_; |
| 59 | 55 |
| 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 56 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 61 | 57 |
| 62 ScopedThreadDesktop desktop_; | 58 ScopedThreadDesktop desktop_; |
| 63 | 59 |
| 64 // The Chromoting IPC channel connecting the host with the service. | 60 // The IPC channel connecting us to the daemon process. |
| 65 scoped_ptr<IPC::ChannelProxy> chromoting_channel_; | 61 IPC::ChannelProxy* daemon_channel_; |
| 66 | 62 |
| 67 // Keys currently pressed by the client, used to detect Ctrl-Alt-Del. | 63 // Keys currently pressed by the client, used to detect Ctrl-Alt-Del. |
| 68 std::set<uint32> pressed_keys_; | 64 std::set<uint32> pressed_keys_; |
| 69 | 65 |
| 70 base::WeakPtrFactory<SessionEventExecutorWin> weak_ptr_factory_; | 66 base::WeakPtrFactory<SessionEventExecutorWin> weak_ptr_factory_; |
| 71 base::WeakPtr<SessionEventExecutorWin> weak_ptr_; | 67 base::WeakPtr<SessionEventExecutorWin> weak_ptr_; |
| 72 | 68 |
| 73 DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); | 69 DISALLOW_COPY_AND_ASSIGN(SessionEventExecutorWin); |
| 74 }; | 70 }; |
| 75 | 71 |
| 76 } // namespace remoting | 72 } // namespace remoting |
| 77 | 73 |
| 78 #endif // REMOTING_HOST_SESSION_EVENT_EXECUTOR_WIN_H_ | 74 #endif // REMOTING_HOST_SESSION_EVENT_EXECUTOR_WIN_H_ |
| OLD | NEW |