Re-land: C++ readability review
[chromium-blink-merge.git] / remoting / protocol / clipboard_thread_proxy.h
blobaf688320dd9c8deebfe229be58630bb6d82b22ec
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.
5 // ClipboardThreadProxy is used to allow a Clipboard on the UI thread to invoke
6 // a ClipboardStub on the network thread.
8 #ifndef REMOTING_PROTOCOL_CLIPBOARD_THREAD_PROXY_H_
9 #define REMOTING_PROTOCOL_CLIPBOARD_THREAD_PROXY_H_
11 #include "base/memory/weak_ptr.h"
12 #include "base/task_runner.h"
13 #include "remoting/protocol/clipboard_stub.h"
15 namespace base {
16 class MessageLoopProxy;
17 } // namespace base
19 namespace remoting {
20 namespace protocol {
22 class ClipboardThreadProxy : public ClipboardStub {
23 public:
24 ~ClipboardThreadProxy() override;
26 // Constructs a proxy for |clipboard_stub| which will trampoline invocations
27 // to |clipboard_stub_task_runner|.
28 ClipboardThreadProxy(
29 const base::WeakPtr<ClipboardStub>& clipboard_stub,
30 scoped_refptr<base::TaskRunner> clipboard_stub_task_runner);
32 // ClipboardStub implementation.
33 void InjectClipboardEvent(const ClipboardEvent& event) override;
35 private:
36 // Injects a clipboard event into a stub, if the given weak pointer to the
37 // stub is valid.
38 static void InjectClipboardEventStatic(
39 const base::WeakPtr<ClipboardStub>& clipboard_stub,
40 const ClipboardEvent& event);
42 base::WeakPtr<ClipboardStub> clipboard_stub_;
43 scoped_refptr<base::TaskRunner> clipboard_stub_task_runner_;
45 DISALLOW_COPY_AND_ASSIGN(ClipboardThreadProxy);
48 } // namespace protocol
49 } // namespace remoting
51 #endif // REMOTING_PROTOCOL_CLIPBOARD_THREAD_PROXY_H_