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

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

Issue 10025001: Add APIs to the client plugin to re-map and trap key events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove bogus extra files. Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/client/key_event_mapper.cc » ('j') | remoting/client/key_event_mapper.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_CLIENT_KEY_EVENT_MAPPER_H_
6 #define REMOTING_CLIENT_KEY_EVENT_MAPPER_H_
7
8 #include <map>
9 #include <set>
10
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/compiler_specific.h"
14 #include "remoting/protocol/input_filter.h"
15
16 namespace remoting {
17
18 typedef base::Callback<void(uint32,bool)> KeyTrapCallback;
Sergey Ulanov 2012/04/07 01:50:14 Maybe define this inside KeyEventMapper? nit: spac
Wez 2012/04/08 00:12:41 Done.
19
20 class KeyEventMapper : public protocol::InputFilter {
Sergey Ulanov 2012/04/07 01:50:14 Explain what this is for.
Wez 2012/04/08 00:12:41 Done.
21 public:
22 KeyEventMapper();
23 explicit KeyEventMapper(InputStub* input_stub);
24 virtual ~KeyEventMapper();
25
26 // Sets the callback to which trapped keys will be delivered.
27 void SetTrapCallback(KeyTrapCallback callback);
28
29 // Causes events matching |usb_keycode| to be delivered to the trap callback.
30 // Trapped events are not dispatched to the next InputStub in the chain.
31 void TrapKey(uint32 usb_keycode, bool trap_key);
32
33 // Causes events matching |in_usb_keycode| to be mapped to |out_usb_keycode|.
34 // Keys are remapped at most once. Traps are processed before remapping.
35 void RemapKey(uint32 in_usb_keycode, uint32 out_usb_keycode);
36
37 // InputFilter overrides.
38 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
39
40 private:
41 std::map<uint32,uint32> mapped_keys;
42 std::set<uint32> trapped_keys;
43 KeyTrapCallback trap_callback;
44
45 DISALLOW_COPY_AND_ASSIGN(KeyEventMapper);
46 };
47
48 } // namespace remoting
49
50 #endif // REMOTING_CLIENT_KEY_EVENT_MAPPER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/client/key_event_mapper.cc » ('j') | remoting/client/key_event_mapper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698