Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // ClipboardProxy is used to allow a Clipboard on the UI thread to invoke | |
| 6 // a ClipboardStub on the network thread. | |
| 7 | |
| 8 #ifndef REMOTING_PROTOCOL_CLIPBOARD_PROXY_H_ | |
| 9 #define REMOTING_PROTOCOL_CLIPBOARD_PROXY_H_ | |
| 10 | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "remoting/protocol/clipboard_stub.h" | |
| 14 | |
| 15 namespace base { | |
| 16 class MessageLoopProxy; | |
| 17 } // namespace base | |
| 18 | |
| 19 namespace remoting { | |
| 20 namespace protocol { | |
| 21 | |
| 22 class ClipboardProxy | |
|
Wez
2012/05/30 01:15:43
ClipboardThreadProxy?
simonmorris
2012/05/30 16:54:06
Done.
| |
| 23 : public base::RefCountedThreadSafe<ClipboardProxy>, | |
| 24 public ClipboardStub { | |
| 25 public: | |
| 26 // Constructs a proxy for |clipboard_stub| which will trampoline invocations | |
| 27 // to |clipboard_stub_message_loop|. | |
| 28 ClipboardProxy( | |
| 29 scoped_refptr<base::MessageLoopProxy> clipboard_stub_message_loop); | |
| 30 | |
| 31 // ClipboardStub implementation. | |
| 32 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; | |
| 33 | |
| 34 // Attaches to |clipboard_stub|. | |
| 35 // This must only be called from |clipboard_stub_message_loop_|. | |
| 36 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.
| |
| 37 | |
| 38 private: | |
| 39 friend class base::RefCountedThreadSafe<ClipboardProxy>; | |
| 40 virtual ~ClipboardProxy(); | |
| 41 | |
| 42 base::WeakPtr<ClipboardStub> clipboard_stub_; | |
| 43 scoped_refptr<base::MessageLoopProxy> clipboard_stub_message_loop_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(ClipboardProxy); | |
| 46 }; | |
| 47 | |
| 48 } // namespace protocol | |
| 49 } // namespace remoting | |
| 50 | |
| 51 #endif // REMOTING_PROTOCOL_CLIPBOARD_PROXY_H_ | |
| OLD | NEW |