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

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

Issue 6780014: Clean up remoting project (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got rid of ref counting on user authenticator Created 9 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/host/event_executor_mac.h ('k') | remoting/host/event_executor_win.h » ('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) 2010 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_mac.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"
11 #include "base/compiler_specific.h"
12 #include "base/mac/scoped_cftyperef.h"
10 #include "base/message_loop.h" 13 #include "base/message_loop.h"
11 #include "base/task.h" 14 #include "base/task.h"
12 #include "base/mac/scoped_cftyperef.h"
13 #include "remoting/host/capturer.h" 15 #include "remoting/host/capturer.h"
16 #include "remoting/proto/internal.pb.h"
14 #include "remoting/protocol/message_decoder.h" 17 #include "remoting/protocol/message_decoder.h"
15 #include "remoting/proto/internal.pb.h"
16 18
17 namespace remoting { 19 namespace remoting {
18 20
21 namespace {
22
19 using protocol::MouseEvent; 23 using protocol::MouseEvent;
20 using protocol::KeyEvent; 24 using protocol::KeyEvent;
21 25
26 // A class to generate events on Mac.
27 class EventExecutorMac : public EventExecutor {
28 public:
29 EventExecutorMac(MessageLoopForUI* message_loop, Capturer* capturer);
30 virtual ~EventExecutorMac() {}
31
32 virtual void InjectKeyEvent(const KeyEvent* event, Task* done) OVERRIDE;
33 virtual void InjectMouseEvent(const MouseEvent* event, Task* done) OVERRIDE;
34
35 private:
36 MessageLoopForUI* message_loop_;
37 Capturer* capturer_;
38 int last_x_, last_y_;
39 int modifiers_, mouse_buttons_;
40
41 DISALLOW_COPY_AND_ASSIGN(EventExecutorMac);
42 };
43
22 EventExecutorMac::EventExecutorMac( 44 EventExecutorMac::EventExecutorMac(
23 MessageLoopForUI* message_loop, Capturer* capturer) 45 MessageLoopForUI* message_loop, Capturer* capturer)
24 : message_loop_(message_loop), 46 : message_loop_(message_loop),
25 capturer_(capturer), last_x_(0), last_y_(0), modifiers_(0), 47 capturer_(capturer), last_x_(0), last_y_(0), modifiers_(0),
26 mouse_buttons_(0) { 48 mouse_buttons_(0) {
27 } 49 }
28 50
29 EventExecutorMac::~EventExecutorMac() {
30 }
31
32 // Hard-coded mapping from Virtual Key codes to Mac KeySyms. 51 // Hard-coded mapping from Virtual Key codes to Mac KeySyms.
33 // This mapping is only valid if both client and host are using a 52 // This mapping is only valid if both client and host are using a
34 // US English keyboard layout. 53 // US English keyboard layout.
35 // Because we're passing VK codes on the wire, with no Scancode, 54 // Because we're passing VK codes on the wire, with no Scancode,
36 // "extended" flag, etc, things like distinguishing left & right 55 // "extended" flag, etc, things like distinguishing left & right
37 // Shift keys doesn't work. 56 // Shift keys doesn't work.
38 // 57 //
39 // TODO(wez): Replace this with something more closely tied to what 58 // TODO(wez): Replace this with something more closely tied to what
40 // WebInputEventFactory does on Linux/GTK, and which respects the 59 // WebInputEventFactory does on Linux/GTK, and which respects the
41 // host's keyboard layout. 60 // host's keyboard layout.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 if (event->has_wheel_offset_x() && event->has_wheel_offset_y()) { 299 if (event->has_wheel_offset_x() && event->has_wheel_offset_y()) {
281 // TODO(jamiewalch): Use either CGPostScrollWheelEvent() or 300 // TODO(jamiewalch): Use either CGPostScrollWheelEvent() or
282 // CGEventCreateScrollWheelEvent() to inject scroll events. 301 // CGEventCreateScrollWheelEvent() to inject scroll events.
283 NOTIMPLEMENTED() << "No scroll wheel support yet."; 302 NOTIMPLEMENTED() << "No scroll wheel support yet.";
284 } 303 }
285 304
286 done->Run(); 305 done->Run();
287 delete done; 306 delete done;
288 } 307 }
289 308
290 protocol::InputStub* CreateEventExecutor(MessageLoopForUI* message_loop, 309 } // namespace
291 Capturer* capturer) { 310
311 EventExecutor* EventExecutor::Create(MessageLoopForUI* message_loop,
312 Capturer* capturer) {
292 return new EventExecutorMac(message_loop, capturer); 313 return new EventExecutorMac(message_loop, capturer);
293 } 314 }
294 315
295 } // namespace remoting 316 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/event_executor_mac.h ('k') | remoting/host/event_executor_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698