| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_scriptable_object.h" | 5 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 // TODO(wez): Remove this when crbug.com/86353 is complete. | 9 // TODO(wez): Remove this when crbug.com/86353 is complete. |
| 10 #include "ppapi/cpp/private/var_private.h" | 10 #include "ppapi/cpp/private/var_private.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 AddAttribute(kVideoEncodeLatencyAttribute, Var()); | 95 AddAttribute(kVideoEncodeLatencyAttribute, Var()); |
| 96 AddAttribute(kVideoDecodeLatencyAttribute, Var()); | 96 AddAttribute(kVideoDecodeLatencyAttribute, Var()); |
| 97 AddAttribute(kVideoRenderLatencyAttribute, Var()); | 97 AddAttribute(kVideoRenderLatencyAttribute, Var()); |
| 98 AddAttribute(kRoundTripLatencyAttribute, Var()); | 98 AddAttribute(kRoundTripLatencyAttribute, Var()); |
| 99 | 99 |
| 100 AddMethod("connect", &ChromotingScriptableObject::DoConnect); | 100 AddMethod("connect", &ChromotingScriptableObject::DoConnect); |
| 101 AddMethod("disconnect", &ChromotingScriptableObject::DoDisconnect); | 101 AddMethod("disconnect", &ChromotingScriptableObject::DoDisconnect); |
| 102 AddMethod("submitLoginInfo", &ChromotingScriptableObject::DoSubmitLogin); | 102 AddMethod("submitLoginInfo", &ChromotingScriptableObject::DoSubmitLogin); |
| 103 AddMethod("setScaleToFit", &ChromotingScriptableObject::DoSetScaleToFit); | 103 AddMethod("setScaleToFit", &ChromotingScriptableObject::DoSetScaleToFit); |
| 104 AddMethod("onIq", &ChromotingScriptableObject::DoOnIq); | 104 AddMethod("onIq", &ChromotingScriptableObject::DoOnIq); |
| 105 AddMethod("releaseAllKeys", &ChromotingScriptableObject::DoReleaseAllKeys); |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool ChromotingScriptableObject::HasProperty(const Var& name, Var* exception) { | 108 bool ChromotingScriptableObject::HasProperty(const Var& name, Var* exception) { |
| 108 // TODO(ajwong): Check if all these name.is_string() sentinels are required. | 109 // TODO(ajwong): Check if all these name.is_string() sentinels are required. |
| 109 if (!name.is_string()) { | 110 if (!name.is_string()) { |
| 110 *exception = Var("HasProperty expects a string for the name."); | 111 *exception = Var("HasProperty expects a string for the name."); |
| 111 return false; | 112 return false; |
| 112 } | 113 } |
| 113 | 114 |
| 114 PropertyNameMap::const_iterator iter = property_names_.find(name.AsString()); | 115 PropertyNameMap::const_iterator iter = property_names_.find(name.AsString()); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 if (!args[0].is_string()) { | 451 if (!args[0].is_string()) { |
| 451 *exception = Var("response_xml must be a string."); | 452 *exception = Var("response_xml must be a string."); |
| 452 return Var(); | 453 return Var(); |
| 453 } | 454 } |
| 454 | 455 |
| 455 xmpp_proxy_->OnIq(args[0].AsString()); | 456 xmpp_proxy_->OnIq(args[0].AsString()); |
| 456 | 457 |
| 457 return Var(); | 458 return Var(); |
| 458 } | 459 } |
| 459 | 460 |
| 461 Var ChromotingScriptableObject::DoReleaseAllKeys( |
| 462 const std::vector<pp::Var>& args, pp::Var* exception) { |
| 463 if (args.size() != 0) { |
| 464 *exception = Var("Usage: DoReleaseAllKeys()"); |
| 465 return Var(); |
| 466 } |
| 467 instance_->ReleaseAllKeys(); |
| 468 return Var(); |
| 469 } |
| 470 |
| 460 } // namespace remoting | 471 } // namespace remoting |
| OLD | NEW |