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

Unified Diff: components/keyboard_lock/key_hook_activator.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
« no previous file with comments | « components/keyboard_lock/key_hook.h ('k') | components/keyboard_lock/key_hook_activator_collection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/keyboard_lock/key_hook_activator.h
diff --git a/components/keyboard_lock/key_hook_activator.h b/components/keyboard_lock/key_hook_activator.h
new file mode 100644
index 0000000000000000000000000000000000000000..45d54d5f598e5958b7b16c01ac31b23c89847b70
--- /dev/null
+++ b/components/keyboard_lock/key_hook_activator.h
@@ -0,0 +1,37 @@
+// 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_ACTIVATOR_H_
+#define COMPONENTS_KEYBOARD_LOCK_KEY_HOOK_ACTIVATOR_H_
+
+#include <vector>
+
+#include "base/callback.h"
+#include "components/keyboard_lock/key_hook.h"
+#include "ui/events/keycodes/keyboard_codes.h"
+
+namespace keyboard_lock {
+
+// An interface to store all registered key codes and register or unregister
+// them with one Activate() or Deactivate() function call.
+// The implementation needs to guarantee the thread-safety of Activate() and
+// Deactivate() functions, which may be executed in both UI thread and
+// network thread.
+class KeyHookActivator : public KeyHook {
+ public:
+ KeyHookActivator() = default;
+ ~KeyHookActivator() override = default;
+
+ // Meaning of |on_result| is same as the one in KeyHook::RegisterKey().
+
+ // Enables all registered key codes.
+ virtual void Activate(base::Callback<void(bool)> on_result) = 0;
+
+ // Disables all registered key codes.
+ virtual void Deactivate(base::Callback<void(bool)> on_result) = 0;
+};
+
+} // namespace keyboard_lock
+
+#endif // COMPONENTS_KEYBOARD_LOCK_KEY_HOOK_ACTIVATOR_H_
« no previous file with comments | « components/keyboard_lock/key_hook.h ('k') | components/keyboard_lock/key_hook_activator_collection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698