| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_FACTORY_H_ |
| 6 #define REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_FACTORY_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "remoting/host/desktop_environment_factory.h" |
| 12 #include "remoting/host/desktop_session_connector.h" |
| 13 |
| 14 namespace IPC { |
| 15 class ChannelProxy; |
| 16 } // namespace IPC |
| 17 |
| 18 namespace remoting { |
| 19 |
| 20 class DesktopSessionConnector; |
| 21 class IpcDesktopEnvironment; |
| 22 |
| 23 // Used to create IpcDesktopEnvironment objects intergating with the desktop via |
| 24 // a helper process and talking to that process via IPC. |
| 25 class IpcDesktopEnvironmentFactory |
| 26 : public DesktopEnvironmentFactory, |
| 27 public DesktopSessionConnector { |
| 28 public: |
| 29 // Passes a reference to the IPC channel connected to the daemon process and |
| 30 // relevant task runners. |daemon_channel| must outlive this object. |
| 31 IpcDesktopEnvironmentFactory( |
| 32 IPC::ChannelProxy* daemon_channel, |
| 33 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 34 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 35 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 36 virtual ~IpcDesktopEnvironmentFactory(); |
| 37 |
| 38 virtual scoped_ptr<DesktopEnvironment> Create(ClientSession* client) OVERRIDE; |
| 39 |
| 40 // DesktopSessionConnector implementation. |
| 41 virtual void ConnectTerminal( |
| 42 IpcDesktopEnvironment* desktop_environment) OVERRIDE; |
| 43 virtual void DisconnectTerminal( |
| 44 IpcDesktopEnvironment* desktop_environment) OVERRIDE; |
| 45 virtual void OnTerminalDisconnected(int terminal_id) OVERRIDE; |
| 46 |
| 47 private: |
| 48 // IPC channel connected to the daemon process. |
| 49 IPC::ChannelProxy* daemon_channel_; |
| 50 |
| 51 // Task runner used to service calls to the DesktopSessionConnector APIs. |
| 52 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 53 |
| 54 // List of DesktopEnvironment instances we've told the daemon process about. |
| 55 typedef std::map<int, IpcDesktopEnvironment*> ActiveConnectionsList; |
| 56 ActiveConnectionsList active_connections_; |
| 57 |
| 58 // Next desktop session ID. IDs are allocated sequentially starting from 0. |
| 59 // This gives us more than 67 years of unique IDs assuming a new ID is |
| 60 // allocated every second. |
| 61 int next_id_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(IpcDesktopEnvironmentFactory); |
| 64 }; |
| 65 |
| 66 } // namespace remoting |
| 67 |
| 68 #endif // REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_FACTORY_H_ |
| OLD | NEW |