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

Unified Diff: components/keyboard_lock/key_event_filter_thread_proxy.h

Issue 2879033002: Keyboard Lock Host implementation
Patch Set: Remove useless files Created 3 years, 4 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: components/keyboard_lock/key_event_filter_thread_proxy.h
diff --git a/components/keyboard_lock/key_event_filter_thread_proxy.h b/components/keyboard_lock/key_event_filter_thread_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..436d2eaa8a9df55b2ae61e1ee0986fb8118589a9
--- /dev/null
+++ b/components/keyboard_lock/key_event_filter_thread_proxy.h
@@ -0,0 +1,43 @@
+// Copyright 2017 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 COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_FILTER_THREAD_PROXY_H_
+#define COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_FILTER_THREAD_PROXY_H_
+
+#include <memory>
+
+#include "base/memory/ref_counted.h"
+#include "components/keyboard_lock/key_event_filter.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+} // namespace base
+
+namespace keyboard_lock {
+
+// TODO(zijiehe): Is this class necessary? i.e. Is it needed to forward
+// RenderWidgetHost::ForwardKeyboardEvent() to network thread?
+// An implementation of KeyEventFilter to forward all requests to |runner| and
+// |filter|.
+class KeyEventFilterThreadProxy : public KeyEventFilter {
+ public:
+ KeyEventFilterThreadProxy(
+ scoped_refptr<base::SingleThreadTaskRunner> runner,
+ std::unique_ptr<KeyEventFilter> filter);
+ ~KeyEventFilterThreadProxy() override;
+
+ private:
+ // KeyEventFilter implementations
+ // Because the requests will be sent to a different thread, these functions
+ // always return true.
+ bool OnKeyDown(ui::KeyboardCode code, int flags) override;
+ bool OnKeyUp(ui::KeyboardCode code, int flags) override;
+
+ const scoped_refptr<base::SingleThreadTaskRunner> runner_;
+ const std::unique_ptr<KeyEventFilter> filter_;
+};
+
+} // namespace keyboard_lock
+
+#endif // COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_FILTER_THREAD_PROXY_H_
« no previous file with comments | « components/keyboard_lock/key_event_filter_share_wrapper.cc ('k') | components/keyboard_lock/key_event_filter_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698