summaryrefslogtreecommitdiffstats
path: root/remoting/host/event_executor_win.cc
diff options
context:
space:
mode:
authorsimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-11 17:03:14 +0000
committersimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-11 17:03:14 +0000
commit6d17db9e7a87de58b11c79b30d8513cb9532cbf7 (patch)
tree6245094524ea32f7750529febc02699a49d5f747 /remoting/host/event_executor_win.cc
parent8658269ac4dfabf70fa9079309ef83229ba1b833 (diff)
downloadchromium_src-6d17db9e7a87de58b11c79b30d8513cb9532cbf7.zip
chromium_src-6d17db9e7a87de58b11c79b30d8513cb9532cbf7.tar.gz
chromium_src-6d17db9e7a87de58b11c79b30d8513cb9532cbf7.tar.bz2
[Chromoting] Let a Windows IT2Me host write to the clipboard.
BUG=117473 Review URL: https://chromiumcodereview.appspot.com/10332042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136591 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/event_executor_win.cc')
-rw-r--r--remoting/host/event_executor_win.cc58
1 files changed, 54 insertions, 4 deletions
diff --git a/remoting/host/event_executor_win.cc b/remoting/host/event_executor_win.cc
index 2b553e5..007f31b 100644
--- a/remoting/host/event_executor_win.cc
+++ b/remoting/host/event_executor_win.cc
@@ -10,6 +10,7 @@
#include "base/compiler_specific.h"
#include "base/message_loop.h"
#include "remoting/host/capturer.h"
+#include "remoting/host/clipboard.h"
#include "remoting/proto/event.pb.h"
#include "ui/base/keycodes/keyboard_codes.h"
@@ -39,13 +40,20 @@ class EventExecutorWin : public EventExecutor {
virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
+ // EventExecutor interface.
+ virtual void OnSessionStarted() OVERRIDE;
+ virtual void OnSessionFinished() OVERRIDE;
+
private:
HKL GetForegroundKeyboardLayout();
void HandleKey(const KeyEvent& event);
void HandleMouse(const MouseEvent& event);
+ void HandleSessionStarted();
+ void HandleSessionFinished();
MessageLoop* message_loop_;
Capturer* capturer_;
+ scoped_ptr<Clipboard> clipboard_;
DISALLOW_COPY_AND_ASSIGN(EventExecutorWin);
};
@@ -53,11 +61,21 @@ class EventExecutorWin : public EventExecutor {
EventExecutorWin::EventExecutorWin(MessageLoop* message_loop,
Capturer* capturer)
: message_loop_(message_loop),
- capturer_(capturer) {
+ capturer_(capturer),
+ clipboard_(Clipboard::Create()) {
}
void EventExecutorWin::InjectClipboardEvent(const ClipboardEvent& event) {
- // TODO(simonmorris): Implement clipboard injection.
+ if (MessageLoop::current() != message_loop_) {
+ message_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&EventExecutorWin::InjectClipboardEvent,
+ base::Unretained(this),
+ event));
+ return;
+ }
+
+ clipboard_->InjectClipboardEvent(event);
}
void EventExecutorWin::InjectKeyEvent(const KeyEvent& event) {
@@ -84,6 +102,30 @@ void EventExecutorWin::InjectMouseEvent(const MouseEvent& event) {
HandleMouse(event);
}
+void EventExecutorWin::OnSessionStarted() {
+ if (MessageLoop::current() != message_loop_) {
+ message_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&EventExecutorWin::OnSessionStarted,
+ base::Unretained(this)));
+ return;
+ }
+
+ HandleSessionStarted();
+}
+
+void EventExecutorWin::OnSessionFinished() {
+ if (MessageLoop::current() != message_loop_) {
+ message_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&EventExecutorWin::OnSessionFinished,
+ base::Unretained(this)));
+ return;
+ }
+
+ HandleSessionFinished();
+}
+
HKL EventExecutorWin::GetForegroundKeyboardLayout() {
HKL layout = 0;
@@ -236,11 +278,19 @@ void EventExecutorWin::HandleMouse(const MouseEvent& event) {
}
}
+void EventExecutorWin::HandleSessionStarted() {
+ clipboard_->Start();
+}
+
+void EventExecutorWin::HandleSessionFinished() {
+ clipboard_->Stop();
+}
+
} // namespace
-scoped_ptr<protocol::HostEventStub> EventExecutor::Create(
+scoped_ptr<EventExecutor> EventExecutor::Create(
MessageLoop* message_loop, Capturer* capturer) {
- return scoped_ptr<protocol::HostEventStub>(
+ return scoped_ptr<EventExecutor>(
new EventExecutorWin(message_loop, capturer));
}