Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 11192042: Protocol plumbing for audio toggle. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/client/plugin/chromoting_instance.h ('k') | remoting/host/client_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 g_logging_instance = LAZY_INSTANCE_INITIALIZER; 119 g_logging_instance = LAZY_INSTANCE_INITIALIZER;
120 base::LazyInstance<base::Lock>::Leaky 120 base::LazyInstance<base::Lock>::Leaky
121 g_logging_lock = LAZY_INSTANCE_INITIALIZER; 121 g_logging_lock = LAZY_INSTANCE_INITIALIZER;
122 logging::LogMessageHandlerFunction g_logging_old_handler = NULL; 122 logging::LogMessageHandlerFunction g_logging_old_handler = NULL;
123 123
124 } // namespace 124 } // namespace
125 125
126 // String sent in the "hello" message to the plugin to describe features. 126 // String sent in the "hello" message to the plugin to describe features.
127 const char ChromotingInstance::kApiFeatures[] = 127 const char ChromotingInstance::kApiFeatures[] =
128 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " 128 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey "
129 "notifyClientDimensions pauseVideo"; 129 "notifyClientDimensions pauseVideo pauseAudio";
130 130
131 bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str, 131 bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str,
132 ClientConfig* config) { 132 ClientConfig* config) {
133 std::vector<std::string> auth_methods; 133 std::vector<std::string> auth_methods;
134 base::SplitString(auth_methods_str, ',', &auth_methods); 134 base::SplitString(auth_methods_str, ',', &auth_methods);
135 for (std::vector<std::string>::iterator it = auth_methods.begin(); 135 for (std::vector<std::string>::iterator it = auth_methods.begin();
136 it != auth_methods.end(); ++it) { 136 it != auth_methods.end(); ++it) {
137 protocol::AuthenticationMethod authentication_method = 137 protocol::AuthenticationMethod authentication_method =
138 protocol::AuthenticationMethod::FromString(*it); 138 protocol::AuthenticationMethod::FromString(*it);
139 if (authentication_method.is_valid()) 139 if (authentication_method.is_valid())
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return; 338 return;
339 } 339 }
340 NotifyClientDimensions(width, height); 340 NotifyClientDimensions(width, height);
341 } else if (method == "pauseVideo") { 341 } else if (method == "pauseVideo") {
342 bool pause = false; 342 bool pause = false;
343 if (!data->GetBoolean("pause", &pause)) { 343 if (!data->GetBoolean("pause", &pause)) {
344 LOG(ERROR) << "Invalid pauseVideo."; 344 LOG(ERROR) << "Invalid pauseVideo.";
345 return; 345 return;
346 } 346 }
347 PauseVideo(pause); 347 PauseVideo(pause);
348 } else if (method == "pauseAudio") {
349 bool pause = false;
350 if (!data->GetBoolean("pause", &pause)) {
351 LOG(ERROR) << "Invalid pauseAudio.";
352 return;
353 }
354 PauseAudio(pause);
348 } 355 }
349 } 356 }
350 357
351 void ChromotingInstance::DidChangeView(const pp::View& view) { 358 void ChromotingInstance::DidChangeView(const pp::View& view) {
352 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); 359 DCHECK(plugin_task_runner_->BelongsToCurrentThread());
353 360
354 view_->SetView(view); 361 view_->SetView(view);
355 362
356 mouse_input_filter_.set_input_size(view_->get_view_size_dips()); 363 mouse_input_filter_.set_input_size(view_->get_view_size_dips());
357 } 364 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 580
574 void ChromotingInstance::PauseVideo(bool pause) { 581 void ChromotingInstance::PauseVideo(bool pause) {
575 if (!IsConnected()) { 582 if (!IsConnected()) {
576 return; 583 return;
577 } 584 }
578 protocol::VideoControl video_control; 585 protocol::VideoControl video_control;
579 video_control.set_enable(!pause); 586 video_control.set_enable(!pause);
580 host_connection_->host_stub()->ControlVideo(video_control); 587 host_connection_->host_stub()->ControlVideo(video_control);
581 } 588 }
582 589
590 void ChromotingInstance::PauseAudio(bool pause) {
591 if (!IsConnected()) {
592 return;
593 }
594 protocol::AudioControl audio_control;
595 audio_control.set_enable(!pause);
596 host_connection_->host_stub()->ControlAudio(audio_control);
597 }
598
583 ChromotingStats* ChromotingInstance::GetStats() { 599 ChromotingStats* ChromotingInstance::GetStats() {
584 if (!client_.get()) 600 if (!client_.get())
585 return NULL; 601 return NULL;
586 return client_->GetStats(); 602 return client_->GetStats();
587 } 603 }
588 604
589 void ChromotingInstance::PostChromotingMessage( 605 void ChromotingInstance::PostChromotingMessage(
590 const std::string& method, 606 const std::string& method,
591 scoped_ptr<base::DictionaryValue> data) { 607 scoped_ptr<base::DictionaryValue> data) {
592 scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue()); 608 scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 PostChromotingMessage("logDebugMessage", data.Pass()); 749 PostChromotingMessage("logDebugMessage", data.Pass());
734 g_logging_to_plugin = false; 750 g_logging_to_plugin = false;
735 } 751 }
736 752
737 bool ChromotingInstance::IsConnected() { 753 bool ChromotingInstance::IsConnected() {
738 return host_connection_.get() && 754 return host_connection_.get() &&
739 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); 755 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED);
740 } 756 }
741 757
742 } // namespace remoting 758 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/chromoting_instance.h ('k') | remoting/host/client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698