Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: remoting/client/plugin/pepper_input_handler.cc

Issue 494813002: events: keycodes: Remove the stateless singleton instance of KeycodeConverter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/renderer/pepper/usb_key_code_conversion_win.cc ('k') | remoting/host/input_injector_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698