summaryrefslogtreecommitdiffstats
path: root/remoting/client
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 03:50:18 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 03:50:18 +0000
commit22f51e120a84ddc3f144e8e455620ebc82387948 (patch)
tree0643d947a10d71ac8450a1dfcbabd0caef405538 /remoting/client
parent5b33ab7789d9eadf8403243866b4550d99b70d22 (diff)
downloadchromium_src-22f51e120a84ddc3f144e8e455620ebc82387948.zip
chromium_src-22f51e120a84ddc3f144e8e455620ebc82387948.tar.gz
chromium_src-22f51e120a84ddc3f144e8e455620ebc82387948.tar.bz2
Switch Chromoting to use Pepper's GetCode API instead of GetUsbKeycode API.
This is in preparation for removing the deprecated GetUsbKeycode API from the KeyboardInputEvent Dev interface. Note that Chromotocol stays the same - we still send USB codes across the wire. BUG= Review URL: https://codereview.chromium.org/86673002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237498 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r--remoting/client/DEPS1
-rw-r--r--remoting/client/plugin/pepper_input_handler.cc13
2 files changed, 13 insertions, 1 deletions
diff --git a/remoting/client/DEPS b/remoting/client/DEPS
index 235d972..3dc689a 100644
--- a/remoting/client/DEPS
+++ b/remoting/client/DEPS
@@ -2,6 +2,7 @@ include_rules = [
"+ppapi",
"+jingle/glue",
"+net",
+ "+ui/events/keycodes/dom4",
"+remoting/codec",
"+remoting/protocol",
diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc
index 10166b8..d4b6f60 100644
--- a/remoting/client/plugin/pepper_input_handler.cc
+++ b/remoting/client/plugin/pepper_input_handler.cc
@@ -11,7 +11,9 @@
#include "ppapi/cpp/module_impl.h"
#include "ppapi/cpp/mouse_cursor.h"
#include "ppapi/cpp/point.h"
+#include "ppapi/cpp/var.h"
#include "remoting/proto/event.pb.h"
+#include "ui/events/keycodes/dom4/keycode_converter.h"
namespace remoting {
@@ -41,7 +43,16 @@ uint32_t GetUsbKeyCode(pp::KeyboardInputEvent pp_key_event) {
PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE));
if (!key_event_interface)
return 0;
- return key_event_interface->GetUsbKeyCode(pp_key_event.pp_resource());
+
+ // Get the DOM3 |code| as a string.
+ pp::Var codevar(key_event_interface->GetCode(pp_key_event.pp_resource()));
+ if (!codevar.is_string())
+ return 0;
+ std::string codestr = codevar.AsString();
+
+ // Convert the |code| string into a USB keycode.
+ ui::KeycodeConverter* key_converter = ui::KeycodeConverter::GetInstance();
+ return key_converter->CodeToUsbKeycode(codestr.c_str());
}
bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) {