OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/client/input/simple_keyboard_input_strategy.h" |
| 6 |
| 7 #include "remoting/client/native_device_keymap.h" |
| 8 |
| 9 namespace remoting { |
| 10 |
| 11 SimpleKeyboardInputStrategy::SimpleKeyboardInputStrategy() {} |
| 12 |
| 13 SimpleKeyboardInputStrategy::~SimpleKeyboardInputStrategy() {} |
| 14 |
| 15 std::queue<KeyEvent> SimpleKeyboardInputStrategy::ConvertTextEvent( |
| 16 const std::string& text, |
| 17 uint8_t modifiers) { |
| 18 std::queue<KeyEvent> keys; |
| 19 for (size_t i = 0; i < text.size(); i++) { |
| 20 KeycodeWithModifier keycode = AsciiToUsbKeycodeWithModifier(text.at(i)); |
| 21 if (keycode.modifier) { |
| 22 // Key modifier press. |
| 23 KeyEvent modifier_down; |
| 24 modifier_down.keycode = keycode.modifier; |
| 25 modifier_down.keydown = true; |
| 26 keys.push(modifier_down); |
| 27 } |
| 28 |
| 29 // Key press. |
| 30 KeyEvent key_down; |
| 31 key_down.keycode = keycode.keycode; |
| 32 key_down.keydown = true; |
| 33 keys.push(key_down); |
| 34 |
| 35 // Key release. |
| 36 KeyEvent key_up; |
| 37 key_up.keycode = keycode.keycode; |
| 38 key_up.keydown = false; |
| 39 keys.push(key_up); |
| 40 |
| 41 if (keycode.modifier) { |
| 42 // Key modifier release. |
| 43 KeyEvent modifier; |
| 44 modifier.keycode = keycode.modifier; |
| 45 modifier.keydown = false; |
| 46 keys.push(modifier); |
| 47 } |
| 48 } |
| 49 return keys; |
| 50 } |
| 51 |
| 52 std::queue<KeyEvent> SimpleKeyboardInputStrategy::ConvertDeleteEvent( |
| 53 uint8_t modifiers) { |
| 54 std::queue<KeyEvent> keys; |
| 55 return keys; |
| 56 } |
| 57 |
| 58 } // namespace remoting |
OLD | NEW |