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 if (!args[arg].is_string()) { | 393 // Older versions of the webapp do not supply the following two |
394 *exception = Var("The authentication_methods must be a string."); | 394 // parameters. |
395 return Var(); | 395 |
| 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 } |
396 } | 409 } |
397 | 410 |
398 if (!ChromotingInstance::ParseAuthMethods( | 411 if (args.size() > arg) { |
399 args[arg++].AsString(), &config)) { | 412 if (!args[arg].is_string()) { |
400 *exception = Var("No valid authentication methods specified."); | 413 *exception = Var("The authentication_tag must be a string."); |
401 return Var(); | 414 return Var(); |
| 415 } |
| 416 config.authentication_tag = args[arg++].AsString(); |
402 } | 417 } |
403 | 418 |
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 | |
410 if (args.size() != arg) { | 419 if (args.size() != arg) { |
411 *exception = Var("Too many agruments passed to connect()."); | 420 *exception = Var("Too many agruments passed to connect()."); |
412 return Var(); | 421 return Var(); |
413 } | 422 } |
414 | 423 |
415 VLOG(1) << "Connecting to host. " | 424 VLOG(1) << "Connecting to host. " |
416 << "client_jid: " << config.local_jid | 425 << "client_jid: " << config.local_jid |
417 << ", host_jid: " << config.host_jid; | 426 << ", host_jid: " << config.host_jid; |
418 instance_->Connect(config); | 427 instance_->Connect(config); |
419 | 428 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 const std::vector<pp::Var>& args, pp::Var* exception) { | 462 const std::vector<pp::Var>& args, pp::Var* exception) { |
454 if (args.size() != 0) { | 463 if (args.size() != 0) { |
455 *exception = Var("Usage: DoReleaseAllKeys()"); | 464 *exception = Var("Usage: DoReleaseAllKeys()"); |
456 return Var(); | 465 return Var(); |
457 } | 466 } |
458 instance_->ReleaseAllKeys(); | 467 instance_->ReleaseAllKeys(); |
459 return Var(); | 468 return Var(); |
460 } | 469 } |
461 | 470 |
462 } // namespace remoting | 471 } // namespace remoting |
OLD | NEW |