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

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: Fix nits. 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
« no previous file with comments | « remoting/host/clipboard_linux.cc ('k') | remoting/host/linux/x_server_clipboard.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/event_executor_linux.cc
diff --git a/remoting/host/event_executor_linux.cc b/remoting/host/event_executor_linux.cc
index 140a2483fe948cdf00fa9d730d189a7c2a539560..cd9374177b0f7c80fad2794bebe3d17dec07557c 100644
--- a/remoting/host/event_executor_linux.cc
+++ b/remoting/host/event_executor_linux.cc
@@ -16,6 +16,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"
@@ -59,6 +60,8 @@ class EventExecutorLinux : public EventExecutor {
// Left, Right, Middle, VScroll Up/Down, HScroll Left/Right.
static const int kNumPointerButtons = 7;
+ void InitClipboard();
+
// |mode| is one of the AutoRepeatModeOn, AutoRepeatModeOff,
// AutoRepeatModeDefault constants defined by the XChangeKeyboardControl()
// API.
@@ -83,6 +86,9 @@ class EventExecutorLinux : public EventExecutor {
int test_error_base_;
int pointer_button_map_[kNumPointerButtons];
+
+ scoped_ptr<Clipboard> clipboard_;
+
DISALLOW_COPY_AND_ASSIGN(EventExecutorLinux);
};
@@ -92,6 +98,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() {
@@ -120,7 +131,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) {
@@ -170,6 +189,11 @@ void EventExecutorLinux::InjectKeyEvent(const KeyEvent& event) {
XFlush(display_);
}
+void EventExecutorLinux::InitClipboard() {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ clipboard_ = Clipboard::Create();
+}
+
void EventExecutorLinux::SetAutoRepeatForKey(int keycode, int mode) {
XKeyboardControl control;
control.key = keycode;
@@ -361,8 +385,9 @@ void EventExecutorLinux::Start(
base::Passed(&client_clipboard)));
return;
}
+
InitMouseButtonMap();
- return;
+ clipboard_->Start(client_clipboard.Pass());
}
void EventExecutorLinux::StopAndDelete() {
« no previous file with comments | « remoting/host/clipboard_linux.cc ('k') | remoting/host/linux/x_server_clipboard.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698