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