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

Side by Side Diff: remoting/client/input/text_keyboard_input_strategy.cc

Issue 2868383003: [CRD iOS] Send key events to the session. (Closed)
Patch Set: Update based on feedback. 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 unified diff | Download patch
OLDNEW
(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/text_keyboard_input_strategy.h"
6
7 #include "remoting/client/input/client_input_injector.h"
8 #include "remoting/client/native_device_keymap.h"
9 #include "ui/events/keycodes/dom/dom_code.h"
10
11 namespace remoting {
12
13 TextKeyboardInputStrategy::TextKeyboardInputStrategy(
14 ClientInputInjector* input_injector)
15 : input_injector_(input_injector) {}
16
17 TextKeyboardInputStrategy::~TextKeyboardInputStrategy() {}
18
19 // KeyboardInputStrategy
20
21 void TextKeyboardInputStrategy::HandleTextEvent(const std::string& text,
22 uint8_t modifiers) {
23 // TODO(nicholss): Handle modifers.
24 input_injector_->SendTextEvent(text);
25 }
26
27 void TextKeyboardInputStrategy::HandleDeleteEvent(uint8_t modifiers) {
28 std::queue<KeyEvent> keys = ConvertDeleteEvent(modifiers);
29 while (!keys.empty()) {
30 KeyEvent key = keys.front();
31 input_injector_->SendKeyEvent(0, key.keycode, key.keydown);
32 keys.pop();
33 }
34 }
35
36 std::queue<KeyEvent> TextKeyboardInputStrategy::ConvertDeleteEvent(
37 uint8_t modifiers) {
38 std::queue<KeyEvent> keys;
39 // TODO(nicholss): Handle modifers.
40 // Key press.
41 keys.push({static_cast<uint32_t>(ui::DomCode::BACKSPACE), true});
42
43 // Key release.
44 keys.push({static_cast<uint32_t>(ui::DomCode::BACKSPACE), false});
45
46 return keys;
47 }
48
49 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/input/text_keyboard_input_strategy.h ('k') | remoting/client/native_device_keymap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698