Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: remoting/host/ipc_desktop_environment_factory.h

Issue 11778049: Making DesktopEnvironment a factory class used by ClientSession to create audio/video capturers and… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "remoting/host/desktop_environment_factory.h"
13 #include "remoting/host/desktop_session_connector.h"
14
15 namespace IPC {
16 class ChannelProxy;
17 } // namespace IPC
18
19 namespace remoting {
20
21 class DesktopSessionConnector;
22 class DesktopSessionProxy;
23
24 // Used to create IpcDesktopEnvironment objects intergating with the desktop via
25 // a helper process and talking to that process via IPC.
26 class IpcDesktopEnvironmentFactory
27 : public DesktopEnvironmentFactory,
28 public DesktopSessionConnector {
29 public:
30 // Passes a reference to the IPC channel connected to the daemon process and
31 // relevant task runners. |daemon_channel| must outlive this object.
32 IpcDesktopEnvironmentFactory(
33 IPC::ChannelProxy* daemon_channel,
34 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner,
35 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
36 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
37 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
38 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner);
39 virtual ~IpcDesktopEnvironmentFactory();
40
41 virtual scoped_ptr<DesktopEnvironment> Create() OVERRIDE;
42
43 // DesktopSessionConnector implementation.
44 virtual void ConnectTerminal(
45 scoped_refptr<DesktopSessionProxy> desktop_session_proxy) OVERRIDE;
46 virtual void DisconnectTerminal(
47 scoped_refptr<DesktopSessionProxy> desktop_session_proxy) OVERRIDE;
48 virtual void OnDesktopSessionAgentAttached(
49 int terminal_id,
50 IPC::PlatformFileForTransit desktop_process,
51 IPC::PlatformFileForTransit desktop_pipe) OVERRIDE;
52 virtual void OnTerminalDisconnected(int terminal_id) OVERRIDE;
53
54 private:
55 // IPC channel connected to the daemon process.
56 IPC::ChannelProxy* daemon_channel_;
57
58 // Task runner used to run the audio capturer.
59 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner_;
60
61 // Task runner used to service calls to the DesktopSessionConnector APIs.
62 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
63
64 // Task runner used to run the video capturer.
65 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_;
66
67 // List of DesktopEnvironment instances we've told the daemon process about.
68 typedef std::map<int, scoped_refptr<DesktopSessionProxy> >
69 ActiveConnectionsList;
70 ActiveConnectionsList active_connections_;
71
72 // Next desktop session ID. IDs are allocated sequentially starting from 0.
73 // This gives us more than 67 years of unique IDs assuming a new ID is
74 // allocated every second.
75 int next_id_;
76
77 DISALLOW_COPY_AND_ASSIGN(IpcDesktopEnvironmentFactory);
78 };
79
80 } // namespace remoting
81
82 #endif // REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_FACTORY_H_
OLDNEW
« no previous file with comments | « remoting/host/ipc_desktop_environment.cc ('k') | remoting/host/ipc_desktop_environment_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698