Chromium Code Reviews| 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/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; | |
| 38 // TODO(nicholss): Handle modifers. | |
| 39 // Key press. | |
| 40 KeyEvent key_down; | |
|
Yuwei
2017/05/15 19:38:06
push({...})?
nicholss
2017/05/15 23:06:11
Acknowledged.
Yuwei
2017/05/16 00:47:30
You probably want to use "Done" for things you hav
nicholss
2017/05/16 17:13:39
Acknowledged.
| |
| 41 key_down.keycode = static_cast<uint32_t>(ui::DomCode::BACKSPACE); | |
| 42 key_down.keydown = true; | |
| 43 keys.push(key_down); | |
| 44 | |
| 45 // Key release. | |
| 46 KeyEvent key_up; | |
| 47 key_up.keycode = static_cast<uint32_t>(ui::DomCode::BACKSPACE); | |
| 48 key_up.keydown = false; | |
| 49 keys.push(key_up); | |
| 50 | |
| 51 return keys; | |
| 52 } | |
| 53 | |
| 54 } // namespace remoting | |
| OLD | NEW |