Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: remoting/host/chromoting_host.cc

Issue 301453003: Host extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed remoting_host.gypi Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/client_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "remoting/host/chromoting_host.h" 5 #include "remoting/host/chromoting_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) { 134 void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) {
135 DCHECK(CalledOnValidThread()); 135 DCHECK(CalledOnValidThread());
136 status_observers_.AddObserver(observer); 136 status_observers_.AddObserver(observer);
137 } 137 }
138 138
139 void ChromotingHost::RemoveStatusObserver(HostStatusObserver* observer) { 139 void ChromotingHost::RemoveStatusObserver(HostStatusObserver* observer) {
140 DCHECK(CalledOnValidThread()); 140 DCHECK(CalledOnValidThread());
141 status_observers_.RemoveObserver(observer); 141 status_observers_.RemoveObserver(observer);
142 } 142 }
143 143
144 void ChromotingHost::AddExtension(scoped_ptr<HostExtension> extension) {
145 extensions_.push_back(extension.release());
146 }
147
144 void ChromotingHost::RejectAuthenticatingClient() { 148 void ChromotingHost::RejectAuthenticatingClient() {
145 DCHECK(authenticating_client_); 149 DCHECK(authenticating_client_);
146 reject_authenticating_client_ = true; 150 reject_authenticating_client_ = true;
147 } 151 }
148 152
149 void ChromotingHost::SetAuthenticatorFactory( 153 void ChromotingHost::SetAuthenticatorFactory(
150 scoped_ptr<protocol::AuthenticatorFactory> authenticator_factory) { 154 scoped_ptr<protocol::AuthenticatorFactory> authenticator_factory) {
151 DCHECK(CalledOnValidThread()); 155 DCHECK(CalledOnValidThread());
152 session_manager_->set_authenticator_factory(authenticator_factory.Pass()); 156 session_manager_->set_authenticator_factory(authenticator_factory.Pass());
153 } 157 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 227 }
224 228
225 void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) { 229 void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) {
226 DCHECK(CalledOnValidThread()); 230 DCHECK(CalledOnValidThread());
227 231
228 // Notify observers. 232 // Notify observers.
229 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, 233 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
230 OnClientConnected(client->client_jid())); 234 OnClientConnected(client->client_jid()));
231 } 235 }
232 236
237 void ChromotingHost::OnSessionClientCapabilities(ClientSession* client) {
238 DCHECK(CalledOnValidThread());
239
240 // Create extension sessions from each registered extension for this client.
241 for (HostExtensionList::iterator extension = extensions_.begin();
242 extension != extensions_.end(); ++extension) {
243 scoped_ptr<HostExtensionSession> extension_session =
244 (*extension)->CreateExtensionSession(client);
245 if (extension_session)
246 client->AddExtensionSession(extension_session.Pass());
247 }
248 }
249
233 void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) { 250 void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) {
234 DCHECK(CalledOnValidThread()); 251 DCHECK(CalledOnValidThread());
235 252
236 // Notify observers. 253 // Notify observers.
237 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, 254 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
238 OnAccessDenied(client->client_jid())); 255 OnAccessDenied(client->client_jid()));
239 } 256 }
240 257
241 void ChromotingHost::OnSessionClosed(ClientSession* client) { 258 void ChromotingHost::OnSessionClosed(ClientSession* client) {
242 DCHECK(CalledOnValidThread()); 259 DCHECK(CalledOnValidThread());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 audio_task_runner_, 330 audio_task_runner_,
314 input_task_runner_, 331 input_task_runner_,
315 video_capture_task_runner_, 332 video_capture_task_runner_,
316 video_encode_task_runner_, 333 video_encode_task_runner_,
317 network_task_runner_, 334 network_task_runner_,
318 ui_task_runner_, 335 ui_task_runner_,
319 connection.Pass(), 336 connection.Pass(),
320 desktop_environment_factory_, 337 desktop_environment_factory_,
321 max_session_duration_, 338 max_session_duration_,
322 pairing_registry_); 339 pairing_registry_);
340
341 // Registers capabilities provided by host extensions.
342 for (HostExtensionList::iterator extension = extensions_.begin();
343 extension != extensions_.end(); ++extension) {
344 client->AddHostCapabilities((*extension)->GetCapabilities());
345 }
346
323 clients_.push_back(client); 347 clients_.push_back(client);
324 } 348 }
325 349
326 void ChromotingHost::set_protocol_config( 350 void ChromotingHost::set_protocol_config(
327 scoped_ptr<protocol::CandidateSessionConfig> config) { 351 scoped_ptr<protocol::CandidateSessionConfig> config) {
328 DCHECK(CalledOnValidThread()); 352 DCHECK(CalledOnValidThread());
329 DCHECK(config.get()); 353 DCHECK(config.get());
330 DCHECK(!started_); 354 DCHECK(!started_);
331 protocol_config_ = config.Pass(); 355 protocol_config_ = config.Pass();
332 } 356 }
333 357
334 void ChromotingHost::DisconnectAllClients() { 358 void ChromotingHost::DisconnectAllClients() {
335 DCHECK(CalledOnValidThread()); 359 DCHECK(CalledOnValidThread());
336 360
337 while (!clients_.empty()) { 361 while (!clients_.empty()) {
338 size_t size = clients_.size(); 362 size_t size = clients_.size();
339 clients_.front()->DisconnectSession(); 363 clients_.front()->DisconnectSession();
340 CHECK_EQ(clients_.size(), size - 1); 364 CHECK_EQ(clients_.size(), size - 1);
341 } 365 }
342 } 366 }
343 367
344 } // namespace remoting 368 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698