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

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

Issue 1920033003: Work around key lookup table version mismatch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ppapi/cpp/image_data.h" 10 #include "ppapi/cpp/image_data.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (modifiers & PP_INPUTEVENT_MODIFIER_NUMLOCKKEY) 80 if (modifiers & PP_INPUTEVENT_MODIFIER_NUMLOCKKEY)
81 lock_states |= protocol::KeyEvent::LOCK_STATES_NUMLOCK; 81 lock_states |= protocol::KeyEvent::LOCK_STATES_NUMLOCK;
82 82
83 return lock_states; 83 return lock_states;
84 } 84 }
85 85
86 // Builds a protocol::KeyEvent from the supplied PPAPI event. 86 // Builds a protocol::KeyEvent from the supplied PPAPI event.
87 protocol::KeyEvent MakeKeyEvent(const pp::KeyboardInputEvent& pp_key_event) { 87 protocol::KeyEvent MakeKeyEvent(const pp::KeyboardInputEvent& pp_key_event) {
88 protocol::KeyEvent key_event; 88 protocol::KeyEvent key_event;
89 std::string dom_code = pp_key_event.GetCode().AsString(); 89 std::string dom_code = pp_key_event.GetCode().AsString();
90 // Chrome M52 changed the string representation of the left and right OS
91 // keys, which means that if the client plugin is compiled against a
92 // different version of the mapping table, the lookup will fail. The long-
93 // term solution is to use JavaScript input events, but for now just check
94 // explicitly for the old names and convert them to the new ones.
95 if (dom_code == "OSLeft") {
96 dom_code = "MetaLeft";
97 } else if (dom_code == "OSRight") {
98 dom_code = "MetaRight";
99 }
90 key_event.set_usb_keycode(ui::KeycodeConverter::CodeToUsbKeycode(dom_code)); 100 key_event.set_usb_keycode(ui::KeycodeConverter::CodeToUsbKeycode(dom_code));
91 key_event.set_pressed(pp_key_event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN); 101 key_event.set_pressed(pp_key_event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN);
92 key_event.set_lock_states(MakeLockStates(pp_key_event)); 102 key_event.set_lock_states(MakeLockStates(pp_key_event));
93 return key_event; 103 return key_event;
94 } 104 }
95 105
96 // Builds a protocol::MouseEvent from the supplied PPAPI event. 106 // Builds a protocol::MouseEvent from the supplied PPAPI event.
97 protocol::MouseEvent MakeMouseEvent(const pp::MouseInputEvent& pp_mouse_event, 107 protocol::MouseEvent MakeMouseEvent(const pp::MouseInputEvent& pp_mouse_event,
98 bool set_deltas) { 108 bool set_deltas) {
99 protocol::MouseEvent mouse_event; 109 protocol::MouseEvent mouse_event;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 input_tracker_->ReleaseAllIfModifiersStuck( 286 input_tracker_->ReleaseAllIfModifiersStuck(
277 (modifiers & PP_INPUTEVENT_MODIFIER_ALTKEY) != 0, 287 (modifiers & PP_INPUTEVENT_MODIFIER_ALTKEY) != 0,
278 (modifiers & PP_INPUTEVENT_MODIFIER_CONTROLKEY) != 0, 288 (modifiers & PP_INPUTEVENT_MODIFIER_CONTROLKEY) != 0,
279 (modifiers & PP_INPUTEVENT_MODIFIER_METAKEY) != 0, 289 (modifiers & PP_INPUTEVENT_MODIFIER_METAKEY) != 0,
280 (modifiers & PP_INPUTEVENT_MODIFIER_SHIFTKEY) != 0); 290 (modifiers & PP_INPUTEVENT_MODIFIER_SHIFTKEY) != 0);
281 } 291 }
282 } 292 }
283 } 293 }
284 294
285 } // namespace remoting 295 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698