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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 base::Bind(&ChromotingInstance::UpdateUmaCustomHistogram, | 651 base::Bind(&ChromotingInstance::UpdateUmaCustomHistogram, |
652 weak_factory_.GetWeakPtr(), true), | 652 weak_factory_.GetWeakPtr(), true), |
653 base::Bind(&ChromotingInstance::UpdateUmaCustomHistogram, | 653 base::Bind(&ChromotingInstance::UpdateUmaCustomHistogram, |
654 weak_factory_.GetWeakPtr(), false), | 654 weak_factory_.GetWeakPtr(), false), |
655 base::Bind(&ChromotingInstance::UpdateUmaEnumHistogram, | 655 base::Bind(&ChromotingInstance::UpdateUmaEnumHistogram, |
656 weak_factory_.GetWeakPtr())); | 656 weak_factory_.GetWeakPtr())); |
657 | 657 |
658 if (!plugin_view_.is_null()) | 658 if (!plugin_view_.is_null()) |
659 video_renderer_->OnViewChanged(plugin_view_); | 659 video_renderer_->OnViewChanged(plugin_view_); |
660 | 660 |
661 client_.reset( | 661 if (!audio_player_) { |
662 new ChromotingClient(&context_, this, video_renderer_.get(), | 662 audio_player_.reset(new PepperAudioPlayer(this)); |
663 base::WrapUnique(new PepperAudioPlayer(this)))); | 663 } |
| 664 |
| 665 client_.reset(new ChromotingClient(&context_, this, video_renderer_.get(), |
| 666 audio_player_->GetWeakPtr())); |
664 | 667 |
665 // Setup the signal strategy. | 668 // Setup the signal strategy. |
666 signal_strategy_.reset(new DelegatingSignalStrategy( | 669 signal_strategy_.reset(new DelegatingSignalStrategy( |
667 local_jid, base::Bind(&ChromotingInstance::SendOutgoingIq, | 670 local_jid, base::Bind(&ChromotingInstance::SendOutgoingIq, |
668 weak_factory_.GetWeakPtr()))); | 671 weak_factory_.GetWeakPtr()))); |
669 | 672 |
670 // Create TransportContext. | 673 // Create TransportContext. |
671 scoped_refptr<protocol::TransportContext> transport_context( | 674 scoped_refptr<protocol::TransportContext> transport_context( |
672 new protocol::TransportContext( | 675 new protocol::TransportContext( |
673 signal_strategy_.get(), | 676 signal_strategy_.get(), |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 | 969 |
967 void ChromotingInstance::Disconnect() { | 970 void ChromotingInstance::Disconnect() { |
968 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 971 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
969 | 972 |
970 VLOG(0) << "Disconnecting from host."; | 973 VLOG(0) << "Disconnecting from host."; |
971 | 974 |
972 // Disconnect the input pipeline and teardown the connection. | 975 // Disconnect the input pipeline and teardown the connection. |
973 mouse_input_filter_.set_input_stub(nullptr); | 976 mouse_input_filter_.set_input_stub(nullptr); |
974 client_.reset(); | 977 client_.reset(); |
975 video_renderer_.reset(); | 978 video_renderer_.reset(); |
| 979 audio_player_.reset(); |
976 stats_update_timer_.Stop(); | 980 stats_update_timer_.Stop(); |
977 } | 981 } |
978 | 982 |
979 void ChromotingInstance::PostChromotingMessage(const std::string& method, | 983 void ChromotingInstance::PostChromotingMessage(const std::string& method, |
980 const pp::VarDictionary& data) { | 984 const pp::VarDictionary& data) { |
981 pp::VarDictionary message; | 985 pp::VarDictionary message; |
982 message.Set(pp::Var("method"), pp::Var(method)); | 986 message.Set(pp::Var("method"), pp::Var(method)); |
983 message.Set(pp::Var("data"), data); | 987 message.Set(pp::Var("data"), data); |
984 PostMessage(message); | 988 PostMessage(message); |
985 } | 989 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 | 1055 |
1052 // Unregister this instance for logging. | 1056 // Unregister this instance for logging. |
1053 g_logging_instance = 0; | 1057 g_logging_instance = 0; |
1054 } | 1058 } |
1055 | 1059 |
1056 // static | 1060 // static |
1057 bool ChromotingInstance::LogToUI(int severity, const char* file, int line, | 1061 bool ChromotingInstance::LogToUI(int severity, const char* file, int line, |
1058 size_t message_start, | 1062 size_t message_start, |
1059 const std::string& str) { | 1063 const std::string& str) { |
1060 PP_LogLevel log_level = PP_LOGLEVEL_ERROR; | 1064 PP_LogLevel log_level = PP_LOGLEVEL_ERROR; |
1061 switch(severity) { | 1065 switch (severity) { |
1062 case logging::LOG_INFO: | 1066 case logging::LOG_INFO: |
1063 log_level = PP_LOGLEVEL_TIP; | 1067 log_level = PP_LOGLEVEL_TIP; |
1064 break; | 1068 break; |
1065 case logging::LOG_WARNING: | 1069 case logging::LOG_WARNING: |
1066 log_level = PP_LOGLEVEL_WARNING; | 1070 log_level = PP_LOGLEVEL_WARNING; |
1067 break; | 1071 break; |
1068 case logging::LOG_ERROR: | 1072 case logging::LOG_ERROR: |
1069 case logging::LOG_FATAL: | 1073 case logging::LOG_FATAL: |
1070 log_level = PP_LOGLEVEL_ERROR; | 1074 log_level = PP_LOGLEVEL_ERROR; |
1071 break; | 1075 break; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 if (is_custom_counts_histogram) { | 1122 if (is_custom_counts_histogram) { |
1119 uma.HistogramCustomCounts(histogram_name, value, histogram_min, | 1123 uma.HistogramCustomCounts(histogram_name, value, histogram_min, |
1120 histogram_max, histogram_buckets); | 1124 histogram_max, histogram_buckets); |
1121 } else { | 1125 } else { |
1122 uma.HistogramCustomTimes(histogram_name, value, histogram_min, | 1126 uma.HistogramCustomTimes(histogram_name, value, histogram_min, |
1123 histogram_max, histogram_buckets); | 1127 histogram_max, histogram_buckets); |
1124 } | 1128 } |
1125 } | 1129 } |
1126 | 1130 |
1127 } // namespace remoting | 1131 } // namespace remoting |
OLD | NEW |