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 // |desktop_environment_factory| must outlive |this|. |
Wez
2013/02/01 01:02:11
Out of date comment?
alexeypa (please no reviews)
2013/02/01 17:28:43
Done.
| |
32 const std::string& daemon_channel_name); | 35 DesktopProcess( |
36 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | |
37 const std::string& daemon_channel_name); | |
33 virtual ~DesktopProcess(); | 38 virtual ~DesktopProcess(); |
34 | 39 |
35 // DesktopSessionAgent::Delegate implementation. | 40 // DesktopSessionAgent::Delegate implementation. |
41 virtual DesktopEnvironmentFactory& GetDesktopEnvironmentFactory() OVERRIDE; | |
36 virtual void OnNetworkProcessDisconnected() OVERRIDE; | 42 virtual void OnNetworkProcessDisconnected() OVERRIDE; |
37 virtual void InjectSas() OVERRIDE; | |
38 | 43 |
39 // IPC::Listener implementation. | 44 // IPC::Listener implementation. |
40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
41 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 46 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
42 virtual void OnChannelError() OVERRIDE; | 47 virtual void OnChannelError() OVERRIDE; |
43 | 48 |
49 // Injects Secure Attention Sequence. | |
50 void InjectSas(); | |
51 | |
44 // Creates the desktop agent and required threads and IPC channels. Returns | 52 // Creates the desktop agent and required threads and IPC channels. Returns |
45 // true on success. | 53 // true on success. |
46 bool Start(); | 54 bool Start(scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory); |
47 | 55 |
48 private: | 56 private: |
49 // Crashes the process in response to a daemon's request. The daemon passes | 57 // 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 | 58 // the location of the code that detected the fatal error resulted in this |
51 // request. See the declaration of ChromotingDaemonDesktopMsg_Crash message. | 59 // request. See the declaration of ChromotingDaemonDesktopMsg_Crash message. |
52 void OnCrash(const std::string& function_name, | 60 void OnCrash(const std::string& function_name, |
53 const std::string& file_name, | 61 const std::string& file_name, |
54 const int& line_number); | 62 const int& line_number); |
55 | 63 |
56 // Task runner on which public methods of this class should be called. | 64 // Task runner on which public methods of this class should be called. |
57 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; | 65 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; |
58 | 66 |
67 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; | |
Wez
2013/02/01 01:02:11
nit: Suggest comment "Factory used to create integ
alexeypa (please no reviews)
2013/02/01 17:28:43
Done.
| |
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 |