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

Unified Diff: remoting/host/event_executor_linux.cc

Issue 10909133: Implement clipboard for Chromoting Linux hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use desktop thread for clipboard Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/event_executor_linux.cc
diff --git a/remoting/host/event_executor_linux.cc b/remoting/host/event_executor_linux.cc
index 5227ef263f95c86c1a7b336fccc420ec4fabbcbf..9538dea4f00aa35c9a986352670c9fa06aa09cd4 100644
--- a/remoting/host/event_executor_linux.cc
+++ b/remoting/host/event_executor_linux.cc
@@ -15,6 +15,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
+#include "remoting/host/clipboard.h"
#include "remoting/proto/internal.pb.h"
#include "third_party/skia/include/core/SkPoint.h"
@@ -53,6 +54,8 @@ class EventExecutorLinux : public EventExecutor {
virtual void StopAndDelete() OVERRIDE;
private:
+ void InitClipboard();
+
// |mode| is one of the AutoRepeatModeOn, AutoRepeatModeOff,
// AutoRepeatModeDefault constants defined by the XChangeKeyboardControl()
// API.
@@ -71,6 +74,8 @@ class EventExecutorLinux : public EventExecutor {
int test_event_base_;
int test_error_base_;
+ scoped_ptr<Clipboard> clipboard_;
+
DISALLOW_COPY_AND_ASSIGN(EventExecutorLinux);
};
@@ -108,6 +113,11 @@ EventExecutorLinux::EventExecutorLinux(
latest_mouse_position_(SkIPoint::Make(-1, -1)),
display_(XOpenDisplay(NULL)),
root_window_(BadValue) {
+ if (!task_runner_->BelongsToCurrentThread()) {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&EventExecutorLinux::InitClipboard, base::Unretained(this)));
+ }
}
EventExecutorLinux::~EventExecutorLinux() {
@@ -136,7 +146,15 @@ bool EventExecutorLinux::Init() {
}
void EventExecutorLinux::InjectClipboardEvent(const ClipboardEvent& event) {
- // TODO(simonmorris): Implement clipboard injection.
+ if (!task_runner_->BelongsToCurrentThread()) {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&EventExecutorLinux::InjectClipboardEvent,
+ base::Unretained(this), event));
+ return;
+ }
+
+ clipboard_->InjectClipboardEvent(event);
}
void EventExecutorLinux::InjectKeyEvent(const KeyEvent& event) {
@@ -186,6 +204,10 @@ void EventExecutorLinux::InjectKeyEvent(const KeyEvent& event) {
XFlush(display_);
}
+void EventExecutorLinux::InitClipboard() {
+ clipboard_ = Clipboard::Create();
Sergey Ulanov 2012/09/14 19:35:01 thread DCHECK please.
Lambros 2012/09/14 21:35:13 Done.
+}
+
void EventExecutorLinux::SetAutoRepeatForKey(int keycode, int mode) {
XKeyboardControl control;
control.key = keycode;
@@ -263,7 +285,15 @@ void EventExecutorLinux::InjectMouseEvent(const MouseEvent& event) {
void EventExecutorLinux::Start(
scoped_ptr<protocol::ClipboardStub> client_clipboard) {
- return;
+ if (!task_runner_->BelongsToCurrentThread()) {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&EventExecutorLinux::Start, base::Unretained(this),
+ base::Passed(client_clipboard.Pass())));
Sergey Ulanov 2012/09/14 19:35:01 FYI: alternative, slightly shorter syntax is base:
Lambros 2012/09/14 21:35:13 This got changed to the shorter syntax when I reba
+ return;
+ }
+
+ clipboard_->Start(client_clipboard.Pass());
}
void EventExecutorLinux::StopAndDelete() {

Powered by Google App Engine
This is Rietveld 408576698