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_DAEMON_PROCESS_H_ | 5 #ifndef REMOTING_HOST_DAEMON_PROCESS_H_ |
6 #define REMOTING_HOST_DAEMON_PROCESS_H_ | 6 #define REMOTING_HOST_DAEMON_PROCESS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "base/process/process.h" | 19 #include "base/process/process.h" |
20 #include "ipc/ipc_channel.h" | 20 #include "ipc/ipc_channel.h" |
21 #include "ipc/ipc_channel_proxy.h" | 21 #include "ipc/ipc_channel_proxy.h" |
22 #include "ipc/ipc_platform_file.h" | 22 #include "ipc/ipc_platform_file.h" |
23 #include "remoting/host/config_watcher.h" | 23 #include "remoting/host/config_watcher.h" |
24 #include "remoting/host/host_status_monitor.h" | 24 #include "remoting/host/host_status_monitor.h" |
25 #include "remoting/host/worker_process_ipc_delegate.h" | 25 #include "remoting/host/worker_process_ipc_delegate.h" |
26 | 26 |
(...skipping 20 matching lines...) Expand all Loading... |
47 public WorkerProcessIpcDelegate { | 47 public WorkerProcessIpcDelegate { |
48 public: | 48 public: |
49 typedef std::list<DesktopSession*> DesktopSessionList; | 49 typedef std::list<DesktopSession*> DesktopSessionList; |
50 | 50 |
51 ~DaemonProcess() override; | 51 ~DaemonProcess() override; |
52 | 52 |
53 // Creates a platform-specific implementation of the daemon process object | 53 // Creates a platform-specific implementation of the daemon process object |
54 // passing relevant task runners. Public methods of this class must be called | 54 // passing relevant task runners. Public methods of this class must be called |
55 // on the |caller_task_runner| thread. |io_task_runner| is used to handle IPC | 55 // on the |caller_task_runner| thread. |io_task_runner| is used to handle IPC |
56 // and background I/O tasks. | 56 // and background I/O tasks. |
57 static scoped_ptr<DaemonProcess> Create( | 57 static std::unique_ptr<DaemonProcess> Create( |
58 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 58 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
59 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 59 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
60 const base::Closure& stopped_callback); | 60 const base::Closure& stopped_callback); |
61 | 61 |
62 // ConfigWatcher::Delegate | 62 // ConfigWatcher::Delegate |
63 void OnConfigUpdated(const std::string& serialized_config) override; | 63 void OnConfigUpdated(const std::string& serialized_config) override; |
64 void OnConfigWatcherError() override; | 64 void OnConfigWatcherError() override; |
65 | 65 |
66 // HostStatusMonitor interface. | 66 // HostStatusMonitor interface. |
67 void AddStatusObserver(HostStatusObserver* observer) override; | 67 void AddStatusObserver(HostStatusObserver* observer) override; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void OnClientConnected(const std::string& jid); | 122 void OnClientConnected(const std::string& jid); |
123 void OnClientDisconnected(const std::string& jid); | 123 void OnClientDisconnected(const std::string& jid); |
124 void OnClientRouteChange(const std::string& jid, | 124 void OnClientRouteChange(const std::string& jid, |
125 const std::string& channel_name, | 125 const std::string& channel_name, |
126 const SerializedTransportRoute& route); | 126 const SerializedTransportRoute& route); |
127 void OnHostStarted(const std::string& xmpp_login); | 127 void OnHostStarted(const std::string& xmpp_login); |
128 void OnHostShutdown(); | 128 void OnHostShutdown(); |
129 | 129 |
130 // Creates a platform-specific desktop session and assigns a unique ID to it. | 130 // Creates a platform-specific desktop session and assigns a unique ID to it. |
131 // An implementation should validate |params| as they are received via IPC. | 131 // An implementation should validate |params| as they are received via IPC. |
132 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( | 132 virtual std::unique_ptr<DesktopSession> DoCreateDesktopSession( |
133 int terminal_id, | 133 int terminal_id, |
134 const ScreenResolution& resolution, | 134 const ScreenResolution& resolution, |
135 bool virtual_terminal) = 0; | 135 bool virtual_terminal) = 0; |
136 | 136 |
137 // Requests the network process to crash. | 137 // Requests the network process to crash. |
138 virtual void DoCrashNetworkProcess( | 138 virtual void DoCrashNetworkProcess( |
139 const tracked_objects::Location& location) = 0; | 139 const tracked_objects::Location& location) = 0; |
140 | 140 |
141 // Launches the network process and establishes an IPC channel with it. | 141 // Launches the network process and establishes an IPC channel with it. |
142 virtual void LaunchNetworkProcess() = 0; | 142 virtual void LaunchNetworkProcess() = 0; |
(...skipping 15 matching lines...) Expand all Loading... |
158 private: | 158 private: |
159 // Deletes all desktop sessions. | 159 // Deletes all desktop sessions. |
160 void DeleteAllDesktopSessions(); | 160 void DeleteAllDesktopSessions(); |
161 | 161 |
162 // Task runner on which public methods of this class must be called. | 162 // Task runner on which public methods of this class must be called. |
163 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; | 163 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; |
164 | 164 |
165 // Handles IPC and background I/O tasks. | 165 // Handles IPC and background I/O tasks. |
166 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; | 166 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; |
167 | 167 |
168 scoped_ptr<ConfigWatcher> config_watcher_; | 168 std::unique_ptr<ConfigWatcher> config_watcher_; |
169 | 169 |
170 // The configuration file contents. | 170 // The configuration file contents. |
171 std::string serialized_config_; | 171 std::string serialized_config_; |
172 | 172 |
173 // The list of active desktop sessions. | 173 // The list of active desktop sessions. |
174 DesktopSessionList desktop_sessions_; | 174 DesktopSessionList desktop_sessions_; |
175 | 175 |
176 // The highest desktop session ID that has been seen so far. | 176 // The highest desktop session ID that has been seen so far. |
177 int next_terminal_id_; | 177 int next_terminal_id_; |
178 | 178 |
179 // Keeps track of observers receiving host status notifications. | 179 // Keeps track of observers receiving host status notifications. |
180 base::ObserverList<HostStatusObserver> status_observers_; | 180 base::ObserverList<HostStatusObserver> status_observers_; |
181 | 181 |
182 // Invoked to ask the owner to delete |this|. | 182 // Invoked to ask the owner to delete |this|. |
183 base::Closure stopped_callback_; | 183 base::Closure stopped_callback_; |
184 | 184 |
185 // Writes host status updates to the system event log. | 185 // Writes host status updates to the system event log. |
186 scoped_ptr<HostEventLogger> host_event_logger_; | 186 std::unique_ptr<HostEventLogger> host_event_logger_; |
187 | 187 |
188 base::WeakPtrFactory<DaemonProcess> weak_factory_; | 188 base::WeakPtrFactory<DaemonProcess> weak_factory_; |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(DaemonProcess); | 190 DISALLOW_COPY_AND_ASSIGN(DaemonProcess); |
191 }; | 191 }; |
192 | 192 |
193 } // namespace remoting | 193 } // namespace remoting |
194 | 194 |
195 #endif // REMOTING_HOST_DAEMON_PROCESS_H_ | 195 #endif // REMOTING_HOST_DAEMON_PROCESS_H_ |
OLD | NEW |