Chromium Code Reviews| Index: remoting/protocol/clipboard_thread_proxy.h |
| diff --git a/remoting/protocol/clipboard_thread_proxy.h b/remoting/protocol/clipboard_thread_proxy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8bd2a9393dc393bf679cf8dfe79b20c0b1733786 |
| --- /dev/null |
| +++ b/remoting/protocol/clipboard_thread_proxy.h |
| @@ -0,0 +1,50 @@ |
| +// 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. |
| + |
| +// ClipboardThreadProxy is used to allow a Clipboard on the UI thread to invoke |
| +// a ClipboardStub on the network thread. |
| + |
| +#ifndef REMOTING_PROTOCOL_CLIPBOARD_THREAD_PROXY_H_ |
| +#define REMOTING_PROTOCOL_CLIPBOARD_THREAD_PROXY_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "remoting/protocol/clipboard_stub.h" |
| + |
| +namespace base { |
| +class MessageLoopProxy; |
| +} // namespace base |
| + |
| +namespace remoting { |
| +namespace protocol { |
| + |
| +class ClipboardThreadProxy : public ClipboardStub { |
| + public: |
| + ~ClipboardThreadProxy(); |
|
Wez
2012/05/30 23:58:02
virtual
simonmorris
2012/05/31 00:21:18
Done.
|
| + |
| + // Constructs a proxy for |clipboard_stub| which will trampoline invocations |
| + // to |clipboard_stub_message_loop|. |
| + ClipboardThreadProxy( |
| + const base::WeakPtr<ClipboardStub>& clipboard_stub, |
| + scoped_refptr<base::MessageLoopProxy> clipboard_stub_message_loop); |
|
Wez
2012/05/30 23:58:02
nit: We're moving to SingleThreadTaskRunner, which
simonmorris
2012/05/31 00:21:18
Done.
|
| + |
| + // ClipboardStub implementation. |
| + virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
| + |
| + // Injects a clipboard event into a stub, if the given weak pointer to the |
| + // stub is valid. |
| + static void InjectClipboardEventStatic( |
| + const base::WeakPtr<ClipboardStub>& clipboard_stub, |
| + const ClipboardEvent& event); |
|
Wez
2012/05/30 23:58:02
Make this private, since it's an internal implemen
simonmorris
2012/05/31 00:21:18
Done.
|
| + |
| + private: |
| + base::WeakPtr<ClipboardStub> clipboard_stub_; |
| + scoped_refptr<base::MessageLoopProxy> clipboard_stub_message_loop_; |
|
Wez
2012/05/30 23:58:02
nit: These could be target_stub_ and target_messag
simonmorris
2012/05/31 00:21:18
I'd prefer to keep these names, for consistency wi
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(ClipboardThreadProxy); |
| +}; |
| + |
| +} // namespace protocol |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_PROTOCOL_CLIPBOARD_THREAD_PROXY_H_ |