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_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <nacl_io/nacl_io.h> | 7 #include <nacl_io/nacl_io.h> |
8 #include <sys/mount.h> | 8 #include <sys/mount.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 pp::VarDictionary dictionary; | 572 pp::VarDictionary dictionary; |
573 dictionary.Set(pp::Var("width"), cursor_shape.width()); | 573 dictionary.Set(pp::Var("width"), cursor_shape.width()); |
574 dictionary.Set(pp::Var("height"), cursor_shape.height()); | 574 dictionary.Set(pp::Var("height"), cursor_shape.height()); |
575 dictionary.Set(pp::Var("hotspotX"), cursor_shape.hotspot_x()); | 575 dictionary.Set(pp::Var("hotspotX"), cursor_shape.hotspot_x()); |
576 dictionary.Set(pp::Var("hotspotY"), cursor_shape.hotspot_y()); | 576 dictionary.Set(pp::Var("hotspotY"), cursor_shape.hotspot_y()); |
577 dictionary.Set(pp::Var("data"), array_buffer); | 577 dictionary.Set(pp::Var("data"), array_buffer); |
578 PostChromotingMessage("setCursorShape", dictionary); | 578 PostChromotingMessage("setCursorShape", dictionary); |
579 } | 579 } |
580 | 580 |
581 void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { | 581 void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { |
582 protocol::ClientAuthenticationConfig client_auth_config; | |
583 | |
584 std::string local_jid; | 582 std::string local_jid; |
585 std::string host_jid; | 583 std::string host_jid; |
586 std::string host_public_key; | 584 std::string host_public_key; |
| 585 std::string authentication_tag; |
587 if (!data.GetString("hostJid", &host_jid) || | 586 if (!data.GetString("hostJid", &host_jid) || |
588 !data.GetString("hostPublicKey", &host_public_key) || | 587 !data.GetString("hostPublicKey", &host_public_key) || |
589 !data.GetString("localJid", &local_jid) || | 588 !data.GetString("localJid", &local_jid) || |
590 !data.GetString("hostId", &client_auth_config.host_id)) { | 589 !data.GetString("authenticationTag", &authentication_tag)) { |
591 LOG(ERROR) << "Invalid connect() data."; | 590 LOG(ERROR) << "Invalid connect() data."; |
592 return; | 591 return; |
593 } | 592 } |
594 | 593 |
595 data.GetString("clientPairingId", &client_auth_config.pairing_client_id); | 594 std::string client_pairing_id; |
596 data.GetString("clientPairedSecret", &client_auth_config.pairing_secret); | 595 data.GetString("clientPairingId", &client_pairing_id); |
| 596 std::string client_paired_secret; |
| 597 data.GetString("clientPairedSecret", &client_paired_secret); |
597 | 598 |
| 599 protocol::FetchSecretCallback fetch_secret_callback; |
598 if (use_async_pin_dialog_) { | 600 if (use_async_pin_dialog_) { |
599 client_auth_config.fetch_secret_callback = base::Bind( | 601 fetch_secret_callback = base::Bind( |
600 &ChromotingInstance::FetchSecretFromDialog, weak_factory_.GetWeakPtr()); | 602 &ChromotingInstance::FetchSecretFromDialog, weak_factory_.GetWeakPtr()); |
601 } else { | 603 } else { |
602 std::string shared_secret; | 604 std::string shared_secret; |
603 if (!data.GetString("sharedSecret", &shared_secret)) { | 605 if (!data.GetString("sharedSecret", &shared_secret)) { |
604 LOG(ERROR) << "sharedSecret not specified in connect()."; | 606 LOG(ERROR) << "sharedSecret not specified in connect()."; |
605 return; | 607 return; |
606 } | 608 } |
607 client_auth_config.fetch_secret_callback = | 609 fetch_secret_callback = |
608 base::Bind(&ChromotingInstance::FetchSecretFromString, shared_secret); | 610 base::Bind(&ChromotingInstance::FetchSecretFromString, shared_secret); |
609 } | 611 } |
610 | 612 |
611 client_auth_config.fetch_third_party_token_callback = | |
612 base::Bind(&ChromotingInstance::FetchThirdPartyToken, | |
613 weak_factory_.GetWeakPtr(), host_public_key); | |
614 | |
615 // Read the list of capabilities, if any. | 613 // Read the list of capabilities, if any. |
616 std::string capabilities; | 614 std::string capabilities; |
617 if (data.HasKey("capabilities")) { | 615 if (data.HasKey("capabilities")) { |
618 if (!data.GetString("capabilities", &capabilities)) { | 616 if (!data.GetString("capabilities", &capabilities)) { |
619 LOG(ERROR) << "Invalid connect() data."; | 617 LOG(ERROR) << "Invalid connect() data."; |
620 return; | 618 return; |
621 } | 619 } |
622 } | 620 } |
623 | 621 |
624 // Read and parse list of experiments. | 622 // Read and parse list of experiments. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 // Create TransportContext. | 688 // Create TransportContext. |
691 scoped_refptr<protocol::TransportContext> transport_context( | 689 scoped_refptr<protocol::TransportContext> transport_context( |
692 new protocol::TransportContext( | 690 new protocol::TransportContext( |
693 signal_strategy_.get(), | 691 signal_strategy_.get(), |
694 make_scoped_ptr(new PepperPortAllocatorFactory(this)), | 692 make_scoped_ptr(new PepperPortAllocatorFactory(this)), |
695 make_scoped_ptr(new PepperUrlRequestFactory(this)), | 693 make_scoped_ptr(new PepperUrlRequestFactory(this)), |
696 protocol::NetworkSettings( | 694 protocol::NetworkSettings( |
697 protocol::NetworkSettings::NAT_TRAVERSAL_FULL), | 695 protocol::NetworkSettings::NAT_TRAVERSAL_FULL), |
698 protocol::TransportRole::CLIENT)); | 696 protocol::TransportRole::CLIENT)); |
699 | 697 |
| 698 // Create Authenticator. |
| 699 protocol::FetchThirdPartyTokenCallback fetch_third_party_token_callback = |
| 700 base::Bind(&ChromotingInstance::FetchThirdPartyToken, |
| 701 weak_factory_.GetWeakPtr(), host_public_key); |
| 702 |
| 703 scoped_ptr<protocol::Authenticator> authenticator( |
| 704 new protocol::NegotiatingClientAuthenticator( |
| 705 client_pairing_id, client_paired_secret, authentication_tag, |
| 706 fetch_secret_callback, fetch_third_party_token_callback)); |
| 707 |
700 scoped_ptr<protocol::CandidateSessionConfig> config = | 708 scoped_ptr<protocol::CandidateSessionConfig> config = |
701 protocol::CandidateSessionConfig::CreateDefault(); | 709 protocol::CandidateSessionConfig::CreateDefault(); |
702 if (std::find(experiments_list.begin(), experiments_list.end(), "vp9") != | 710 if (std::find(experiments_list.begin(), experiments_list.end(), "vp9") != |
703 experiments_list.end()) { | 711 experiments_list.end()) { |
704 config->set_vp9_experiment_enabled(true); | 712 config->set_vp9_experiment_enabled(true); |
705 } | 713 } |
706 client_->set_protocol_config(std::move(config)); | 714 client_->set_protocol_config(std::move(config)); |
707 | 715 |
708 // Kick off the connection. | 716 // Kick off the connection. |
709 client_->Start(signal_strategy_.get(), client_auth_config, transport_context, | 717 client_->Start(signal_strategy_.get(), std::move(authenticator), |
710 host_jid, capabilities); | 718 transport_context, host_jid, capabilities); |
711 | 719 |
712 // Connect the input pipeline to the protocol stub. | 720 // Connect the input pipeline to the protocol stub. |
713 mouse_input_filter_.set_input_stub(client_->input_stub()); | 721 mouse_input_filter_.set_input_stub(client_->input_stub()); |
714 if (!plugin_view_.is_null()) { | 722 if (!plugin_view_.is_null()) { |
715 webrtc::DesktopSize size(plugin_view_.GetRect().width(), | 723 webrtc::DesktopSize size(plugin_view_.GetRect().width(), |
716 plugin_view_.GetRect().height()); | 724 plugin_view_.GetRect().height()); |
717 mouse_input_filter_.set_input_size(size); | 725 mouse_input_filter_.set_input_size(size); |
718 touch_input_scaler_.set_input_size(size); | 726 touch_input_scaler_.set_input_size(size); |
719 } | 727 } |
720 | 728 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 if (is_custom_counts_histogram) { | 1140 if (is_custom_counts_histogram) { |
1133 uma.HistogramCustomCounts(histogram_name, value, histogram_min, | 1141 uma.HistogramCustomCounts(histogram_name, value, histogram_min, |
1134 histogram_max, histogram_buckets); | 1142 histogram_max, histogram_buckets); |
1135 } else { | 1143 } else { |
1136 uma.HistogramCustomTimes(histogram_name, value, histogram_min, | 1144 uma.HistogramCustomTimes(histogram_name, value, histogram_min, |
1137 histogram_max, histogram_buckets); | 1145 histogram_max, histogram_buckets); |
1138 } | 1146 } |
1139 } | 1147 } |
1140 | 1148 |
1141 } // namespace remoting | 1149 } // namespace remoting |
OLD | NEW |