OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/client/key_event_mapper.h" | 5 #include "remoting/client/input/key_event_mapper.h" |
6 | 6 |
7 #include "remoting/proto/event.pb.h" | 7 #include "remoting/proto/event.pb.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
11 KeyEventMapper::KeyEventMapper() { | 11 KeyEventMapper::KeyEventMapper() {} |
12 } | |
13 | 12 |
14 KeyEventMapper::KeyEventMapper(InputStub* stub) : protocol::InputFilter(stub) { | 13 KeyEventMapper::KeyEventMapper(InputStub* stub) : protocol::InputFilter(stub) {} |
15 } | |
16 | 14 |
17 KeyEventMapper::~KeyEventMapper() { | 15 KeyEventMapper::~KeyEventMapper() {} |
18 } | |
19 | 16 |
20 void KeyEventMapper::SetTrapCallback(KeyTrapCallback callback) { | 17 void KeyEventMapper::SetTrapCallback(KeyTrapCallback callback) { |
21 trap_callback = callback; | 18 trap_callback = callback; |
22 } | 19 } |
23 | 20 |
24 void KeyEventMapper::TrapKey(uint32_t usb_keycode, bool trap_key) { | 21 void KeyEventMapper::TrapKey(uint32_t usb_keycode, bool trap_key) { |
25 if (trap_key) { | 22 if (trap_key) { |
26 trapped_keys.insert(usb_keycode); | 23 trapped_keys.insert(usb_keycode); |
27 } else { | 24 } else { |
28 trapped_keys.erase(usb_keycode); | 25 trapped_keys.erase(usb_keycode); |
(...skipping 26 matching lines...) Expand all Loading... |
55 new_event.set_usb_keycode(mapped->second); | 52 new_event.set_usb_keycode(mapped->second); |
56 InputFilter::InjectKeyEvent(new_event); | 53 InputFilter::InjectKeyEvent(new_event); |
57 return; | 54 return; |
58 } | 55 } |
59 } | 56 } |
60 | 57 |
61 InputFilter::InjectKeyEvent(event); | 58 InputFilter::InjectKeyEvent(event); |
62 } | 59 } |
63 | 60 |
64 } // namespace remoting | 61 } // namespace remoting |
OLD | NEW |