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_X_SERVER_CHARACTER_INJECTOR_H_ |
| 6 #define REMOTING_HOST_LINUX_X_SERVER_CHARACTER_INJECTOR_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <queue> |
| 11 |
| 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 14 #include "remoting/host/linux/x_server_key_mapper.h" |
| 15 |
| 16 namespace remoting { |
| 17 |
| 18 class KeyboardInterface; |
| 19 |
| 20 // This is a helper class for injecting unicode characters to XWindow server. |
| 21 // Characters will be queued up and sent when there is available resource. |
| 22 class XServerCharacterInjector { |
| 23 public: |
| 24 explicit XServerCharacterInjector(KeyboardInterface* keyboard); |
| 25 ~XServerCharacterInjector(); |
| 26 |
| 27 void Inject(uint32_t code_point); |
| 28 |
| 29 private: |
| 30 void Schedule(base::TimeDelta delay); |
| 31 void Consume(); |
| 32 |
| 33 KeyboardInterface* keyboard_; |
| 34 |
| 35 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 36 XServerKeyMapper key_mapper_; |
| 37 std::queue<uint32_t> characters_queue_; |
| 38 bool consume_scheduled_ = false; |
| 39 |
| 40 base::WeakPtrFactory<XServerCharacterInjector> weak_factory_; |
| 41 DISALLOW_COPY_AND_ASSIGN(XServerCharacterInjector); |
| 42 }; |
| 43 |
| 44 } // namespace remoting |
| 45 |
| 46 #endif // REMOTING_HOST_LINUX_X_SERVER_CHARACTER_INJECTOR_H_ |
OLD | NEW |