Index: remoting/client/input/simple_keyboard_input_strategy.cc |
diff --git a/remoting/client/input/simple_keyboard_input_strategy.cc b/remoting/client/input/simple_keyboard_input_strategy.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9f6f1ca3af477549ebaae0eff6f6965563685470 |
--- /dev/null |
+++ b/remoting/client/input/simple_keyboard_input_strategy.cc |
@@ -0,0 +1,58 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "remoting/client/input/simple_keyboard_input_strategy.h" |
+ |
+#include "remoting/client/native_device_keymap.h" |
+ |
+namespace remoting { |
+ |
+SimpleKeyboardInputStrategy::SimpleKeyboardInputStrategy() {} |
+ |
+SimpleKeyboardInputStrategy::~SimpleKeyboardInputStrategy() {} |
+ |
+std::queue<KeyEvent> SimpleKeyboardInputStrategy::ConvertTextEvent( |
+ const std::string& text, |
+ uint8_t modifiers) { |
+ std::queue<KeyEvent> keys; |
+ for (size_t i = 0; i < text.size(); i++) { |
+ KeycodeWithModifier keycode = AsciiToUsbKeycodeWithModifier(text.at(i)); |
+ if (keycode.modifier) { |
+ // Key modifier press. |
+ KeyEvent modifier_down; |
+ modifier_down.keycode = keycode.modifier; |
+ modifier_down.keydown = true; |
+ keys.push(modifier_down); |
+ } |
+ |
+ // Key press. |
+ KeyEvent key_down; |
+ key_down.keycode = keycode.keycode; |
+ key_down.keydown = true; |
+ keys.push(key_down); |
+ |
+ // Key release. |
+ KeyEvent key_up; |
+ key_up.keycode = keycode.keycode; |
+ key_up.keydown = false; |
+ keys.push(key_up); |
+ |
+ if (keycode.modifier) { |
+ // Key modifier release. |
+ KeyEvent modifier; |
+ modifier.keycode = keycode.modifier; |
+ modifier.keydown = false; |
+ keys.push(modifier); |
+ } |
+ } |
+ return keys; |
+} |
+ |
+std::queue<KeyEvent> SimpleKeyboardInputStrategy::ConvertDeleteEvent( |
+ uint8_t modifiers) { |
+ std::queue<KeyEvent> keys; |
+ return keys; |
+} |
+ |
+} // namespace remoting |