Chromium Code Reviews| Index: remoting/protocol/clipboard_proxy.h |
| diff --git a/remoting/protocol/clipboard_proxy.h b/remoting/protocol/clipboard_proxy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0b4dadaad141b0bf51efaf7bff43472de65d02b4 |
| --- /dev/null |
| +++ b/remoting/protocol/clipboard_proxy.h |
| @@ -0,0 +1,51 @@ |
| +// 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. |
| + |
| +// ClipboardProxy is used to allow a Clipboard on the UI thread to invoke |
| +// a ClipboardStub on the network thread. |
| + |
| +#ifndef REMOTING_PROTOCOL_CLIPBOARD_PROXY_H_ |
| +#define REMOTING_PROTOCOL_CLIPBOARD_PROXY_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "remoting/protocol/clipboard_stub.h" |
| + |
| +namespace base { |
| +class MessageLoopProxy; |
| +} // namespace base |
| + |
| +namespace remoting { |
| +namespace protocol { |
| + |
| +class ClipboardProxy |
|
Wez
2012/05/30 01:15:43
ClipboardThreadProxy?
simonmorris
2012/05/30 16:54:06
Done.
|
| + : public base::RefCountedThreadSafe<ClipboardProxy>, |
| + public ClipboardStub { |
| + public: |
| + // Constructs a proxy for |clipboard_stub| which will trampoline invocations |
| + // to |clipboard_stub_message_loop|. |
| + ClipboardProxy( |
| + scoped_refptr<base::MessageLoopProxy> clipboard_stub_message_loop); |
| + |
| + // ClipboardStub implementation. |
| + virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
| + |
| + // Attaches to |clipboard_stub|. |
| + // This must only be called from |clipboard_stub_message_loop_|. |
| + void Attach(const base::WeakPtr<ClipboardStub>& clipboard_stub); |
|
Wez
2012/05/30 01:15:43
Why not have |clipboard_stub| as a constructor par
simonmorris
2012/05/30 16:54:06
Done.
|
| + |
| + private: |
| + friend class base::RefCountedThreadSafe<ClipboardProxy>; |
| + virtual ~ClipboardProxy(); |
| + |
| + base::WeakPtr<ClipboardStub> clipboard_stub_; |
| + scoped_refptr<base::MessageLoopProxy> clipboard_stub_message_loop_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ClipboardProxy); |
| +}; |
| + |
| +} // namespace protocol |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_PROTOCOL_CLIPBOARD_PROXY_H_ |