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 <string> | 9 #include <string> |
10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/memory/scoped_vector.h" | |
14 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
16 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
17 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
18 #include "net/base/backoff_entry.h" | 17 #include "net/base/backoff_entry.h" |
19 #include "remoting/host/client_session.h" | 18 #include "remoting/host/client_session.h" |
20 #include "remoting/host/host_extension.h" | |
21 #include "remoting/host/host_status_monitor.h" | 19 #include "remoting/host/host_status_monitor.h" |
22 #include "remoting/host/host_status_observer.h" | 20 #include "remoting/host/host_status_observer.h" |
23 #include "remoting/protocol/authenticator.h" | 21 #include "remoting/protocol/authenticator.h" |
24 #include "remoting/protocol/connection_to_client.h" | 22 #include "remoting/protocol/connection_to_client.h" |
25 #include "remoting/protocol/pairing_registry.h" | 23 #include "remoting/protocol/pairing_registry.h" |
26 #include "remoting/protocol/session_manager.h" | 24 #include "remoting/protocol/session_manager.h" |
27 | 25 |
28 namespace base { | 26 namespace base { |
29 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
30 } // namespace base | 28 } // namespace base |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // After this is invoked, the host process will connect to the talk | 84 // After this is invoked, the host process will connect to the talk |
87 // network and start listening for incoming connections. | 85 // network and start listening for incoming connections. |
88 // | 86 // |
89 // This method can only be called once during the lifetime of this object. | 87 // This method can only be called once during the lifetime of this object. |
90 void Start(const std::string& host_owner); | 88 void Start(const std::string& host_owner); |
91 | 89 |
92 // HostStatusMonitor interface. | 90 // HostStatusMonitor interface. |
93 virtual void AddStatusObserver(HostStatusObserver* observer) OVERRIDE; | 91 virtual void AddStatusObserver(HostStatusObserver* observer) OVERRIDE; |
94 virtual void RemoveStatusObserver(HostStatusObserver* observer) OVERRIDE; | 92 virtual void RemoveStatusObserver(HostStatusObserver* observer) OVERRIDE; |
95 | 93 |
96 // Registers a host extension. | |
97 void AddExtension(scoped_ptr<HostExtension> extension); | |
98 | |
99 // This method may be called only from | 94 // This method may be called only from |
100 // HostStatusObserver::OnClientAuthenticated() to reject the new | 95 // HostStatusObserver::OnClientAuthenticated() to reject the new |
101 // client. | 96 // client. |
102 void RejectAuthenticatingClient(); | 97 void RejectAuthenticatingClient(); |
103 | 98 |
104 // Sets the authenticator factory to use for incoming | 99 // Sets the authenticator factory to use for incoming |
105 // connections. Incoming connections are rejected until | 100 // connections. Incoming connections are rejected until |
106 // authenticator factory is set. Must be called on the network | 101 // authenticator factory is set. Must be called on the network |
107 // thread after the host is started. Must not be called more than | 102 // thread after the host is started. Must not be called more than |
108 // once per host instance because it may not be safe to delete | 103 // once per host instance because it may not be safe to delete |
109 // factory before all authenticators it created are deleted. | 104 // factory before all authenticators it created are deleted. |
110 void SetAuthenticatorFactory( | 105 void SetAuthenticatorFactory( |
111 scoped_ptr<protocol::AuthenticatorFactory> authenticator_factory); | 106 scoped_ptr<protocol::AuthenticatorFactory> authenticator_factory); |
112 | 107 |
113 // Enables/disables curtaining when one or more clients are connected. | 108 // Enables/disables curtaining when one or more clients are connected. |
114 // Takes immediate effect if clients are already connected. | 109 // Takes immediate effect if clients are already connected. |
115 void SetEnableCurtaining(bool enable); | 110 void SetEnableCurtaining(bool enable); |
116 | 111 |
117 // Sets the maximum duration of any session. By default, a session has no | 112 // Sets the maximum duration of any session. By default, a session has no |
118 // maximum duration. | 113 // maximum duration. |
119 void SetMaximumSessionDuration(const base::TimeDelta& max_session_duration); | 114 void SetMaximumSessionDuration(const base::TimeDelta& max_session_duration); |
120 | 115 |
121 //////////////////////////////////////////////////////////////////////////// | 116 //////////////////////////////////////////////////////////////////////////// |
122 // ClientSession::EventHandler implementation. | 117 // ClientSession::EventHandler implementation. |
123 virtual void OnSessionAuthenticating(ClientSession* client) OVERRIDE; | 118 virtual void OnSessionAuthenticating(ClientSession* client) OVERRIDE; |
124 virtual bool OnSessionAuthenticated(ClientSession* client) OVERRIDE; | 119 virtual bool OnSessionAuthenticated(ClientSession* client) OVERRIDE; |
125 virtual void OnSessionChannelsConnected(ClientSession* client) OVERRIDE; | 120 virtual void OnSessionChannelsConnected(ClientSession* client) OVERRIDE; |
126 virtual void OnSessionClientCapabilities(ClientSession* client) OVERRIDE; | |
127 virtual void OnSessionAuthenticationFailed(ClientSession* client) OVERRIDE; | 121 virtual void OnSessionAuthenticationFailed(ClientSession* client) OVERRIDE; |
128 virtual void OnSessionClosed(ClientSession* session) OVERRIDE; | 122 virtual void OnSessionClosed(ClientSession* session) OVERRIDE; |
129 virtual void OnSessionSequenceNumber(ClientSession* session, | 123 virtual void OnSessionSequenceNumber(ClientSession* session, |
130 int64 sequence_number) OVERRIDE; | 124 int64 sequence_number) OVERRIDE; |
131 virtual void OnSessionRouteChange( | 125 virtual void OnSessionRouteChange( |
132 ClientSession* session, | 126 ClientSession* session, |
133 const std::string& channel_name, | 127 const std::string& channel_name, |
134 const protocol::TransportRoute& route) OVERRIDE; | 128 const protocol::TransportRoute& route) OVERRIDE; |
135 | 129 |
136 // SessionManager::Listener implementation. | 130 // SessionManager::Listener implementation. |
(...skipping 16 matching lines...) Expand all Loading... |
153 } | 147 } |
154 void set_pairing_registry( | 148 void set_pairing_registry( |
155 scoped_refptr<protocol::PairingRegistry> pairing_registry) { | 149 scoped_refptr<protocol::PairingRegistry> pairing_registry) { |
156 pairing_registry_ = pairing_registry; | 150 pairing_registry_ = pairing_registry; |
157 } | 151 } |
158 | 152 |
159 private: | 153 private: |
160 friend class ChromotingHostTest; | 154 friend class ChromotingHostTest; |
161 | 155 |
162 typedef std::list<ClientSession*> ClientList; | 156 typedef std::list<ClientSession*> ClientList; |
163 typedef ScopedVector<HostExtension> HostExtensionList; | |
164 | 157 |
165 // Immediately disconnects all active clients. Host-internal components may | 158 // Immediately disconnects all active clients. Host-internal components may |
166 // shutdown asynchronously, but the caller is guaranteed not to receive | 159 // shutdown asynchronously, but the caller is guaranteed not to receive |
167 // callbacks for disconnected clients after this call returns. | 160 // callbacks for disconnected clients after this call returns. |
168 void DisconnectAllClients(); | 161 void DisconnectAllClients(); |
169 | 162 |
170 // Unless specified otherwise all members of this class must be | 163 // Unless specified otherwise all members of this class must be |
171 // used on the network thread only. | 164 // used on the network thread only. |
172 | 165 |
173 // Parameters specified when the host was created. | 166 // Parameters specified when the host was created. |
(...skipping 30 matching lines...) Expand all Loading... |
204 | 197 |
205 // True if the curtain mode is enabled. | 198 // True if the curtain mode is enabled. |
206 bool enable_curtaining_; | 199 bool enable_curtaining_; |
207 | 200 |
208 // The maximum duration of any session. | 201 // The maximum duration of any session. |
209 base::TimeDelta max_session_duration_; | 202 base::TimeDelta max_session_duration_; |
210 | 203 |
211 // The pairing registry for PIN-less authentication. | 204 // The pairing registry for PIN-less authentication. |
212 scoped_refptr<protocol::PairingRegistry> pairing_registry_; | 205 scoped_refptr<protocol::PairingRegistry> pairing_registry_; |
213 | 206 |
214 // List of host extensions. | |
215 HostExtensionList extensions_; | |
216 | |
217 base::WeakPtrFactory<ChromotingHost> weak_factory_; | 207 base::WeakPtrFactory<ChromotingHost> weak_factory_; |
218 | 208 |
219 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 209 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
220 }; | 210 }; |
221 | 211 |
222 } // namespace remoting | 212 } // namespace remoting |
223 | 213 |
224 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 214 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
OLD | NEW |