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

Side by Side Diff: remoting/client/key_event_mapper.h

Issue 1542203002: Switch to standard integer types in remoting/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-remoting-host
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « remoting/client/jni/remoting_jni_onload.cc ('k') | remoting/client/key_event_mapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef REMOTING_CLIENT_KEY_EVENT_MAPPER_H_ 5 #ifndef REMOTING_CLIENT_KEY_EVENT_MAPPER_H_
6 #define REMOTING_CLIENT_KEY_EVENT_MAPPER_H_ 6 #define REMOTING_CLIENT_KEY_EVENT_MAPPER_H_
7 7
8 #include <stdint.h>
9
8 #include <map> 10 #include <map>
9 #include <set> 11 #include <set>
10 12
11 #include "base/basictypes.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/macros.h"
14 #include "remoting/protocol/input_filter.h" 16 #include "remoting/protocol/input_filter.h"
15 17
16 namespace remoting { 18 namespace remoting {
17 19
18 // Filtering InputStub which can be used to re-map the USB keycodes of events 20 // Filtering InputStub which can be used to re-map the USB keycodes of events
19 // before they are passed on to the next InputStub in the chain, or to trap 21 // before they are passed on to the next InputStub in the chain, or to trap
20 // events with specific USB keycodes for special handling. 22 // events with specific USB keycodes for special handling.
21 class KeyEventMapper : public protocol::InputFilter { 23 class KeyEventMapper : public protocol::InputFilter {
22 public: 24 public:
23 KeyEventMapper(); 25 KeyEventMapper();
24 explicit KeyEventMapper(InputStub* input_stub); 26 explicit KeyEventMapper(InputStub* input_stub);
25 ~KeyEventMapper() override; 27 ~KeyEventMapper() override;
26 28
27 // Callback type for use with SetTrapCallback(), below. 29 // Callback type for use with SetTrapCallback(), below.
28 typedef base::Callback<void(const protocol::KeyEvent&)> KeyTrapCallback; 30 typedef base::Callback<void(const protocol::KeyEvent&)> KeyTrapCallback;
29 31
30 // Sets the callback to which trapped keys will be delivered. 32 // Sets the callback to which trapped keys will be delivered.
31 void SetTrapCallback(KeyTrapCallback callback); 33 void SetTrapCallback(KeyTrapCallback callback);
32 34
33 // Causes events matching |usb_keycode| to be delivered to the trap callback. 35 // Causes events matching |usb_keycode| to be delivered to the trap callback.
34 // Trapped events are not dispatched to the next InputStub in the chain. 36 // Trapped events are not dispatched to the next InputStub in the chain.
35 void TrapKey(uint32 usb_keycode, bool trap_key); 37 void TrapKey(uint32_t usb_keycode, bool trap_key);
36 38
37 // Causes events matching |in_usb_keycode| to be mapped to |out_usb_keycode|. 39 // Causes events matching |in_usb_keycode| to be mapped to |out_usb_keycode|.
38 // Keys are remapped at most once. Traps are processed before remapping. 40 // Keys are remapped at most once. Traps are processed before remapping.
39 void RemapKey(uint32 in_usb_keycode, uint32 out_usb_keycode); 41 void RemapKey(uint32_t in_usb_keycode, uint32_t out_usb_keycode);
40 42
41 // InputFilter overrides. 43 // InputFilter overrides.
42 void InjectKeyEvent(const protocol::KeyEvent& event) override; 44 void InjectKeyEvent(const protocol::KeyEvent& event) override;
43 45
44 private: 46 private:
45 std::map<uint32,uint32> mapped_keys; 47 std::map<uint32_t, uint32_t> mapped_keys;
46 std::set<uint32> trapped_keys; 48 std::set<uint32_t> trapped_keys;
47 KeyTrapCallback trap_callback; 49 KeyTrapCallback trap_callback;
48 50
49 DISALLOW_COPY_AND_ASSIGN(KeyEventMapper); 51 DISALLOW_COPY_AND_ASSIGN(KeyEventMapper);
50 }; 52 };
51 53
52 } // namespace remoting 54 } // namespace remoting
53 55
54 #endif // REMOTING_CLIENT_KEY_EVENT_MAPPER_H_ 56 #endif // REMOTING_CLIENT_KEY_EVENT_MAPPER_H_
OLDNEW
« no previous file with comments | « remoting/client/jni/remoting_jni_onload.cc ('k') | remoting/client/key_event_mapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698