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

Unified Diff: remoting/client/input/simple_keyboard_input_strategy.cc

Issue 2868383003: [CRD iOS] Send key events to the session. (Closed)
Patch Set: Clean up old key input code. No longer used. Created 3 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698