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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #if defined(OS_NACL) | 10 #if defined(OS_NACL) |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 const pp::VarDictionary& data) { | 1009 const pp::VarDictionary& data) { |
1010 pp::VarDictionary message; | 1010 pp::VarDictionary message; |
1011 message.Set(pp::Var("method"), pp::Var(method)); | 1011 message.Set(pp::Var("method"), pp::Var(method)); |
1012 message.Set(pp::Var("data"), data); | 1012 message.Set(pp::Var("data"), data); |
1013 PostMessage(message); | 1013 PostMessage(message); |
1014 } | 1014 } |
1015 | 1015 |
1016 void ChromotingInstance::PostLegacyJsonMessage( | 1016 void ChromotingInstance::PostLegacyJsonMessage( |
1017 const std::string& method, | 1017 const std::string& method, |
1018 scoped_ptr<base::DictionaryValue> data) { | 1018 scoped_ptr<base::DictionaryValue> data) { |
1019 scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue()); | 1019 base::DictionaryValue message; |
1020 message->SetString("method", method); | 1020 message.SetString("method", method); |
1021 message->Set("data", data.release()); | 1021 message.Set("data", data.release()); |
1022 | 1022 |
1023 std::string message_json; | 1023 std::string message_json; |
1024 base::JSONWriter::Write(message.get(), &message_json); | 1024 base::JSONWriter::Write(message, &message_json); |
1025 PostMessage(pp::Var(message_json)); | 1025 PostMessage(pp::Var(message_json)); |
1026 } | 1026 } |
1027 | 1027 |
1028 void ChromotingInstance::SendTrappedKey(uint32 usb_keycode, bool pressed) { | 1028 void ChromotingInstance::SendTrappedKey(uint32 usb_keycode, bool pressed) { |
1029 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 1029 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
1030 data->SetInteger("usbKeycode", usb_keycode); | 1030 data->SetInteger("usbKeycode", usb_keycode); |
1031 data->SetBoolean("pressed", pressed); | 1031 data->SetBoolean("pressed", pressed); |
1032 PostLegacyJsonMessage("trappedKeyEvent", data.Pass()); | 1032 PostLegacyJsonMessage("trappedKeyEvent", data.Pass()); |
1033 } | 1033 } |
1034 | 1034 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 | 1190 |
1191 #if !defined(OS_NACL) | 1191 #if !defined(OS_NACL) |
1192 // Log messages are forwarded to the webapp only in PNaCl version of the | 1192 // Log messages are forwarded to the webapp only in PNaCl version of the |
1193 // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl | 1193 // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl |
1194 // version. | 1194 // version. |
1195 ProcessLogToUI(message); | 1195 ProcessLogToUI(message); |
1196 #endif // !defined(OS_NACL) | 1196 #endif // !defined(OS_NACL) |
1197 } | 1197 } |
1198 | 1198 |
1199 } // namespace remoting | 1199 } // namespace remoting |
OLD | NEW |