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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 base::LazyInstance<base::Lock>::Leaky | 167 base::LazyInstance<base::Lock>::Leaky |
168 g_logging_lock = LAZY_INSTANCE_INITIALIZER; | 168 g_logging_lock = LAZY_INSTANCE_INITIALIZER; |
169 logging::LogMessageHandlerFunction g_logging_old_handler = NULL; | 169 logging::LogMessageHandlerFunction g_logging_old_handler = NULL; |
170 | 170 |
171 } // namespace | 171 } // namespace |
172 | 172 |
173 // String sent in the "hello" message to the webapp to describe features. | 173 // String sent in the "hello" message to the webapp to describe features. |
174 const char ChromotingInstance::kApiFeatures[] = | 174 const char ChromotingInstance::kApiFeatures[] = |
175 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " | 175 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " |
176 "notifyClientResolution pauseVideo pauseAudio asyncPin thirdPartyAuth " | 176 "notifyClientResolution pauseVideo pauseAudio asyncPin thirdPartyAuth " |
177 "pinlessAuth extensionMessage allowMouseLock mediaSourceRendering"; | 177 "pinlessAuth extensionMessage allowMouseLock mediaSourceRendering " |
178 "sendMouseInputWhenUnfocused"; | |
Wez
2014/05/22 01:14:23
nit: Unless there is some fallback behaviour the a
Jamie
2014/05/22 01:32:09
Done.
| |
178 | 179 |
179 const char ChromotingInstance::kRequestedCapabilities[] = ""; | 180 const char ChromotingInstance::kRequestedCapabilities[] = ""; |
180 const char ChromotingInstance::kSupportedCapabilities[] = "desktopShape"; | 181 const char ChromotingInstance::kSupportedCapabilities[] = "desktopShape"; |
181 | 182 |
182 bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str, | 183 bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str, |
183 ClientConfig* config) { | 184 ClientConfig* config) { |
184 std::vector<std::string> auth_methods; | 185 std::vector<std::string> auth_methods; |
185 base::SplitString(auth_methods_str, ',', &auth_methods); | 186 base::SplitString(auth_methods_str, ',', &auth_methods); |
186 for (std::vector<std::string>::iterator it = auth_methods.begin(); | 187 for (std::vector<std::string>::iterator it = auth_methods.begin(); |
187 it != auth_methods.end(); ++it) { | 188 it != auth_methods.end(); ++it) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 } else if (method == "onThirdPartyTokenFetched") { | 333 } else if (method == "onThirdPartyTokenFetched") { |
333 HandleOnThirdPartyTokenFetched(*data); | 334 HandleOnThirdPartyTokenFetched(*data); |
334 } else if (method == "requestPairing") { | 335 } else if (method == "requestPairing") { |
335 HandleRequestPairing(*data); | 336 HandleRequestPairing(*data); |
336 } else if (method == "extensionMessage") { | 337 } else if (method == "extensionMessage") { |
337 HandleExtensionMessage(*data); | 338 HandleExtensionMessage(*data); |
338 } else if (method == "allowMouseLock") { | 339 } else if (method == "allowMouseLock") { |
339 HandleAllowMouseLockMessage(); | 340 HandleAllowMouseLockMessage(); |
340 } else if (method == "enableMediaSourceRendering") { | 341 } else if (method == "enableMediaSourceRendering") { |
341 HandleEnableMediaSourceRendering(); | 342 HandleEnableMediaSourceRendering(); |
343 } else if (method == "sendMouseInputWhenUnfocused") { | |
344 HandleSendMouseInputWhenUnfocused(); | |
342 } | 345 } |
343 } | 346 } |
344 | 347 |
345 void ChromotingInstance::DidChangeFocus(bool has_focus) { | 348 void ChromotingInstance::DidChangeFocus(bool has_focus) { |
346 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 349 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
347 | 350 |
348 input_handler_.DidChangeFocus(has_focus); | 351 input_handler_.DidChangeFocus(has_focus); |
349 } | 352 } |
350 | 353 |
351 void ChromotingInstance::DidChangeView(const pp::View& view) { | 354 void ChromotingInstance::DidChangeView(const pp::View& view) { |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
911 } | 914 } |
912 | 915 |
913 void ChromotingInstance::HandleAllowMouseLockMessage() { | 916 void ChromotingInstance::HandleAllowMouseLockMessage() { |
914 input_handler_.AllowMouseLock(); | 917 input_handler_.AllowMouseLock(); |
915 } | 918 } |
916 | 919 |
917 void ChromotingInstance::HandleEnableMediaSourceRendering() { | 920 void ChromotingInstance::HandleEnableMediaSourceRendering() { |
918 use_media_source_rendering_ = true; | 921 use_media_source_rendering_ = true; |
919 } | 922 } |
920 | 923 |
924 void ChromotingInstance::HandleSendMouseInputWhenUnfocused() { | |
925 input_handler_.SendMouseInputWhenUnfocused(); | |
926 } | |
927 | |
921 ChromotingStats* ChromotingInstance::GetStats() { | 928 ChromotingStats* ChromotingInstance::GetStats() { |
922 if (!video_renderer_.get()) | 929 if (!video_renderer_.get()) |
923 return NULL; | 930 return NULL; |
924 return video_renderer_->GetStats(); | 931 return video_renderer_->GetStats(); |
925 } | 932 } |
926 | 933 |
927 void ChromotingInstance::PostChromotingMessage(const std::string& method, | 934 void ChromotingInstance::PostChromotingMessage(const std::string& method, |
928 const pp::VarDictionary& data) { | 935 const pp::VarDictionary& data) { |
929 pp::VarDictionary message; | 936 pp::VarDictionary message; |
930 message.Set(pp::Var("method"), pp::Var(method)); | 937 message.Set(pp::Var("method"), pp::Var(method)); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1123 pp::VarArrayBuffer array_buffer(buffer_size); | 1130 pp::VarArrayBuffer array_buffer(buffer_size); |
1124 void* data_ptr = array_buffer.Map(); | 1131 void* data_ptr = array_buffer.Map(); |
1125 memcpy(data_ptr, buffer, buffer_size); | 1132 memcpy(data_ptr, buffer, buffer_size); |
1126 array_buffer.Unmap(); | 1133 array_buffer.Unmap(); |
1127 pp::VarDictionary data_dictionary; | 1134 pp::VarDictionary data_dictionary; |
1128 data_dictionary.Set(pp::Var("buffer"), array_buffer); | 1135 data_dictionary.Set(pp::Var("buffer"), array_buffer); |
1129 PostChromotingMessage("mediaSourceData", data_dictionary); | 1136 PostChromotingMessage("mediaSourceData", data_dictionary); |
1130 } | 1137 } |
1131 | 1138 |
1132 } // namespace remoting | 1139 } // namespace remoting |
OLD | NEW |