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 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 bool is_pressed = false; | 292 bool is_pressed = false; |
293 if (!data->GetInteger("usbKeycode", &usb_keycode) || | 293 if (!data->GetInteger("usbKeycode", &usb_keycode) || |
294 !data->GetBoolean("pressed", &is_pressed)) { | 294 !data->GetBoolean("pressed", &is_pressed)) { |
295 LOG(ERROR) << "Invalid injectKeyEvent."; | 295 LOG(ERROR) << "Invalid injectKeyEvent."; |
296 return; | 296 return; |
297 } | 297 } |
298 | 298 |
299 protocol::KeyEvent event; | 299 protocol::KeyEvent event; |
300 event.set_usb_keycode(usb_keycode); | 300 event.set_usb_keycode(usb_keycode); |
301 event.set_pressed(is_pressed); | 301 event.set_pressed(is_pressed); |
302 // Even though new hosts will ignore keycode, it's a required field. | |
303 event.set_keycode(0); | |
304 InjectKeyEvent(event); | 302 InjectKeyEvent(event); |
305 } else if (method == "remapKey") { | 303 } else if (method == "remapKey") { |
306 int from_keycode = 0; | 304 int from_keycode = 0; |
307 int to_keycode = 0; | 305 int to_keycode = 0; |
308 if (!data->GetInteger("fromKeycode", &from_keycode) || | 306 if (!data->GetInteger("fromKeycode", &from_keycode) || |
309 !data->GetInteger("toKeycode", &to_keycode)) { | 307 !data->GetInteger("toKeycode", &to_keycode)) { |
310 LOG(ERROR) << "Invalid remapKey."; | 308 LOG(ERROR) << "Invalid remapKey."; |
311 return; | 309 return; |
312 } | 310 } |
313 | 311 |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 PostChromotingMessage("logDebugMessage", data.Pass()); | 733 PostChromotingMessage("logDebugMessage", data.Pass()); |
736 g_logging_to_plugin = false; | 734 g_logging_to_plugin = false; |
737 } | 735 } |
738 | 736 |
739 bool ChromotingInstance::IsConnected() { | 737 bool ChromotingInstance::IsConnected() { |
740 return host_connection_.get() && | 738 return host_connection_.get() && |
741 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 739 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
742 } | 740 } |
743 | 741 |
744 } // namespace remoting | 742 } // namespace remoting |
OLD | NEW |