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_DESKTOP_SESSION_AGENT_H_ | |
6 #define REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/callback.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "ipc/ipc_listener.h" | |
14 #include "ipc/ipc_platform_file.h" | |
15 | |
16 namespace base { | |
17 class SingleThreadTaskRunner; | |
18 } // base | |
Sergey Ulanov
2012/10/24 20:12:01
nit: namespace base
alexeypa (please no reviews)
2012/10/24 21:41:51
Done.
| |
19 | |
20 namespace IPC { | |
21 class ChannelProxy; | |
22 class Message; | |
23 } // namespace IPC | |
24 | |
25 namespace remoting { | |
26 | |
27 // Provides screen/audio capturing and input injection services for | |
28 // the network process. | |
29 class DesktopSessionAgent : public IPC::Listener { | |
30 public: | |
31 static scoped_ptr<DesktopSessionAgent> Create( | |
32 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | |
33 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | |
34 | |
35 virtual ~DesktopSessionAgent(); | |
36 | |
37 // IPC::Listener implementation. | |
38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
39 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | |
40 virtual void OnChannelError() OVERRIDE; | |
41 | |
42 // Creates the screen/audio recorders, input stubs and the IPC channel to be | |
43 // used to access them. Returns a handle of the client end of the IPC channel | |
44 // pipe to be forwarder to the corresponding desktop environment. | |
45 bool Start(const base::Closure& done_task, | |
46 IPC::PlatformFileForTransit* desktop_pipe_out); | |
47 | |
48 protected: | |
49 DesktopSessionAgent( | |
50 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | |
51 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | |
52 | |
53 // Creates a pre-connected IPC channel to be used to access the screen/audio | |
54 // recorders and input stubs. | |
55 virtual bool DoCreateNetworkChannel( | |
56 IPC::PlatformFileForTransit* client_out, | |
57 scoped_ptr<IPC::ChannelProxy>* server_out) = 0; | |
58 | |
59 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { | |
60 return caller_task_runner_; | |
61 } | |
62 | |
63 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() const { | |
64 return io_task_runner_; | |
65 } | |
66 | |
67 private: | |
68 // Task runner on which public methods of this class should be called. | |
69 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | |
70 | |
71 // Message loop used by the IPC channel. | |
72 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
73 | |
74 // Run on |caller_task_runner_| to notify the caller that |this| has been | |
75 // stopped. | |
76 base::Closure done_task_; | |
77 | |
78 // IPC channel connecting the desktop process with the network process. | |
79 scoped_ptr<IPC::ChannelProxy> network_channel_; | |
80 | |
81 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); | |
82 }; | |
83 | |
84 } // namespace remoting | |
85 | |
86 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ | |
OLD | NEW |