Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / remoting / protocol / clipboard_echo_filter.h
blob4e20d3b549a54f5e426f397accac13f94be0afe3
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 #ifndef REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_
6 #define REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_
8 #include <map>
9 #include <string>
11 #include "base/compiler_specific.h"
12 #include "remoting/protocol/clipboard_stub.h"
14 namespace remoting {
15 namespace protocol {
17 // ClipboardEchoFilter stops the host sending a clipboard item to the
18 // client, if that item was the latest item received from the client.
19 class ClipboardEchoFilter {
20 public:
21 ClipboardEchoFilter();
22 ~ClipboardEchoFilter();
24 // Sets the ClipboardStub that sends events to the client.
25 void set_client_stub(ClipboardStub* client_stub);
27 // Sets the ClipboardStub that sends events to the host.
28 void set_host_stub(ClipboardStub* host_stub);
30 // Gets the ClipboardStub that sends events through this filter and on to the
31 // client.
32 ClipboardStub* client_filter();
34 // Gets the ClipboardStub that sends events through this filter and on to the
35 // host.
36 ClipboardStub* host_filter();
38 private:
39 class ClientFilter : public ClipboardStub {
40 public:
41 ClientFilter(ClipboardEchoFilter* filter);
42 void InjectClipboardEvent(const ClipboardEvent& event) override;
44 private:
45 ClipboardEchoFilter* filter_;
48 class HostFilter : public ClipboardStub {
49 public:
50 HostFilter(ClipboardEchoFilter* filter);
51 void InjectClipboardEvent(const ClipboardEvent& event) override;
53 private:
54 ClipboardEchoFilter* filter_;
57 void InjectClipboardEventToHost(const ClipboardEvent& event);
58 void InjectClipboardEventToClient(const ClipboardEvent& event);
60 ClipboardStub* host_stub_;
61 ClipboardStub* client_stub_;
62 ClientFilter client_filter_;
63 HostFilter host_filter_;
65 // The latest item received from the client.
66 std::string client_latest_mime_type_;
67 std::string client_latest_data_;
69 DISALLOW_COPY_AND_ASSIGN(ClipboardEchoFilter);
72 } // namespace protocol
73 } // namespace remoting
75 #endif // REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_