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_DESKTOP_PROCESS_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_PROCESS_H_ |
6 #define REMOTING_HOST_DESKTOP_PROCESS_H_ | 6 #define REMOTING_HOST_DESKTOP_PROCESS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
16 #include "remoting/host/desktop_session_agent.h" | 17 #include "remoting/host/desktop_session_agent.h" |
17 | 18 |
18 namespace IPC { | 19 namespace IPC { |
19 class ChannelProxy; | 20 class ChannelProxy; |
20 } // namespace IPC | 21 } // namespace IPC |
21 | 22 |
22 namespace remoting { | 23 namespace remoting { |
23 | 24 |
24 class AutoThreadTaskRunner; | 25 class AutoThreadTaskRunner; |
| 26 class DesktopEnvironment; |
| 27 class DesktopEnvironmentFactory; |
25 class DesktopSessionAgent; | 28 class DesktopSessionAgent; |
26 | 29 |
27 class DesktopProcess : public DesktopSessionAgent::Delegate, | 30 class DesktopProcess : public DesktopSessionAgent::Delegate, |
28 public IPC::Listener, | 31 public IPC::Listener, |
29 public base::SupportsWeakPtr<DesktopProcess> { | 32 public base::SupportsWeakPtr<DesktopProcess> { |
30 public: | 33 public: |
31 DesktopProcess(scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 34 DesktopProcess( |
32 const std::string& daemon_channel_name); | 35 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 36 const std::string& daemon_channel_name); |
33 virtual ~DesktopProcess(); | 37 virtual ~DesktopProcess(); |
34 | 38 |
35 // DesktopSessionAgent::Delegate implementation. | 39 // DesktopSessionAgent::Delegate implementation. |
| 40 virtual DesktopEnvironmentFactory& desktop_environment_factory() OVERRIDE; |
36 virtual void OnNetworkProcessDisconnected() OVERRIDE; | 41 virtual void OnNetworkProcessDisconnected() OVERRIDE; |
37 virtual void InjectSas() OVERRIDE; | |
38 | 42 |
39 // IPC::Listener implementation. | 43 // IPC::Listener implementation. |
40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 44 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
41 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 45 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
42 virtual void OnChannelError() OVERRIDE; | 46 virtual void OnChannelError() OVERRIDE; |
43 | 47 |
| 48 // Injects Secure Attention Sequence. |
| 49 void InjectSas(); |
| 50 |
44 // Creates the desktop agent and required threads and IPC channels. Returns | 51 // Creates the desktop agent and required threads and IPC channels. Returns |
45 // true on success. | 52 // true on success. |
46 bool Start(); | 53 bool Start(scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory); |
47 | 54 |
48 private: | 55 private: |
49 // Crashes the process in response to a daemon's request. The daemon passes | 56 // Crashes the process in response to a daemon's request. The daemon passes |
50 // the location of the code that detected the fatal error resulted in this | 57 // the location of the code that detected the fatal error resulted in this |
51 // request. See the declaration of ChromotingDaemonDesktopMsg_Crash message. | 58 // request. See the declaration of ChromotingDaemonDesktopMsg_Crash message. |
52 void OnCrash(const std::string& function_name, | 59 void OnCrash(const std::string& function_name, |
53 const std::string& file_name, | 60 const std::string& file_name, |
54 const int& line_number); | 61 const int& line_number); |
55 | 62 |
56 // Task runner on which public methods of this class should be called. | 63 // Task runner on which public methods of this class should be called. |
57 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; | 64 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; |
58 | 65 |
| 66 // Factory used to create integration components for use by |desktop_agent_|. |
| 67 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; |
| 68 |
59 // Name of the IPC channel connecting the desktop process with the daemon | 69 // Name of the IPC channel connecting the desktop process with the daemon |
60 // process. | 70 // process. |
61 std::string daemon_channel_name_; | 71 std::string daemon_channel_name_; |
62 | 72 |
63 // IPC channel connecting the desktop process with the daemon process. | 73 // IPC channel connecting the desktop process with the daemon process. |
64 scoped_ptr<IPC::ChannelProxy> daemon_channel_; | 74 scoped_ptr<IPC::ChannelProxy> daemon_channel_; |
65 | 75 |
66 // Provides screen/audio capturing and input injection services for | 76 // Provides screen/audio capturing and input injection services for |
67 // the network process. | 77 // the network process. |
68 scoped_refptr<DesktopSessionAgent> desktop_agent_; | 78 scoped_refptr<DesktopSessionAgent> desktop_agent_; |
69 | 79 |
70 DISALLOW_COPY_AND_ASSIGN(DesktopProcess); | 80 DISALLOW_COPY_AND_ASSIGN(DesktopProcess); |
71 }; | 81 }; |
72 | 82 |
73 } // namespace remoting | 83 } // namespace remoting |
74 | 84 |
75 #endif // REMOTING_HOST_DESKTOP_PROCESS_H_ | 85 #endif // REMOTING_HOST_DESKTOP_PROCESS_H_ |
OLD | NEW |