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 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 5 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return Var(); | 383 return Var(); |
384 } | 384 } |
385 config.local_jid = args[arg++].AsString(); | 385 config.local_jid = args[arg++].AsString(); |
386 | 386 |
387 if (!args[arg].is_string()) { | 387 if (!args[arg].is_string()) { |
388 *exception = Var("The shared_secret must be a string."); | 388 *exception = Var("The shared_secret must be a string."); |
389 return Var(); | 389 return Var(); |
390 } | 390 } |
391 config.shared_secret = args[arg++].AsString(); | 391 config.shared_secret = args[arg++].AsString(); |
392 | 392 |
393 // Older versions of the webapp do not supply the following two | 393 if (!args[arg].is_string()) { |
394 // parameters. | 394 *exception = Var("The authentication_methods must be a string."); |
395 | 395 return Var(); |
396 // By default use V1 authentication. | |
397 config.use_v1_authenticator = true; | |
398 if (args.size() > arg) { | |
399 if (!args[arg].is_string()) { | |
400 *exception = Var("The authentication_methods must be a string."); | |
401 return Var(); | |
402 } | |
403 | |
404 if (!ChromotingInstance::ParseAuthMethods( | |
405 args[arg++].AsString(), &config)) { | |
406 *exception = Var("No valid authentication methods specified."); | |
407 return Var(); | |
408 } | |
409 } | 396 } |
410 | 397 |
411 if (args.size() > arg) { | 398 if (!ChromotingInstance::ParseAuthMethods( |
412 if (!args[arg].is_string()) { | 399 args[arg++].AsString(), &config)) { |
413 *exception = Var("The authentication_tag must be a string."); | 400 *exception = Var("No valid authentication methods specified."); |
414 return Var(); | 401 return Var(); |
415 } | |
416 config.authentication_tag = args[arg++].AsString(); | |
417 } | 402 } |
418 | 403 |
| 404 if (!args[arg].is_string()) { |
| 405 *exception = Var("The authentication_tag must be a string."); |
| 406 return Var(); |
| 407 } |
| 408 config.authentication_tag = args[arg++].AsString(); |
| 409 |
419 if (args.size() != arg) { | 410 if (args.size() != arg) { |
420 *exception = Var("Too many agruments passed to connect()."); | 411 *exception = Var("Too many agruments passed to connect()."); |
421 return Var(); | 412 return Var(); |
422 } | 413 } |
423 | 414 |
424 VLOG(1) << "Connecting to host. " | 415 VLOG(1) << "Connecting to host. " |
425 << "client_jid: " << config.local_jid | 416 << "client_jid: " << config.local_jid |
426 << ", host_jid: " << config.host_jid; | 417 << ", host_jid: " << config.host_jid; |
427 instance_->Connect(config); | 418 instance_->Connect(config); |
428 | 419 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 const std::vector<pp::Var>& args, pp::Var* exception) { | 453 const std::vector<pp::Var>& args, pp::Var* exception) { |
463 if (args.size() != 0) { | 454 if (args.size() != 0) { |
464 *exception = Var("Usage: DoReleaseAllKeys()"); | 455 *exception = Var("Usage: DoReleaseAllKeys()"); |
465 return Var(); | 456 return Var(); |
466 } | 457 } |
467 instance_->ReleaseAllKeys(); | 458 instance_->ReleaseAllKeys(); |
468 return Var(); | 459 return Var(); |
469 } | 460 } |
470 | 461 |
471 } // namespace remoting | 462 } // namespace remoting |
OLD | NEW |