diff options
Diffstat (limited to 'remoting/host/event_executor_mac.cc')
-rw-r--r-- | remoting/host/event_executor_mac.cc | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/remoting/host/event_executor_mac.cc b/remoting/host/event_executor_mac.cc index 808f964..e38f514 100644 --- a/remoting/host/event_executor_mac.cc +++ b/remoting/host/event_executor_mac.cc @@ -1,24 +1,46 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "remoting/host/event_executor_mac.h" +#include "remoting/host/event_executor.h" #include <ApplicationServices/ApplicationServices.h> #include <Carbon/Carbon.h> +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "base/mac/scoped_cftyperef.h" #include "base/message_loop.h" #include "base/task.h" -#include "base/mac/scoped_cftyperef.h" #include "remoting/host/capturer.h" -#include "remoting/protocol/message_decoder.h" #include "remoting/proto/internal.pb.h" +#include "remoting/protocol/message_decoder.h" namespace remoting { +namespace { + using protocol::MouseEvent; using protocol::KeyEvent; +// A class to generate events on Mac. +class EventExecutorMac : public EventExecutor { + public: + EventExecutorMac(MessageLoopForUI* message_loop, Capturer* capturer); + virtual ~EventExecutorMac() {} + + virtual void InjectKeyEvent(const KeyEvent* event, Task* done) OVERRIDE; + virtual void InjectMouseEvent(const MouseEvent* event, Task* done) OVERRIDE; + + private: + MessageLoopForUI* message_loop_; + Capturer* capturer_; + int last_x_, last_y_; + int modifiers_, mouse_buttons_; + + DISALLOW_COPY_AND_ASSIGN(EventExecutorMac); +}; + EventExecutorMac::EventExecutorMac( MessageLoopForUI* message_loop, Capturer* capturer) : message_loop_(message_loop), @@ -26,9 +48,6 @@ EventExecutorMac::EventExecutorMac( mouse_buttons_(0) { } -EventExecutorMac::~EventExecutorMac() { -} - // Hard-coded mapping from Virtual Key codes to Mac KeySyms. // This mapping is only valid if both client and host are using a // US English keyboard layout. @@ -287,8 +306,10 @@ void EventExecutorMac::InjectMouseEvent(const MouseEvent* event, Task* done) { delete done; } -protocol::InputStub* CreateEventExecutor(MessageLoopForUI* message_loop, - Capturer* capturer) { +} // namespace + +EventExecutor* EventExecutor::Create(MessageLoopForUI* message_loop, + Capturer* capturer) { return new EventExecutorMac(message_loop, capturer); } |