OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/host/event_executor.h" | 5 #include "remoting/host/event_executor.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 DISALLOW_COPY_AND_ASSIGN(EventExecutorWin); | 39 DISALLOW_COPY_AND_ASSIGN(EventExecutorWin); |
40 }; | 40 }; |
41 | 41 |
42 EventExecutorWin::EventExecutorWin(MessageLoop* message_loop, | 42 EventExecutorWin::EventExecutorWin(MessageLoop* message_loop, |
43 Capturer* capturer) | 43 Capturer* capturer) |
44 : message_loop_(message_loop), | 44 : message_loop_(message_loop), |
45 capturer_(capturer) { | 45 capturer_(capturer) { |
46 } | 46 } |
47 | 47 |
48 void EventExecutorWin::InjectKeyEvent(const KeyEvent* event, Task* done) { | 48 void EventExecutorWin::InjectKeyEvent(const KeyEvent* event, Task* done) { |
49 base::ScopedTaskRunner done_runner(done); | 49 media::AutoTaskRunner done_runner(done); |
50 | 50 |
51 if (MessageLoop::current() != message_loop_) { | 51 if (MessageLoop::current() != message_loop_) { |
52 message_loop_->PostTask( | 52 message_loop_->PostTask( |
53 FROM_HERE, | 53 FROM_HERE, |
54 NewRunnableMethod(this, &EventExecutorWin::InjectKeyEvent, | 54 NewRunnableMethod(this, &EventExecutorWin::InjectKeyEvent, |
55 event, done_runner.Release())); | 55 event, done_runner.release())); |
56 return; | 56 return; |
57 } | 57 } |
58 | 58 |
59 HandleKey(event); | 59 HandleKey(event); |
60 } | 60 } |
61 | 61 |
62 void EventExecutorWin::InjectMouseEvent(const MouseEvent* event, Task* done) { | 62 void EventExecutorWin::InjectMouseEvent(const MouseEvent* event, Task* done) { |
63 base::ScopedTaskRunner done_runner(done); | 63 media::AutoTaskRunner done_runner(done); |
64 | 64 |
65 if (MessageLoop::current() != message_loop_) { | 65 if (MessageLoop::current() != message_loop_) { |
66 message_loop_->PostTask( | 66 message_loop_->PostTask( |
67 FROM_HERE, | 67 FROM_HERE, |
68 NewRunnableMethod(this, &EventExecutorWin::InjectMouseEvent, | 68 NewRunnableMethod(this, &EventExecutorWin::InjectMouseEvent, |
69 event, done_runner.Release())); | 69 event, done_runner.release())); |
70 return; | 70 return; |
71 } | 71 } |
72 | 72 |
73 HandleMouse(event); | 73 HandleMouse(event); |
74 } | 74 } |
75 | 75 |
76 void EventExecutorWin::HandleKey(const KeyEvent* event) { | 76 void EventExecutorWin::HandleKey(const KeyEvent* event) { |
77 int key = event->keycode(); | 77 int key = event->keycode(); |
78 bool down = event->pressed(); | 78 bool down = event->pressed(); |
79 | 79 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } // namespace | 172 } // namespace |
173 | 173 |
174 EventExecutor* EventExecutor::Create(MessageLoop* message_loop, | 174 EventExecutor* EventExecutor::Create(MessageLoop* message_loop, |
175 Capturer* capturer) { | 175 Capturer* capturer) { |
176 return new EventExecutorWin(message_loop, capturer); | 176 return new EventExecutorWin(message_loop, capturer); |
177 } | 177 } |
178 | 178 |
179 } // namespace remoting | 179 } // namespace remoting |
180 | 180 |
181 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::EventExecutorWin); | 181 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::EventExecutorWin); |
OLD | NEW |