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

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: Removing the simple keyboard, not needed. 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/native_device_keymap.h"
8 #include "ui/events/keycodes/dom/dom_code.h"
9
10 namespace remoting {
11
12 TextKeyboardInputStrategy::TextKeyboardInputStrategy(
13 ChromotingSession* input_stub)
14 : input_stub_(input_stub) {}
15
16 TextKeyboardInputStrategy::~TextKeyboardInputStrategy() {}
17
18 // KeyboardInputStrategy
19
20 void TextKeyboardInputStrategy::HandleTextEvent(const std::string& text,
21 uint8_t modifiers) {
22 // TODO(nicholss): Handle modifers.
23 input_stub_->SendTextEvent(text);
24 }
25
26 void TextKeyboardInputStrategy::HandleDeleteEvent(uint8_t modifiers) {
27 std::queue<KeyEvent> keys = ConvertDeleteEvent(modifiers);
28 while (!keys.empty()) {
29 KeyEvent key = keys.front();
30 input_stub_->SendKeyEvent(0, key.keycode, key.keydown);
31 keys.pop();
32 }
33 }
34
35 std::queue<KeyEvent> TextKeyboardInputStrategy::ConvertDeleteEvent(
36 uint8_t modifiers) {
37 std::queue<KeyEvent> keys;
Yuwei 2017/05/16 00:47:30 I'm not sure whether we still need KeyEvent... In
nicholss 2017/05/16 17:13:39 perhaps, It might refactor out after I figure out
38 // TODO(nicholss): Handle modifers.
39 // Key press.
40 keys.push({static_cast<uint32_t>(ui::DomCode::BACKSPACE), true});
41
42 // Key release.
43 keys.push({static_cast<uint32_t>(ui::DomCode::BACKSPACE), false});
44
45 return keys;
46 }
47
48 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698