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

Unified Diff: remoting/client/plugin/normalizing_input_filter_mac.cc

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_mac.cc
diff --git a/remoting/client/plugin/normalizing_input_filter_mac.cc b/remoting/client/plugin/normalizing_input_filter_mac.cc
index 56b327eefc10d40bb6402d91f61bd61c8af961ed..36708e9409eda2d6b8709fac8e2ecfdb24334d36 100644
--- a/remoting/client/plugin/normalizing_input_filter_mac.cc
+++ b/remoting/client/plugin/normalizing_input_filter_mac.cc
@@ -2,42 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// NormalizingInputFilterMac is designed to solve the problem of missing keyup
-// events on Mac.
-//
-// PROBLEM
-//
-// On Mac if user presses CMD and then C key there is no keyup event generated
-// for C when user releases the C key before the CMD key.
-// The cause is that CMD + C triggers a system action and Chrome injects only a
-// keydown event for the C key. Safari shares the same behavior.
-//
-// SOLUTION
-//
-// When a keyup event for CMD key happens we will check all prior keydown
-// events received and inject corresponding keyup events artificially, with
-// the exception of:
-//
-// SHIFT, CONTROL, OPTION, LEFT CMD, RIGHT CMD and CAPS LOCK
-//
-// because they are reported by Chrome correctly.
-//
-// There are a couple cases that this solution doesn't work perfectly, one
-// of them leads to duplicated keyup events.
-//
-// User performs this sequence of actions:
-//
-// CMD DOWN, C DOWN, CMD UP, C UP
-//
-// In this case the algorithm will generate:
-//
-// CMD DOWN, C DOWN, C UP, CMD UP, C UP
-//
-// Because we artificially generate keyup events the C UP event is duplicated
-// as user releases the key after CMD key. This would not be a problem as the
-// receiver end will drop this duplicated keyup event.
-
-#include "remoting/client/plugin/normalizing_input_filter.h"
+#include "remoting/client/plugin/normalizing_input_filter_mac.h"
#include <map>
#include <vector>
@@ -62,30 +27,13 @@ const unsigned int kUsbTab = 0x07002b;
} // namespace
-class NormalizingInputFilterMac : public protocol::InputFilter {
- public:
- explicit NormalizingInputFilterMac(protocol::InputStub* input_stub);
- virtual ~NormalizingInputFilterMac() {}
-
- // InputFilter overrides.
- virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
-
- private:
- // Generate keyup events for any keys pressed with CMD.
- void GenerateKeyupEvents();
-
- // A map that stores pressed keycodes and the corresponding key event.
- typedef std::map<int, protocol::KeyEvent> KeyPressedMap;
- KeyPressedMap key_pressed_map_;
-
- DISALLOW_COPY_AND_ASSIGN(NormalizingInputFilterMac);
-};
-
NormalizingInputFilterMac::NormalizingInputFilterMac(
protocol::InputStub* input_stub)
: protocol::InputFilter(input_stub) {
}
+NormalizingInputFilterMac::~NormalizingInputFilterMac() {}
+
void NormalizingInputFilterMac::InjectKeyEvent(const protocol::KeyEvent& event)
{
DCHECK(event.has_usb_keycode());
@@ -145,10 +93,4 @@ void NormalizingInputFilterMac::GenerateKeyupEvents() {
key_pressed_map_.clear();
}
-scoped_ptr<protocol::InputFilter> CreateNormalizingInputFilter(
- protocol::InputStub* input_stub) {
- return scoped_ptr<protocol::InputFilter>(
- new NormalizingInputFilterMac(input_stub));
-}
-
} // namespace remoting
« no previous file with comments | « remoting/client/plugin/normalizing_input_filter_mac.h ('k') | remoting/client/plugin/normalizing_input_filter_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698