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

Unified Diff: remoting/host/linux/x_server_character_injector.h

Issue 2346643003: [Remoting Host] Handle text event characters that are not presented on the keyboard (Closed)
Patch Set: Create KeyboardInterface and XServerKeyboardInterface Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698