Index: remoting/host/linux/x_server_character_injector.h |
diff --git a/remoting/host/linux/x_server_character_injector.h b/remoting/host/linux/x_server_character_injector.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..102bb86104144141d00a2517d359563358cee761 |
--- /dev/null |
+++ b/remoting/host/linux/x_server_character_injector.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_HOST_LINUX_X_SERVER_CHARACTER_INJECTOR_H_ |
+#define REMOTING_HOST_LINUX_X_SERVER_CHARACTER_INJECTOR_H_ |
+ |
+#include <stdint.h> |
+ |
+#include <queue> |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "remoting/host/linux/x_server_key_mapper.h" |
+ |
+namespace remoting { |
+ |
+class KeyboardInterface; |
+ |
+// This is a helper class for injecting unicode characters to XWindow server. |
+// Characters will be queued up and sent when there is available resource. |
+class XServerCharacterInjector { |
+ public: |
+ explicit XServerCharacterInjector(KeyboardInterface* keyboard); |
+ ~XServerCharacterInjector(); |
+ |
+ void Inject(uint32_t code_point); |
+ |
+ private: |
+ void Schedule(base::TimeDelta delay); |
+ void Consume(); |
+ |
+ KeyboardInterface* keyboard_; |
+ |
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
+ XServerKeyMapper key_mapper_; |
+ std::queue<uint32_t> characters_queue_; |
+ bool consume_scheduled_ = false; |
+ |
+ base::WeakPtrFactory<XServerCharacterInjector> weak_factory_; |
+ DISALLOW_COPY_AND_ASSIGN(XServerCharacterInjector); |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_HOST_LINUX_X_SERVER_CHARACTER_INJECTOR_H_ |