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

Unified Diff: components/keyboard_lock/active_key_event_filter_registrar.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/active_key_event_filter_registrar.h
diff --git a/components/keyboard_lock/active_key_event_filter_registrar.h b/components/keyboard_lock/active_key_event_filter_registrar.h
new file mode 100644
index 0000000000000000000000000000000000000000..12bb9c8fc527c379b3f647aa04d6200229ee88c2
--- /dev/null
+++ b/components/keyboard_lock/active_key_event_filter_registrar.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_ACTIVE_KEY_EVENT_FILTER_REGISTRAR_H_
+#define COMPONENTS_KEYBOARD_LOCK_ACTIVE_KEY_EVENT_FILTER_REGISTRAR_H_
+
+#include <memory>
+
+#include "components/keyboard_lock/key_event_filter.h"
+#include "components/keyboard_lock/key_hook_activator.h"
+
+namespace keyboard_lock {
+
+class ActiveKeyEventFilterTracker;
+
+// An implementation of KeyHookActivator to forward requests to |key_hook| and
+// register / unregister cooresponding key event filter |filter| to |tracker|.
+class ActiveKeyEventFilterRegistrar final : public KeyHookActivator {
+ public:
+ // |tracker| should outlive |this|.
+ ActiveKeyEventFilterRegistrar(ActiveKeyEventFilterTracker* tracker,
+ std::unique_ptr<KeyHookActivator> key_hook,
+ KeyEventFilter* filter);
+ ~ActiveKeyEventFilterRegistrar() override;
+
+ private:
+ // KeyHookActivator implementations
+ void RegisterKey(const std::vector<ui::KeyboardCode>& codes,
+ base::Callback<void(bool)> on_result) override;
+ void UnregisterKey(const std::vector<ui::KeyboardCode>& codes,
+ base::Callback<void(bool)> on_result) override;
+ void Activate(base::Callback<void(bool)> on_result) override;
+ void Deactivate(base::Callback<void(bool)> on_result) override;
+
+ ActiveKeyEventFilterTracker* const tracker_;
+ std::unique_ptr<KeyHookActivator> key_hook_;
+ KeyEventFilter* const filter_;
+};
+
+} // namespace keyboard_lock
+
+#endif // COMPONENTS_KEYBOARD_LOCK_ACTIVE_KEY_EVENT_FILTER_REGISTRAR_H_
« no previous file with comments | « components/keyboard_lock/active_key_event_filter.cc ('k') | components/keyboard_lock/active_key_event_filter_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698