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

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

Issue 1915243004: Merge https://codereview.chromium.org/1920033003. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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 new names and convert them to the old ones (because
95 // this code is compiled against the old table in the M51 branch).
96 if (dom_code == "MetaLeft") {
97 dom_code = "OSLeft";
98 } else if (dom_code == "MetaRight") {
99 dom_code = "OSRight";
100 }
90 key_event.set_usb_keycode(ui::KeycodeConverter::CodeToUsbKeycode(dom_code)); 101 key_event.set_usb_keycode(ui::KeycodeConverter::CodeToUsbKeycode(dom_code));
91 key_event.set_pressed(pp_key_event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN); 102 key_event.set_pressed(pp_key_event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN);
92 key_event.set_lock_states(MakeLockStates(pp_key_event)); 103 key_event.set_lock_states(MakeLockStates(pp_key_event));
93 return key_event; 104 return key_event;
94 } 105 }
95 106
96 // Builds a protocol::MouseEvent from the supplied PPAPI event. 107 // Builds a protocol::MouseEvent from the supplied PPAPI event.
97 protocol::MouseEvent MakeMouseEvent(const pp::MouseInputEvent& pp_mouse_event, 108 protocol::MouseEvent MakeMouseEvent(const pp::MouseInputEvent& pp_mouse_event,
98 bool set_deltas) { 109 bool set_deltas) {
99 protocol::MouseEvent mouse_event; 110 protocol::MouseEvent mouse_event;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 input_tracker_->ReleaseAllIfModifiersStuck( 287 input_tracker_->ReleaseAllIfModifiersStuck(
277 (modifiers & PP_INPUTEVENT_MODIFIER_ALTKEY) != 0, 288 (modifiers & PP_INPUTEVENT_MODIFIER_ALTKEY) != 0,
278 (modifiers & PP_INPUTEVENT_MODIFIER_CONTROLKEY) != 0, 289 (modifiers & PP_INPUTEVENT_MODIFIER_CONTROLKEY) != 0,
279 (modifiers & PP_INPUTEVENT_MODIFIER_METAKEY) != 0, 290 (modifiers & PP_INPUTEVENT_MODIFIER_METAKEY) != 0,
280 (modifiers & PP_INPUTEVENT_MODIFIER_SHIFTKEY) != 0); 291 (modifiers & PP_INPUTEVENT_MODIFIER_SHIFTKEY) != 0);
281 } 292 }
282 } 293 }
283 } 294 }
284 295
285 } // namespace remoting 296 } // 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