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

Unified Diff: components/keyboard_lock/key_event_interceptor.h

Issue 2815023002: [System-Keyboard-Lock] Add KeyboardLockHost and KeyEventInterceptor (Closed)
Patch Set: Created 3 years, 8 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_interceptor.h
diff --git a/components/keyboard_lock/key_event_interceptor.h b/components/keyboard_lock/key_event_interceptor.h
new file mode 100644
index 0000000000000000000000000000000000000000..573626179075ad8a380a13b3b95027ae6f664e59
--- /dev/null
+++ b/components/keyboard_lock/key_event_interceptor.h
@@ -0,0 +1,36 @@
+// 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_INTERCEPTOR_H_
+#define COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_INTERCEPTOR_H_
+
+#include "ui/events/keycodes/keyboard_codes.h"
+
+namespace keyboard_lock {
+
+// An interface to receive and process a key event.
+class KeyEventInterceptor {
+ public:
+ KeyEventInterceptor() = default;
+ virtual ~KeyEventInterceptor() = default;
+
+ virtual bool OnKeyDown(ui::KeyboardCode code) = 0;
+ virtual bool OnKeyUp(ui::KeyboardCode code) = 0;
+
+ // An interface to retrieve a KeyEventInterceptor instance. This class is used
+ // to avoid the dependency of the singleton object of KeyboardLockHost, and to
+ // ensure late installed KeyEventInterceptor can be retrieved.
+ class Retriever {
+ public:
+ Retriever() = default;
+ virtual ~Retriever() = default;
+
+ // May return nullptr.
+ virtual KeyEventInterceptor* Get() = 0;
+ };
+};
+
+} // namespace keyboard_lock
+
+#endif // COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_INTERCEPTOR_H_

Powered by Google App Engine
This is Rietveld 408576698