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

Unified Diff: remoting/client/plugin/normalizing_input_filter_cros.h

Issue 292103004: Enable keyboard filters in PNaCl client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: remoting/client/plugin/normalizing_input_filter_cros.h
diff --git a/remoting/client/plugin/normalizing_input_filter_cros.h b/remoting/client/plugin/normalizing_input_filter_cros.h
new file mode 100644
index 0000000000000000000000000000000000000000..977c90caedf12491ec9d858cb0bdb9083352a4e3
--- /dev/null
+++ b/remoting/client/plugin/normalizing_input_filter_cros.h
@@ -0,0 +1,54 @@
+// Copyright 2014 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.
+
+#include "remoting/protocol/input_filter.h"
+
+#include "remoting/proto/event.pb.h"
+
+namespace remoting {
+
+// NormalizingInputFilterCros addresses the problems generated by key rewritings
+// such as Down->PageDown, 1->F1, etc, when keys are pressed in combination with
+// the OSKey (aka Search). Rewriting OSKey+Down, for example, causes us to
+// receive the following:
+//
+// keydown OSKey
+// keydown PageDown
+// keyup PageDown
+// keyup OSKey
+//
+// The host system will therefore behave as if OSKey+PageDown were pressed,
+// rather than PageDown alone.
+class NormalizingInputFilterCros : public protocol::InputFilter {
+ public:
+ explicit NormalizingInputFilterCros(protocol::InputStub* input_stub);
+ virtual ~NormalizingInputFilterCros();
+
+ // InputFilter overrides.
+ virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
+ virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
+
+ private:
+ void ProcessKeyDown(const protocol::KeyEvent& event);
+ void ProcessKeyUp(const protocol::KeyEvent& event);
+
+ void SwitchRewritingKeyToModifying();
+
+ // Holds the keydown event for the most recent OSKey to have been pressed,
+ // while it is Rewriting, or we are not yet sure whether it is Normal,
+ // Rewriting or Modifying. The event is sent on if we switch to Modifying, or
+ // discarded if the OSKey is released while in Rewriting mode.
+ protocol::KeyEvent deferred_keydown_event_;
+
+ // True while the |rewrite_keydown_event_| key is Rewriting, i.e. was followed
+ // by one or more Rewritten key events, and not by any Modified events.
+ bool deferred_key_is_rewriting_;
+
+ // Stores the code of the OSKey while it is pressed for use as a Modifier.
+ uint32 modifying_key_;
+
+ DISALLOW_COPY_AND_ASSIGN(NormalizingInputFilterCros);
+};
+
+} // namespace remoting
« no previous file with comments | « remoting/client/plugin/normalizing_input_filter.cc ('k') | remoting/client/plugin/normalizing_input_filter_cros.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698