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

Side by Side Diff: remoting/protocol/key_event_tracker.cc

Issue 9465035: Move ClientSession's input logic into separate components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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 | « remoting/protocol/key_event_tracker.h ('k') | remoting/protocol/key_event_tracker_unittest.cc » ('j') | no next file with comments »
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 #include "remoting/protocol/key_event_tracker.h"
6
7 #include "base/logging.h"
8 #include "remoting/proto/event.pb.h"
9
10 namespace remoting {
11 namespace protocol {
12
13 KeyEventTracker::KeyEventTracker(InputStub* input_stub)
14 : input_stub_(input_stub) {
15 }
16
17 KeyEventTracker::~KeyEventTracker() {
18 }
19
20 void KeyEventTracker::InjectKeyEvent(const KeyEvent& event) {
21 DCHECK(event.has_pressed());
22 DCHECK(event.has_keycode());
23 if (event.pressed()) {
24 pressed_keys_.insert(event.keycode());
25 } else {
26 pressed_keys_.erase(event.keycode());
27 }
28 input_stub_->InjectKeyEvent(event);
29 }
30
31 void KeyEventTracker::InjectMouseEvent(const MouseEvent& event) {
32 input_stub_->InjectMouseEvent(event);
33 }
34
35 void KeyEventTracker::ReleaseAllKeys() {
36 std::set<int>::iterator i;
37 for (i = pressed_keys_.begin(); i != pressed_keys_.end(); ++i) {
38 KeyEvent event;
39 event.set_keycode(*i);
40 event.set_pressed(false);
41 input_stub_->InjectKeyEvent(event);
42 }
43 pressed_keys_.clear();
44 }
45
46 } // namespace protocol
47 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/key_event_tracker.h ('k') | remoting/protocol/key_event_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698