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

Side by Side Diff: remoting/host/event_executor_mac.cc

Issue 7062042: 1;2305;0cRevert 86971 - Move media library AutoTaskRunner to base and rename ScopedTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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/host/event_executor_linux.cc ('k') | remoting/host/event_executor_win.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) 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 <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #include <Carbon/Carbon.h> 8 #include <Carbon/Carbon.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/mac/scoped_cftyperef.h" 12 #include "base/mac/scoped_cftyperef.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/task.h" 14 #include "base/task.h"
15 #include "media/base/callback.h"
15 #include "remoting/host/capturer.h" 16 #include "remoting/host/capturer.h"
16 #include "remoting/proto/internal.pb.h" 17 #include "remoting/proto/internal.pb.h"
17 #include "remoting/protocol/message_decoder.h" 18 #include "remoting/protocol/message_decoder.h"
18 19
19 namespace remoting { 20 namespace remoting {
20 21
21 namespace { 22 namespace {
22 23
23 using protocol::MouseEvent; 24 using protocol::MouseEvent;
24 using protocol::KeyEvent; 25 using protocol::KeyEvent;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // 0xF4 - 0xF7 208 // 0xF4 - 0xF7
208 -1, -1, /* VKEY_ATTN */ -1, /* VKEY_CRSEL */ -1, 209 -1, -1, /* VKEY_ATTN */ -1, /* VKEY_CRSEL */ -1,
209 // 0xF8 - 0xFB 210 // 0xF8 - 0xFB
210 /* VKEY_EXSEL */ -1, /* VKEY_EREOF */ -1, /* VKEY_PLAY */ -1, 211 /* VKEY_EXSEL */ -1, /* VKEY_EREOF */ -1, /* VKEY_PLAY */ -1,
211 /* VKEY_ZOOM */ -1, 212 /* VKEY_ZOOM */ -1,
212 // 0xFC - 0xFF 213 // 0xFC - 0xFF
213 /* VKEY_NONAME */ -1, /* VKEY_PA1 */ -1, /* VKEY_OEM_CLEAR */ -1, -1 214 /* VKEY_NONAME */ -1, /* VKEY_PA1 */ -1, /* VKEY_OEM_CLEAR */ -1, -1
214 }; 215 };
215 216
216 void EventExecutorMac::InjectKeyEvent(const KeyEvent* event, Task* done) { 217 void EventExecutorMac::InjectKeyEvent(const KeyEvent* event, Task* done) {
217 base::ScopedTaskRunner done_runner(done); 218 media::AutoTaskRunner done_runner(done);
218 219
219 int key_code = event->keycode(); 220 int key_code = event->keycode();
220 if (key_code >= 0 && key_code < 256) { 221 if (key_code >= 0 && key_code < 256) {
221 int key_sym = kUsVkeyToKeysym[key_code]; 222 int key_sym = kUsVkeyToKeysym[key_code];
222 if (key_sym != -1) { 223 if (key_sym != -1) {
223 base::mac::ScopedCFTypeRef<CGEventRef> kbd_event( 224 base::mac::ScopedCFTypeRef<CGEventRef> kbd_event(
224 CGEventCreateKeyboardEvent(0, kUsVkeyToKeysym[key_code], 225 CGEventCreateKeyboardEvent(0, kUsVkeyToKeysym[key_code],
225 event->pressed())); 226 event->pressed()));
226 int this_modifier = 0; 227 int this_modifier = 0;
227 switch (key_sym) { 228 switch (key_sym) {
(...skipping 15 matching lines...) Expand all
243 } else if (this_modifier && !event->pressed()) { 244 } else if (this_modifier && !event->pressed()) {
244 modifiers_ &= ~this_modifier; 245 modifiers_ &= ~this_modifier;
245 } 246 }
246 CGEventSetFlags(kbd_event, modifiers_); 247 CGEventSetFlags(kbd_event, modifiers_);
247 CGEventPost(kCGSessionEventTap, kbd_event); 248 CGEventPost(kCGSessionEventTap, kbd_event);
248 } 249 }
249 } 250 }
250 } 251 }
251 252
252 void EventExecutorMac::InjectMouseEvent(const MouseEvent* event, Task* done) { 253 void EventExecutorMac::InjectMouseEvent(const MouseEvent* event, Task* done) {
253 base::ScopedTaskRunner done_runner(done); 254 media::AutoTaskRunner done_runner(done);
254 255
255 if (event->has_x() && event->has_y()) { 256 if (event->has_x() && event->has_y()) {
256 // TODO(wez): Checking the validity of the MouseEvent should be done in core 257 // TODO(wez): Checking the validity of the MouseEvent should be done in core
257 // cross-platform code, not here! 258 // cross-platform code, not here!
258 // TODO(wez): This code assumes that MouseEvent(0,0) (top-left of client vie w) 259 // TODO(wez): This code assumes that MouseEvent(0,0) (top-left of client vie w)
259 // corresponds to local (0,0) (top-left of primary monitor). That won't in 260 // corresponds to local (0,0) (top-left of primary monitor). That won't in
260 // general be true on multi-monitor systems, though. 261 // general be true on multi-monitor systems, though.
261 gfx::Size size = capturer_->size_most_recent(); 262 gfx::Size size = capturer_->size_most_recent();
262 if (event->x() >= 0 || event->y() >= 0 || 263 if (event->x() >= 0 || event->y() >= 0 ||
263 event->x() < size.width() || event->y() < size.height()) { 264 event->x() < size.width() || event->y() < size.height()) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 307 }
307 308
308 } // namespace 309 } // namespace
309 310
310 EventExecutor* EventExecutor::Create(MessageLoop* message_loop, 311 EventExecutor* EventExecutor::Create(MessageLoop* message_loop,
311 Capturer* capturer) { 312 Capturer* capturer) {
312 return new EventExecutorMac(message_loop, capturer); 313 return new EventExecutorMac(message_loop, capturer);
313 } 314 }
314 315
315 } // namespace remoting 316 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/event_executor_linux.cc ('k') | remoting/host/event_executor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698