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

Unified Diff: components/keyboard_lock/key_hook.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_hook.h
diff --git a/components/keyboard_lock/key_hook.h b/components/keyboard_lock/key_hook.h
new file mode 100644
index 0000000000000000000000000000000000000000..3071249fa4038ace254c3a715cd5e8231128fcfe
--- /dev/null
+++ b/components/keyboard_lock/key_hook.h
@@ -0,0 +1,35 @@
+// 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_HOOK_H_
+#define COMPONENTS_KEYBOARD_LOCK_KEY_HOOK_H_
+
+#include <vector>
+
+#include "base/callback.h"
+#include "ui/events/keycodes/keyboard_codes.h"
+
+namespace keyboard_lock {
+
+// An interface to register and unregister key codes from low level callback.
+// The implementation needs to guarantee the thread-safety of RegisterKey() and
+// UnregisterKey() functions, which may be executed in both UI thread and
+// network thread.
+class KeyHook {
+ public:
+ KeyHook() = default;
+ virtual ~KeyHook() = default;
+
+ // The |on_result| callback will be called with the result if it's not null.
+ // Calling |on_result| with |false| indicates the failure of an OK API
+ // invoking. Thus, the required ui::KeyboardCode may not be able to received.
+ virtual void RegisterKey(const std::vector<ui::KeyboardCode>& codes,
+ base::Callback<void(bool)> on_result) = 0;
+ virtual void UnregisterKey(const std::vector<ui::KeyboardCode>& codes,
+ base::Callback<void(bool)> on_result) = 0;
+};
+
+} // namespace keyboard_lock
+
+#endif // COMPONENTS_KEYBOARD_LOCK_KEY_HOOK_H_
« no previous file with comments | « components/keyboard_lock/key_event_filter_thread_proxy.cc ('k') | components/keyboard_lock/key_hook_activator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698