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 |