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

Unified Diff: remoting/protocol/clipboard_proxy.cc

Issue 10413060: [Chromoting] Let the Windows IT2Me host send clipboard events to the client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use MessageLoopProxy+WeakPtr. Created 8 years, 7 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/protocol/clipboard_proxy.cc
diff --git a/remoting/protocol/clipboard_proxy.cc b/remoting/protocol/clipboard_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8ef0622282f30ff51ed4c13f043f1de29c7fe0af
--- /dev/null
+++ b/remoting/protocol/clipboard_proxy.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 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/protocol/clipboard_proxy.h"
+
+#include "base/bind.h"
+#include "base/message_loop.h"
+#include "remoting/proto/event.pb.h"
+
+namespace remoting {
+namespace protocol {
+
+ClipboardProxy::ClipboardProxy(
+ scoped_refptr<base::MessageLoopProxy> clipboard_stub_message_loop)
+ : clipboard_stub_message_loop_(clipboard_stub_message_loop) {
+}
+
+void ClipboardProxy::InjectClipboardEvent(const ClipboardEvent& event) {
+ if (!clipboard_stub_message_loop_->BelongsToCurrentThread()) {
+ clipboard_stub_message_loop_->PostTask(FROM_HERE, base::Bind(
+ &ClipboardProxy::InjectClipboardEvent, this, event));
+ return;
+ }
+
+ if (clipboard_stub_) {
+ clipboard_stub_->InjectClipboardEvent(event);
+ }
+}
+
+void ClipboardProxy::Attach(
+ const base::WeakPtr<ClipboardStub>& clipboard_stub) {
+ DCHECK(clipboard_stub_message_loop_->BelongsToCurrentThread());
+ DCHECK(clipboard_stub_ == NULL);
+ clipboard_stub_ = clipboard_stub;
+}
+
+ClipboardProxy::~ClipboardProxy() {
+}
+
+} // namespace protocol
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698