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_CHROMOTING_HOST_H_ | 5 #ifndef REMOTING_HOST_CHROMOTING_HOST_H_ |
6 #define REMOTING_HOST_CHROMOTING_HOST_H_ | 6 #define REMOTING_HOST_CHROMOTING_HOST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/threading/non_thread_safe.h" | 16 #include "base/sequence_checker.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "net/base/backoff_entry.h" | 18 #include "net/base/backoff_entry.h" |
19 #include "remoting/host/client_session.h" | 19 #include "remoting/host/client_session.h" |
20 #include "remoting/host/desktop_environment_options.h" | 20 #include "remoting/host/desktop_environment_options.h" |
21 #include "remoting/host/host_extension.h" | 21 #include "remoting/host/host_extension.h" |
22 #include "remoting/host/host_status_monitor.h" | 22 #include "remoting/host/host_status_monitor.h" |
23 #include "remoting/host/host_status_observer.h" | 23 #include "remoting/host/host_status_observer.h" |
24 #include "remoting/protocol/authenticator.h" | 24 #include "remoting/protocol/authenticator.h" |
25 #include "remoting/protocol/connection_to_client.h" | 25 #include "remoting/protocol/connection_to_client.h" |
26 #include "remoting/protocol/pairing_registry.h" | 26 #include "remoting/protocol/pairing_registry.h" |
(...skipping 28 matching lines...) Expand all Loading... |
55 // ConnectionToClient to receive mouse / keyboard events from the remote | 55 // ConnectionToClient to receive mouse / keyboard events from the remote |
56 // client. | 56 // client. |
57 // After we have done all the initialization we'll start the ScreenRecorder. | 57 // After we have done all the initialization we'll start the ScreenRecorder. |
58 // We'll then enter the running state of the host process. | 58 // We'll then enter the running state of the host process. |
59 // | 59 // |
60 // 3. When the user is disconnected, we will pause the ScreenRecorder | 60 // 3. When the user is disconnected, we will pause the ScreenRecorder |
61 // and try to terminate the threads we have created. This will allow | 61 // and try to terminate the threads we have created. This will allow |
62 // all pending tasks to complete. After all of that completed we | 62 // all pending tasks to complete. After all of that completed we |
63 // return to the idle state. We then go to step (2) if there a new | 63 // return to the idle state. We then go to step (2) if there a new |
64 // incoming connection. | 64 // incoming connection. |
65 class ChromotingHost : public base::NonThreadSafe, | 65 class ChromotingHost : public ClientSession::EventHandler, |
66 public ClientSession::EventHandler, | |
67 public HostStatusMonitor { | 66 public HostStatusMonitor { |
68 public: | 67 public: |
69 typedef std::vector<std::unique_ptr<ClientSession>> ClientSessions; | 68 typedef std::vector<std::unique_ptr<ClientSession>> ClientSessions; |
70 | 69 |
71 // |desktop_environment_factory| must outlive this object. | 70 // |desktop_environment_factory| must outlive this object. |
72 ChromotingHost( | 71 ChromotingHost( |
73 DesktopEnvironmentFactory* desktop_environment_factory, | 72 DesktopEnvironmentFactory* desktop_environment_factory, |
74 std::unique_ptr<protocol::SessionManager> session_manager, | 73 std::unique_ptr<protocol::SessionManager> session_manager, |
75 scoped_refptr<protocol::TransportContext> transport_context, | 74 scoped_refptr<protocol::TransportContext> transport_context, |
76 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 75 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 171 |
173 // The maximum duration of any session. | 172 // The maximum duration of any session. |
174 base::TimeDelta max_session_duration_; | 173 base::TimeDelta max_session_duration_; |
175 | 174 |
176 // The pairing registry for PIN-less authentication. | 175 // The pairing registry for PIN-less authentication. |
177 scoped_refptr<protocol::PairingRegistry> pairing_registry_; | 176 scoped_refptr<protocol::PairingRegistry> pairing_registry_; |
178 | 177 |
179 // List of host extensions. | 178 // List of host extensions. |
180 std::vector<std::unique_ptr<HostExtension>> extensions_; | 179 std::vector<std::unique_ptr<HostExtension>> extensions_; |
181 | 180 |
| 181 SEQUENCE_CHECKER(sequence_checker_); |
| 182 |
182 base::WeakPtrFactory<ChromotingHost> weak_factory_; | 183 base::WeakPtrFactory<ChromotingHost> weak_factory_; |
183 | 184 |
184 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 185 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
185 }; | 186 }; |
186 | 187 |
187 } // namespace remoting | 188 } // namespace remoting |
188 | 189 |
189 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 190 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
OLD | NEW |