Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 #ifndef REMOTING_HOST_LINUX_KEYBOARD_INTERFACE_H_ | |
| 6 #define REMOTING_HOST_LINUX_KEYBOARD_INTERFACE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 | |
| 14 namespace remoting { | |
| 15 | |
| 16 // An interface for accessing the keyboard and changing the keyboard layout. | |
| 17 // An implementation is allowed to delay processing a request until Flush() or | |
| 18 // Sync() is called. | |
| 19 class KeyboardInterface { | |
|
Yuwei
2016/09/21 03:47:40
This interface is basically for unit test. There w
Sergey Ulanov
2016/09/21 19:59:23
We don't use Interface suffix for interfaces. Also
Yuwei
2016/09/21 20:35:32
"Interface" here actually means it is an interface
Sergey Ulanov
2016/09/21 20:55:23
X11KeyboardImpl
Yuwei
2016/09/23 01:40:37
Done.
Yuwei
2016/09/23 01:40:37
Done.
| |
| 20 public: | |
| 21 virtual ~KeyboardInterface() {} | |
| 22 | |
| 23 // Returns a vector of key codes that are not being mapped to a code point. | |
| 24 virtual std::vector<uint32_t> GetUnusedKeycodes() = 0; | |
| 25 | |
| 26 // Simulates a key press with the given |keycode| and |modifiers|. Note that | |
| 27 // the application receiving the key press can decide whether or how the key | |
| 28 // press is interpreted into a character. | |
| 29 virtual void PressKey(uint32_t keycode, uint32_t modifiers) = 0; | |
| 30 | |
| 31 // Finds a keycode and set of modifiers that generate character with the | |
| 32 // specified |code_point|. Returns true if the key code is successfully found. | |
| 33 virtual bool FindKeycode(uint32_t code_point, | |
| 34 uint32_t* keycode, | |
| 35 uint32_t* modifiers) = 0; | |
| 36 | |
| 37 // Change the key mapping such that pressing |keycode| will output the | |
| 38 // character of |lower_case_code_point| or |upper_case_code_point| determined | |
| 39 // by the modifier. | |
| 40 virtual bool ChangeKeyMapping(uint32_t keycode, | |
| 41 uint32_t lower_case_code_point, | |
| 42 uint32_t upper_case_code_point) = 0; | |
| 43 | |
| 44 // Flushes all requests but don't wait for processing the requests. | |
| 45 virtual void Flush() = 0; | |
| 46 | |
| 47 // Flushes all requests and wait until all requests are processed. | |
| 48 virtual void Sync() = 0; | |
| 49 | |
| 50 protected: | |
| 51 KeyboardInterface() {} | |
| 52 }; | |
| 53 | |
| 54 } // namespace remoting | |
| 55 | |
| 56 #endif // REMOTING_HOST_LINUX_KEYBOARD_INTERFACE_H_ | |
| OLD | NEW |