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 <list> | 8 #include <list> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.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_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "net/base/backoff_entry.h" | 19 #include "net/base/backoff_entry.h" |
20 #include "remoting/host/client_session.h" | 20 #include "remoting/host/client_session.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" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 base::NonThreadSafe, |
66 public ClientSession::EventHandler, | 66 public ClientSession::EventHandler, |
67 public HostStatusMonitor { | 67 public HostStatusMonitor { |
68 public: | 68 public: |
69 // |desktop_environment_factory| must outlive this object. | 69 // |desktop_environment_factory| must outlive this object. |
70 ChromotingHost( | 70 ChromotingHost( |
71 DesktopEnvironmentFactory* desktop_environment_factory, | 71 DesktopEnvironmentFactory* desktop_environment_factory, |
72 scoped_ptr<protocol::SessionManager> session_manager, | 72 std::unique_ptr<protocol::SessionManager> session_manager, |
73 scoped_refptr<protocol::TransportContext> transport_context, | 73 scoped_refptr<protocol::TransportContext> transport_context, |
74 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 74 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
75 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner); | 75 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner); |
76 ~ChromotingHost() override; | 76 ~ChromotingHost() override; |
77 | 77 |
78 // Asynchronously starts the host. | 78 // Asynchronously starts the host. |
79 // | 79 // |
80 // After this is invoked, the host process will connect to the talk | 80 // After this is invoked, the host process will connect to the talk |
81 // network and start listening for incoming connections. | 81 // network and start listening for incoming connections. |
82 // | 82 // |
83 // This method can only be called once during the lifetime of this object. | 83 // This method can only be called once during the lifetime of this object. |
84 void Start(const std::string& host_owner); | 84 void Start(const std::string& host_owner); |
85 | 85 |
86 // HostStatusMonitor interface. | 86 // HostStatusMonitor interface. |
87 void AddStatusObserver(HostStatusObserver* observer) override; | 87 void AddStatusObserver(HostStatusObserver* observer) override; |
88 void RemoveStatusObserver(HostStatusObserver* observer) override; | 88 void RemoveStatusObserver(HostStatusObserver* observer) override; |
89 | 89 |
90 // Registers a host extension. | 90 // Registers a host extension. |
91 void AddExtension(scoped_ptr<HostExtension> extension); | 91 void AddExtension(std::unique_ptr<HostExtension> extension); |
92 | 92 |
93 // Sets the authenticator factory to use for incoming | 93 // Sets the authenticator factory to use for incoming |
94 // connections. Incoming connections are rejected until | 94 // connections. Incoming connections are rejected until |
95 // authenticator factory is set. Must be called on the network | 95 // authenticator factory is set. Must be called on the network |
96 // thread after the host is started. Must not be called more than | 96 // thread after the host is started. Must not be called more than |
97 // once per host instance because it may not be safe to delete | 97 // once per host instance because it may not be safe to delete |
98 // factory before all authenticators it created are deleted. | 98 // factory before all authenticators it created are deleted. |
99 void SetAuthenticatorFactory( | 99 void SetAuthenticatorFactory( |
100 scoped_ptr<protocol::AuthenticatorFactory> authenticator_factory); | 100 std::unique_ptr<protocol::AuthenticatorFactory> authenticator_factory); |
101 | 101 |
102 // Enables/disables curtaining when one or more clients are connected. | 102 // Enables/disables curtaining when one or more clients are connected. |
103 // Takes immediate effect if clients are already connected. | 103 // Takes immediate effect if clients are already connected. |
104 void SetEnableCurtaining(bool enable); | 104 void SetEnableCurtaining(bool enable); |
105 | 105 |
106 // Sets the maximum duration of any session. By default, a session has no | 106 // Sets the maximum duration of any session. By default, a session has no |
107 // maximum duration. | 107 // maximum duration. |
108 void SetMaximumSessionDuration(const base::TimeDelta& max_session_duration); | 108 void SetMaximumSessionDuration(const base::TimeDelta& max_session_duration); |
109 | 109 |
110 //////////////////////////////////////////////////////////////////////////// | 110 //////////////////////////////////////////////////////////////////////////// |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Immediately disconnects all active clients. Host-internal components may | 146 // Immediately disconnects all active clients. Host-internal components may |
147 // shutdown asynchronously, but the caller is guaranteed not to receive | 147 // shutdown asynchronously, but the caller is guaranteed not to receive |
148 // callbacks for disconnected clients after this call returns. | 148 // callbacks for disconnected clients after this call returns. |
149 void DisconnectAllClients(); | 149 void DisconnectAllClients(); |
150 | 150 |
151 // Unless specified otherwise all members of this class must be | 151 // Unless specified otherwise all members of this class must be |
152 // used on the network thread only. | 152 // used on the network thread only. |
153 | 153 |
154 // Parameters specified when the host was created. | 154 // Parameters specified when the host was created. |
155 DesktopEnvironmentFactory* desktop_environment_factory_; | 155 DesktopEnvironmentFactory* desktop_environment_factory_; |
156 scoped_ptr<protocol::SessionManager> session_manager_; | 156 std::unique_ptr<protocol::SessionManager> session_manager_; |
157 scoped_refptr<protocol::TransportContext> transport_context_; | 157 scoped_refptr<protocol::TransportContext> transport_context_; |
158 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; | 158 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; |
159 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; | 159 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; |
160 | 160 |
161 // Must be used on the network thread only. | 161 // Must be used on the network thread only. |
162 base::ObserverList<HostStatusObserver> status_observers_; | 162 base::ObserverList<HostStatusObserver> status_observers_; |
163 | 163 |
164 // The connections to remote clients. | 164 // The connections to remote clients. |
165 ClientList clients_; | 165 ClientList clients_; |
166 | 166 |
(...skipping 16 matching lines...) Expand all Loading... |
183 HostExtensionList extensions_; | 183 HostExtensionList extensions_; |
184 | 184 |
185 base::WeakPtrFactory<ChromotingHost> weak_factory_; | 185 base::WeakPtrFactory<ChromotingHost> weak_factory_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 187 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace remoting | 190 } // namespace remoting |
191 | 191 |
192 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 192 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
OLD | NEW |