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