Chromium Code Reviews| 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, | |
|
Wez
2012/10/17 17:51:57
nit: Is there a way to get a ref-counted or owned-
alexeypa (please no reviews)
2012/10/17 21:35:53
I don't think it is possible without a custom Chan
| |
| 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( | |
| 39 scoped_refptr<ChromotingHost> host) OVERRIDE; | |
| 40 | |
| 41 // DesktopSessionConnector implementation. | |
| 42 virtual void ConnectTerminal( | |
| 43 IpcDesktopEnvironment* desktop_environment) OVERRIDE; | |
| 44 virtual void DisconnectTerminal( | |
| 45 IpcDesktopEnvironment* desktop_environment) OVERRIDE; | |
| 46 virtual void OnTerminalDisconnected(int terminal_id) OVERRIDE; | |
| 47 | |
| 48 private: | |
| 49 // A list of DesktopEnvironment instances known to the daemon process. | |
|
Wez
2012/10/17 17:51:57
nit: "List of instances we've told the daemon proc
alexeypa (please no reviews)
2012/10/17 21:35:53
Done.
| |
| 50 typedef std::map<int, IpcDesktopEnvironment*> ActiveConnectionsList; | |
| 51 ActiveConnectionsList active_connections_; | |
|
Wez
2012/10/17 17:51:57
nit: Move this down below the members that come fr
alexeypa (please no reviews)
2012/10/17 21:35:53
Done.
| |
| 52 | |
| 53 // IPC channel connected to the daemon process. | |
| 54 IPC::ChannelProxy* daemon_channel_; | |
| 55 | |
| 56 // Task runner the bulk of DesktopSessionConnector implementation runs on. | |
|
Wez
2012/10/17 17:51:57
nit: Clarify this; e.g. "Used to service calls to
alexeypa (please no reviews)
2012/10/17 21:35:53
Done.
| |
| 57 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | |
| 58 | |
| 59 // Next desktop session ID. IDs are allocated sequentially starting from 0. | |
| 60 // This gives us more than 67 years of unique IDs assuming a new ID is | |
| 61 // allocated every second. | |
| 62 static int next_id_; | |
|
Wez
2012/10/17 17:51:57
nit: This doesn't need to be static, I don't think
alexeypa (please no reviews)
2012/10/17 21:35:53
Done.
| |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(IpcDesktopEnvironmentFactory); | |
| 65 }; | |
| 66 | |
| 67 } // namespace remoting | |
| 68 | |
| 69 #endif // REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_FACTORY_H_ | |
| OLD | NEW |