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

Side by Side Diff: remoting/host/it2me/it2me_host.cc

Issue 639233002: Remote assistance on Chrome OS Part IV - It2MeHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedbacks Created 6 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/it2me/it2me_host.h" 5 #include "remoting/host/it2me/it2me_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
11 #include "net/socket/client_socket_factory.h" 10 #include "net/socket/client_socket_factory.h"
12 #include "remoting/base/auto_thread.h" 11 #include "remoting/base/auto_thread.h"
13 #include "remoting/base/logging.h" 12 #include "remoting/base/logging.h"
14 #include "remoting/base/rsa_key_pair.h" 13 #include "remoting/base/rsa_key_pair.h"
15 #include "remoting/host/chromoting_host.h" 14 #include "remoting/host/chromoting_host.h"
16 #include "remoting/host/chromoting_host_context.h" 15 #include "remoting/host/chromoting_host_context.h"
17 #include "remoting/host/host_event_logger.h" 16 #include "remoting/host/host_event_logger.h"
18 #include "remoting/host/host_secret.h" 17 #include "remoting/host/host_secret.h"
19 #include "remoting/host/host_status_logger.h" 18 #include "remoting/host/host_status_logger.h"
(...skipping 16 matching lines...) Expand all
36 } // namespace 35 } // namespace
37 36
38 It2MeHost::It2MeHost( 37 It2MeHost::It2MeHost(
39 ChromotingHostContext* host_context, 38 ChromotingHostContext* host_context,
40 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 39 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
41 base::WeakPtr<It2MeHost::Observer> observer, 40 base::WeakPtr<It2MeHost::Observer> observer,
42 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, 41 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
43 const std::string& directory_bot_jid) 42 const std::string& directory_bot_jid)
44 : host_context_(host_context), 43 : host_context_(host_context),
45 task_runner_(task_runner), 44 task_runner_(task_runner),
45 network_task_runner_(host_context_->network_task_runner()),
46 observer_(observer), 46 observer_(observer),
47 xmpp_server_config_(xmpp_server_config), 47 xmpp_server_config_(xmpp_server_config),
48 directory_bot_jid_(directory_bot_jid), 48 directory_bot_jid_(directory_bot_jid),
49 state_(kDisconnected), 49 state_(kDisconnected),
50 failed_login_attempts_(0), 50 failed_login_attempts_(0),
51 nat_traversal_enabled_(false), 51 nat_traversal_enabled_(false),
52 policy_received_(false) { 52 policy_received_(false) {
53 DCHECK(task_runner_->BelongsToCurrentThread()); 53 DCHECK(task_runner_->BelongsToCurrentThread());
54 } 54 }
55 55
56 void It2MeHost::Connect() { 56 void It2MeHost::Connect() {
57 if (!host_context_->ui_task_runner()->BelongsToCurrentThread()) { 57 if (!host_context_->ui_task_runner()->BelongsToCurrentThread()) {
58 DCHECK(task_runner_->BelongsToCurrentThread()); 58 DCHECK(task_runner_->BelongsToCurrentThread());
59 host_context_->ui_task_runner()->PostTask( 59 host_context_->ui_task_runner()->PostTask(
60 FROM_HERE, base::Bind(&It2MeHost::Connect, this)); 60 FROM_HERE, base::Bind(&It2MeHost::Connect, this));
61 return; 61 return;
62 } 62 }
63 63
64 desktop_environment_factory_.reset(new It2MeDesktopEnvironmentFactory( 64 desktop_environment_factory_.reset(new It2MeDesktopEnvironmentFactory(
65 host_context_->network_task_runner(), 65 network_task_runner_,
66 host_context_->input_task_runner(), 66 host_context_->input_task_runner(),
67 host_context_->ui_task_runner())); 67 host_context_->ui_task_runner()));
68 68
69 // Start monitoring configured policies. 69 // Start monitoring configured policies.
70 policy_watcher_.reset( 70 policy_watcher_.reset(
71 policy_hack::PolicyWatcher::Create(host_context_->network_task_runner())); 71 policy_hack::PolicyWatcher::Create(host_context_, network_task_runner_));
72 policy_watcher_->StartWatching( 72 policy_watcher_->StartWatching(
73 base::Bind(&It2MeHost::OnPolicyUpdate, this)); 73 base::Bind(&It2MeHost::OnPolicyUpdate, this));
74 74
75 // Switch to the network thread to start the actual connection. 75 // Switch to the network thread to start the actual connection.
76 host_context_->network_task_runner()->PostTask( 76 network_task_runner_->PostTask(
77 FROM_HERE, base::Bind(&It2MeHost::ReadPolicyAndConnect, this)); 77 FROM_HERE, base::Bind(&It2MeHost::ReadPolicyAndConnect, this));
78 } 78 }
79 79
80 void It2MeHost::Disconnect() { 80 void It2MeHost::Disconnect() {
81 if (!host_context_->network_task_runner()->BelongsToCurrentThread()) { 81 if (!network_task_runner_->BelongsToCurrentThread()) {
82 DCHECK(task_runner_->BelongsToCurrentThread()); 82 DCHECK(task_runner_->BelongsToCurrentThread());
83 host_context_->network_task_runner()->PostTask( 83 network_task_runner_->PostTask(
84 FROM_HERE, base::Bind(&It2MeHost::Disconnect, this)); 84 FROM_HERE, base::Bind(&It2MeHost::Disconnect, this));
85 return; 85 return;
86 } 86 }
87 87
88 switch (state_) { 88 switch (state_) {
89 case kDisconnected: 89 case kDisconnected:
90 ShutdownOnNetworkThread(); 90 ShutdownOnNetworkThread();
91 return; 91 return;
92 92
93 case kStarting: 93 case kStarting:
(...skipping 10 matching lines...) Expand all
104 104
105 if (!host_) { 105 if (!host_) {
106 SetState(kDisconnected); 106 SetState(kDisconnected);
107 ShutdownOnNetworkThread(); 107 ShutdownOnNetworkThread();
108 return; 108 return;
109 } 109 }
110 110
111 // Deleting the host destroys SignalStrategy synchronously, but 111 // Deleting the host destroys SignalStrategy synchronously, but
112 // SignalStrategy::Listener handlers are not allowed to destroy 112 // SignalStrategy::Listener handlers are not allowed to destroy
113 // SignalStrategy, so post task to destroy the host later. 113 // SignalStrategy, so post task to destroy the host later.
114 host_context_->network_task_runner()->PostTask( 114 network_task_runner_->PostTask(
115 FROM_HERE, base::Bind(&It2MeHost::ShutdownOnNetworkThread, this)); 115 FROM_HERE, base::Bind(&It2MeHost::ShutdownOnNetworkThread, this));
116 return; 116 return;
117 } 117 }
118 } 118 }
119 119
120 void It2MeHost::RequestNatPolicy() { 120 void It2MeHost::RequestNatPolicy() {
121 if (!host_context_->network_task_runner()->BelongsToCurrentThread()) { 121 if (!network_task_runner_->BelongsToCurrentThread()) {
122 DCHECK(task_runner_->BelongsToCurrentThread()); 122 DCHECK(task_runner_->BelongsToCurrentThread());
123 host_context_->network_task_runner()->PostTask( 123 network_task_runner_->PostTask(
124 FROM_HERE, base::Bind(&It2MeHost::RequestNatPolicy, this)); 124 FROM_HERE, base::Bind(&It2MeHost::RequestNatPolicy, this));
125 return; 125 return;
126 } 126 }
127 127
128 if (policy_received_) 128 if (policy_received_)
129 UpdateNatPolicy(nat_traversal_enabled_); 129 UpdateNatPolicy(nat_traversal_enabled_);
130 } 130 }
131 131
132 void It2MeHost::ReadPolicyAndConnect() { 132 void It2MeHost::ReadPolicyAndConnect() {
133 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 133 DCHECK(network_task_runner_->BelongsToCurrentThread());
134 134
135 SetState(kStarting); 135 SetState(kStarting);
136 136
137 // Only proceed to FinishConnect() if at least one policy update has been 137 // Only proceed to FinishConnect() if at least one policy update has been
138 // received. 138 // received.
139 if (policy_received_) { 139 if (policy_received_) {
140 FinishConnect(); 140 FinishConnect();
141 } else { 141 } else {
142 // Otherwise, create the policy watcher, and thunk the connect. 142 // Otherwise, create the policy watcher, and thunk the connect.
143 pending_connect_ = 143 pending_connect_ =
144 base::Bind(&It2MeHost::FinishConnect, this); 144 base::Bind(&It2MeHost::FinishConnect, this);
145 } 145 }
146 } 146 }
147 147
148 void It2MeHost::FinishConnect() { 148 void It2MeHost::FinishConnect() {
149 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 149 DCHECK(network_task_runner_->BelongsToCurrentThread());
150 150
151 if (state_ != kStarting) { 151 if (state_ != kStarting) {
152 // Host has been stopped while we were fetching policy. 152 // Host has been stopped while we were fetching policy.
153 return; 153 return;
154 } 154 }
155 155
156 // Check the host domain policy. 156 // Check the host domain policy.
157 if (!required_host_domain_.empty() && 157 if (!required_host_domain_.empty() &&
158 !EndsWith(xmpp_server_config_.username, 158 !EndsWith(xmpp_server_config_.username,
159 std::string("@") + required_host_domain_, false)) { 159 std::string("@") + required_host_domain_, false)) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // Create the host. 196 // Create the host.
197 host_.reset(new ChromotingHost( 197 host_.reset(new ChromotingHost(
198 signal_strategy_.get(), 198 signal_strategy_.get(),
199 desktop_environment_factory_.get(), 199 desktop_environment_factory_.get(),
200 CreateHostSessionManager(signal_strategy_.get(), network_settings, 200 CreateHostSessionManager(signal_strategy_.get(), network_settings,
201 host_context_->url_request_context_getter()), 201 host_context_->url_request_context_getter()),
202 host_context_->audio_task_runner(), 202 host_context_->audio_task_runner(),
203 host_context_->input_task_runner(), 203 host_context_->input_task_runner(),
204 host_context_->video_capture_task_runner(), 204 host_context_->video_capture_task_runner(),
205 host_context_->video_encode_task_runner(), 205 host_context_->video_encode_task_runner(),
206 host_context_->network_task_runner(), 206 network_task_runner_,
207 host_context_->ui_task_runner())); 207 host_context_->ui_task_runner()));
208 host_->AddStatusObserver(this); 208 host_->AddStatusObserver(this);
209 host_status_logger_.reset( 209 host_status_logger_.reset(
210 new HostStatusLogger(host_->AsWeakPtr(), ServerLogEntry::IT2ME, 210 new HostStatusLogger(host_->AsWeakPtr(), ServerLogEntry::IT2ME,
211 signal_strategy_.get(), directory_bot_jid_)); 211 signal_strategy_.get(), directory_bot_jid_));
212 212
213 // Disable audio by default. 213 // Disable audio by default.
214 // TODO(sergeyu): Add UI to enable it. 214 // TODO(sergeyu): Add UI to enable it.
215 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = 215 scoped_ptr<protocol::CandidateSessionConfig> protocol_config =
216 protocol::CandidateSessionConfig::CreateDefault(); 216 protocol::CandidateSessionConfig::CreateDefault();
217 protocol_config->DisableAudioChannel(); 217 protocol_config->DisableAudioChannel();
218 218
219 host_->set_protocol_config(protocol_config.Pass()); 219 host_->set_protocol_config(protocol_config.Pass());
220 220
221 // Create event logger. 221 // Create event logger.
222 host_event_logger_ = 222 host_event_logger_ =
223 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName); 223 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName);
224 224
225 // Connect signaling and start the host. 225 // Connect signaling and start the host.
226 signal_strategy_->Connect(); 226 signal_strategy_->Connect();
227 host_->Start(xmpp_server_config_.username); 227 host_->Start(xmpp_server_config_.username);
228 228
229 SetState(kRequestedAccessCode); 229 SetState(kRequestedAccessCode);
230 return; 230 return;
231 } 231 }
232 232
233 void It2MeHost::ShutdownOnNetworkThread() { 233 void It2MeHost::ShutdownOnNetworkThread() {
234 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 234 DCHECK(network_task_runner_->BelongsToCurrentThread());
235 DCHECK(state_ == kDisconnecting || state_ == kDisconnected); 235 DCHECK(state_ == kDisconnecting || state_ == kDisconnected);
236 236
237 if (state_ == kDisconnecting) { 237 if (state_ == kDisconnecting) {
238 host_event_logger_.reset(); 238 host_event_logger_.reset();
239 host_->RemoveStatusObserver(this); 239 host_->RemoveStatusObserver(this);
240 host_.reset(); 240 host_.reset();
241 241
242 register_request_.reset(); 242 register_request_.reset();
243 host_status_logger_.reset(); 243 host_status_logger_.reset();
244 signal_strategy_.reset(); 244 signal_strategy_.reset();
245 SetState(kDisconnected); 245 SetState(kDisconnected);
246 } 246 }
247 247
248 host_context_->ui_task_runner()->PostTask( 248 task_runner_->PostTask(FROM_HERE,
249 FROM_HERE, base::Bind(&It2MeHost::ShutdownOnUiThread, this)); 249 base::Bind(&It2MeHost::ShutdownOnUiThread, this));
250 } 250 }
251 251
252 void It2MeHost::ShutdownOnUiThread() { 252 void It2MeHost::ShutdownOnUiThread() {
253 DCHECK(host_context_->ui_task_runner()->BelongsToCurrentThread()); 253 DCHECK(task_runner_->BelongsToCurrentThread());
254 254
255 // Destroy the DesktopEnvironmentFactory, to free thread references. 255 // Destroy the DesktopEnvironmentFactory, to free thread references.
256 desktop_environment_factory_.reset(); 256 desktop_environment_factory_.reset();
257 257
258 // Stop listening for policy updates. 258 // Stop listening for policy updates.
259 if (policy_watcher_.get()) { 259 if (policy_watcher_.get()) {
260 base::WaitableEvent policy_watcher_stopped_(true, false); 260 policy_watcher_->StopWatching(
261 policy_watcher_->StopWatching(&policy_watcher_stopped_); 261 base::Bind(&It2MeHost::OnPolicyWatcherShutdown, this));
262 policy_watcher_stopped_.Wait(); 262 return;
263 policy_watcher_.reset();
264 } 263 }
265 } 264 }
266 265
266 void It2MeHost::OnPolicyWatcherShutdown() {
267 policy_watcher_.reset();
268 }
269
267 void It2MeHost::OnAccessDenied(const std::string& jid) { 270 void It2MeHost::OnAccessDenied(const std::string& jid) {
268 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 271 DCHECK(network_task_runner_->BelongsToCurrentThread());
269 272
270 ++failed_login_attempts_; 273 ++failed_login_attempts_;
271 if (failed_login_attempts_ == kMaxLoginAttempts) { 274 if (failed_login_attempts_ == kMaxLoginAttempts) {
272 Disconnect(); 275 Disconnect();
273 } 276 }
274 } 277 }
275 278
276 void It2MeHost::OnClientAuthenticated(const std::string& jid) { 279 void It2MeHost::OnClientAuthenticated(const std::string& jid) {
277 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 280 DCHECK(network_task_runner_->BelongsToCurrentThread());
278 281
279 if (state_ == kDisconnecting) { 282 if (state_ == kDisconnecting) {
280 // Ignore the new connection if we are disconnecting. 283 // Ignore the new connection if we are disconnecting.
281 return; 284 return;
282 } 285 }
283 if (state_ == kConnected) { 286 if (state_ == kConnected) {
284 // If we already connected another client then one of the connections may be 287 // If we already connected another client then one of the connections may be
285 // an attacker, so both are suspect and we have to reject the second 288 // an attacker, so both are suspect and we have to reject the second
286 // connection and shutdown the host. 289 // connection and shutdown the host.
287 host_->RejectAuthenticatingClient(); 290 host_->RejectAuthenticatingClient();
(...skipping 10 matching lines...) Expand all
298 301
299 // Pass the client user name to the script object before changing state. 302 // Pass the client user name to the script object before changing state.
300 task_runner_->PostTask( 303 task_runner_->PostTask(
301 FROM_HERE, base::Bind(&It2MeHost::Observer::OnClientAuthenticated, 304 FROM_HERE, base::Bind(&It2MeHost::Observer::OnClientAuthenticated,
302 observer_, client_username)); 305 observer_, client_username));
303 306
304 SetState(kConnected); 307 SetState(kConnected);
305 } 308 }
306 309
307 void It2MeHost::OnClientDisconnected(const std::string& jid) { 310 void It2MeHost::OnClientDisconnected(const std::string& jid) {
308 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 311 DCHECK(network_task_runner_->BelongsToCurrentThread());
309 312
310 Disconnect(); 313 Disconnect();
311 } 314 }
312 315
313 void It2MeHost::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { 316 void It2MeHost::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) {
314 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 317 if (!network_task_runner_->BelongsToCurrentThread()) {
318 network_task_runner_->PostTask(
319 FROM_HERE,
320 base::Bind(&It2MeHost::OnPolicyUpdate, this, base::Passed(&policies)));
321 return;
322 }
315 323
316 bool nat_policy; 324 bool nat_policy;
317 if (policies->GetBoolean(policy_hack::PolicyWatcher::kNatPolicyName, 325 if (policies->GetBoolean(policy_hack::PolicyWatcher::kNatPolicyName,
318 &nat_policy)) { 326 &nat_policy)) {
319 UpdateNatPolicy(nat_policy); 327 UpdateNatPolicy(nat_policy);
320 } 328 }
321 std::string host_domain; 329 std::string host_domain;
322 if (policies->GetString(policy_hack::PolicyWatcher::kHostDomainPolicyName, 330 if (policies->GetString(policy_hack::PolicyWatcher::kHostDomainPolicyName,
323 &host_domain)) { 331 &host_domain)) {
324 UpdateHostDomainPolicy(host_domain); 332 UpdateHostDomainPolicy(host_domain);
325 } 333 }
326 334
327 policy_received_ = true; 335 policy_received_ = true;
328 336
329 if (!pending_connect_.is_null()) { 337 if (!pending_connect_.is_null()) {
330 pending_connect_.Run(); 338 pending_connect_.Run();
331 pending_connect_.Reset(); 339 pending_connect_.Reset();
332 } 340 }
333 } 341 }
334 342
335 void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) { 343 void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) {
336 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 344 DCHECK(network_task_runner_->BelongsToCurrentThread());
337 345
338 VLOG(2) << "UpdateNatPolicy: " << nat_traversal_enabled; 346 VLOG(2) << "UpdateNatPolicy: " << nat_traversal_enabled;
339 347
340 // When transitioning from enabled to disabled, force disconnect any 348 // When transitioning from enabled to disabled, force disconnect any
341 // existing session. 349 // existing session.
342 if (nat_traversal_enabled_ && !nat_traversal_enabled && IsConnected()) { 350 if (nat_traversal_enabled_ && !nat_traversal_enabled && IsConnected()) {
343 Disconnect(); 351 Disconnect();
344 } 352 }
345 353
346 nat_traversal_enabled_ = nat_traversal_enabled; 354 nat_traversal_enabled_ = nat_traversal_enabled;
347 355
348 // Notify the web-app of the policy setting. 356 // Notify the web-app of the policy setting.
349 task_runner_->PostTask( 357 task_runner_->PostTask(
350 FROM_HERE, base::Bind(&It2MeHost::Observer::OnNatPolicyChanged, 358 FROM_HERE, base::Bind(&It2MeHost::Observer::OnNatPolicyChanged,
351 observer_, nat_traversal_enabled_)); 359 observer_, nat_traversal_enabled_));
352 } 360 }
353 361
354 void It2MeHost::UpdateHostDomainPolicy(const std::string& host_domain) { 362 void It2MeHost::UpdateHostDomainPolicy(const std::string& host_domain) {
355 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 363 DCHECK(network_task_runner_->BelongsToCurrentThread());
356 364
357 VLOG(2) << "UpdateHostDomainPolicy: " << host_domain; 365 VLOG(2) << "UpdateHostDomainPolicy: " << host_domain;
358 366
359 // When setting a host domain policy, force disconnect any existing session. 367 // When setting a host domain policy, force disconnect any existing session.
360 if (!host_domain.empty() && IsConnected()) { 368 if (!host_domain.empty() && IsConnected()) {
361 Disconnect(); 369 Disconnect();
362 } 370 }
363 371
364 required_host_domain_ = host_domain; 372 required_host_domain_ = host_domain;
365 } 373 }
366 374
367 It2MeHost::~It2MeHost() { 375 It2MeHost::~It2MeHost() {
368 // Check that resources that need to be torn down on the UI thread are gone. 376 // Check that resources that need to be torn down on the UI thread are gone.
369 DCHECK(!desktop_environment_factory_.get()); 377 DCHECK(!desktop_environment_factory_.get());
370 DCHECK(!policy_watcher_.get()); 378 DCHECK(!policy_watcher_.get());
371 } 379 }
372 380
373 void It2MeHost::SetState(It2MeHostState state) { 381 void It2MeHost::SetState(It2MeHostState state) {
374 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 382 DCHECK(network_task_runner_->BelongsToCurrentThread());
375 383
376 switch (state_) { 384 switch (state_) {
377 case kDisconnected: 385 case kDisconnected:
378 DCHECK(state == kStarting || 386 DCHECK(state == kStarting ||
379 state == kError) << state; 387 state == kError) << state;
380 break; 388 break;
381 case kStarting: 389 case kStarting:
382 DCHECK(state == kRequestedAccessCode || 390 DCHECK(state == kRequestedAccessCode ||
383 state == kDisconnecting || 391 state == kDisconnecting ||
384 state == kError || 392 state == kError ||
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 428
421 bool It2MeHost::IsConnected() const { 429 bool It2MeHost::IsConnected() const {
422 return state_ == kRequestedAccessCode || state_ == kReceivedAccessCode || 430 return state_ == kRequestedAccessCode || state_ == kReceivedAccessCode ||
423 state_ == kConnected; 431 state_ == kConnected;
424 } 432 }
425 433
426 void It2MeHost::OnReceivedSupportID( 434 void It2MeHost::OnReceivedSupportID(
427 bool success, 435 bool success,
428 const std::string& support_id, 436 const std::string& support_id,
429 const base::TimeDelta& lifetime) { 437 const base::TimeDelta& lifetime) {
430 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 438 DCHECK(network_task_runner_->BelongsToCurrentThread());
431 439
432 if (!success) { 440 if (!success) {
433 SetState(kError); 441 SetState(kError);
434 Disconnect(); 442 Disconnect();
435 return; 443 return;
436 } 444 }
437 445
438 std::string host_secret = GenerateSupportHostSecret(); 446 std::string host_secret = GenerateSupportHostSecret();
439 std::string access_code = support_id + host_secret; 447 std::string access_code = support_id + host_secret;
440 448
(...skipping 26 matching lines...) Expand all
467 ChromotingHostContext* context, 475 ChromotingHostContext* context,
468 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 476 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
469 base::WeakPtr<It2MeHost::Observer> observer, 477 base::WeakPtr<It2MeHost::Observer> observer,
470 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, 478 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
471 const std::string& directory_bot_jid) { 479 const std::string& directory_bot_jid) {
472 return new It2MeHost( 480 return new It2MeHost(
473 context, task_runner, observer, xmpp_server_config, directory_bot_jid); 481 context, task_runner, observer, xmpp_server_config, directory_bot_jid);
474 } 482 }
475 483
476 } // namespace remoting 484 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698