OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <map> | 5 #include <map> |
6 | 6 |
7 #include "remoting/protocol/input_filter.h" | 7 #include "remoting/protocol/input_filter.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 // In this case the algorithm will generate: | 38 // In this case the algorithm will generate: |
39 // | 39 // |
40 // CMD DOWN, C DOWN, C UP, CMD UP, C UP | 40 // CMD DOWN, C DOWN, C UP, CMD UP, C UP |
41 // | 41 // |
42 // Because we artificially generate keyup events the C UP event is duplicated | 42 // Because we artificially generate keyup events the C UP event is duplicated |
43 // as user releases the key after CMD key. This would not be a problem as the | 43 // as user releases the key after CMD key. This would not be a problem as the |
44 // receiver end will drop this duplicated keyup event. | 44 // receiver end will drop this duplicated keyup event. |
45 class NormalizingInputFilterMac : public protocol::InputFilter { | 45 class NormalizingInputFilterMac : public protocol::InputFilter { |
46 public: | 46 public: |
47 explicit NormalizingInputFilterMac(protocol::InputStub* input_stub); | 47 explicit NormalizingInputFilterMac(protocol::InputStub* input_stub); |
48 virtual ~NormalizingInputFilterMac(); | 48 ~NormalizingInputFilterMac() override; |
49 | 49 |
50 // InputFilter overrides. | 50 // InputFilter overrides. |
51 virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; | 51 void InjectKeyEvent(const protocol::KeyEvent& event) override; |
52 | 52 |
53 private: | 53 private: |
54 typedef std::map<int, protocol::KeyEvent> KeyPressedMap; | 54 typedef std::map<int, protocol::KeyEvent> KeyPressedMap; |
55 | 55 |
56 // Generate keyup events for any keys pressed with CMD. | 56 // Generate keyup events for any keys pressed with CMD. |
57 void GenerateKeyupEvents(); | 57 void GenerateKeyupEvents(); |
58 | 58 |
59 // A map that stores pressed keycodes and the corresponding key event. | 59 // A map that stores pressed keycodes and the corresponding key event. |
60 KeyPressedMap key_pressed_map_; | 60 KeyPressedMap key_pressed_map_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(NormalizingInputFilterMac); | 62 DISALLOW_COPY_AND_ASSIGN(NormalizingInputFilterMac); |
63 }; | 63 }; |
64 | 64 |
65 } // namespace remoting | 65 } // namespace remoting |
OLD | NEW |