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

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

Issue 8985007: Refactoring of the client-side input pipeline and scaling dimension management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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
Sergey Ulanov 2011/12/20 00:05:35 remove this line
Wez 2011/12/20 07:14:14 Done.
12 namespace protocol {
13
14 KeyEventTracker::KeyEventTracker(InputStub* input_stub)
15 : input_stub_(input_stub)
16 {
Sergey Ulanov 2011/12/20 00:05:35 must be on the previous line.
Wez 2011/12/20 07:14:14 Done.
17 }
18
19 KeyEventTracker::~KeyEventTracker() {
20 DCHECK(pressed_keys_.empty());
21 }
22
23 void KeyEventTracker::InjectKeyEvent(const KeyEvent& event) {
24 DCHECK(event.has_pressed());
25 DCHECK(event.has_keycode());
26 if (event.pressed()) {
27 pressed_keys_.insert(event.keycode());
28 } else {
29 pressed_keys_.erase(event.keycode());
30 }
31 input_stub_->InjectKeyEvent(event);
32 }
33
34 void KeyEventTracker::InjectMouseEvent(const MouseEvent& event) {
35 input_stub_->InjectMouseEvent(event);
36 }
37
38 void KeyEventTracker::ReleaseAllKeys() {
39 std::set<int>::iterator i;
40 for (i = pressed_keys_.begin(); i != pressed_keys_.end(); ++i) {
41 KeyEvent event;
42 event.set_keycode(*i);
43 event.set_pressed(false);
44 input_stub_->InjectKeyEvent(event);
45 }
46 pressed_keys_.clear();
47 }
48
49 } // namespace protocol
50
51 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698