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/pepper_input_handler.h" | 5 #include "remoting/client/plugin/pepper_input_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/cpp/image_data.h" | 8 #include "ppapi/cpp/image_data.h" |
9 #include "ppapi/cpp/input_event.h" | 9 #include "ppapi/cpp/input_event.h" |
10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 PepperInputHandler::~PepperInputHandler() {} | 34 PepperInputHandler::~PepperInputHandler() {} |
35 | 35 |
36 // Helper function to get the USB key code using the Dev InputEvent interface. | 36 // Helper function to get the USB key code using the Dev InputEvent interface. |
37 uint32_t GetUsbKeyCode(pp::KeyboardInputEvent pp_key_event) { | 37 uint32_t GetUsbKeyCode(pp::KeyboardInputEvent pp_key_event) { |
38 // Get the DOM3 |code| as a string. | 38 // Get the DOM3 |code| as a string. |
39 std::string codestr = pp_key_event.GetCode().AsString(); | 39 std::string codestr = pp_key_event.GetCode().AsString(); |
40 | 40 |
41 // Convert the |code| string into a USB keycode. | 41 // Convert the |code| string into a USB keycode. |
42 ui::KeycodeConverter* key_converter = ui::KeycodeConverter::GetInstance(); | 42 return ui::KeycodeConverter::CodeToUsbKeycode(codestr.c_str()); |
43 return key_converter->CodeToUsbKeycode(codestr.c_str()); | |
44 } | 43 } |
45 | 44 |
46 bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) { | 45 bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) { |
47 switch (event.GetType()) { | 46 switch (event.GetType()) { |
48 case PP_INPUTEVENT_TYPE_CONTEXTMENU: { | 47 case PP_INPUTEVENT_TYPE_CONTEXTMENU: { |
49 // We need to return true here or else we'll get a local (plugin) context | 48 // We need to return true here or else we'll get a local (plugin) context |
50 // menu instead of the mouseup event for the right click. | 49 // menu instead of the mouseup event for the right click. |
51 return true; | 50 return true; |
52 } | 51 } |
53 | 52 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 mouse_lock_state_ = MouseLockOff; | 300 mouse_lock_state_ = MouseLockOff; |
302 UpdateMouseCursor(); | 301 UpdateMouseCursor(); |
303 } | 302 } |
304 | 303 |
305 // Cancel as needed. | 304 // Cancel as needed. |
306 if (should_cancel) | 305 if (should_cancel) |
307 CancelMouseLock(); | 306 CancelMouseLock(); |
308 } | 307 } |
309 | 308 |
310 } // namespace remoting | 309 } // namespace remoting |
OLD | NEW |