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 #ifndef REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_ | |
| 6 #define REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "remoting/protocol/clipboard_stub.h" | |
| 13 | |
| 14 namespace remoting { | |
| 15 namespace protocol { | |
| 16 | |
| 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 | |
| 23 // Sets the ClipboardStub that sends events to the client. | |
| 24 void set_client_stub(ClipboardStub* client_stub); | |
| 25 | |
| 26 // Sets the ClipboardStub that sends events to the host. | |
| 27 void set_host_stub(ClipboardStub* host_stub); | |
| 28 | |
| 29 // Gets the ClipboardStub that sends events through this filter and on to the | |
| 30 // client. | |
| 31 ClipboardStub* get_client_filter(); | |
|
Wez
2012/05/21 22:33:15
nit: Since these are simple getters for members th
simonmorris
2012/05/21 23:01:33
Done.
| |
| 32 | |
| 33 // Gets the ClipboardStub that sends events through this filter and on to the | |
| 34 // host. | |
| 35 ClipboardStub* get_host_filter(); | |
| 36 | |
| 37 private: | |
| 38 class ClientFilter : public ClipboardStub { | |
| 39 public: | |
| 40 ClientFilter(ClipboardEchoFilter* filter); | |
| 41 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; | |
| 42 | |
| 43 private: | |
| 44 ClipboardEchoFilter* filter_; | |
| 45 }; | |
| 46 | |
| 47 class HostFilter : public ClipboardStub { | |
| 48 public: | |
| 49 HostFilter(ClipboardEchoFilter* filter); | |
| 50 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; | |
| 51 | |
| 52 private: | |
| 53 ClipboardEchoFilter* filter_; | |
| 54 }; | |
| 55 | |
| 56 void InjectClipboardEventToHost(const ClipboardEvent& event); | |
| 57 void InjectClipboardEventToClient(const ClipboardEvent& event); | |
| 58 | |
| 59 ClipboardStub* host_stub_; | |
| 60 ClipboardStub* client_stub_; | |
| 61 ClientFilter client_filter_; | |
| 62 HostFilter host_filter_; | |
| 63 | |
| 64 // The latest item received from the client. | |
| 65 std::string client_latest_mime_type_; | |
| 66 std::string client_latest_data_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(ClipboardEchoFilter); | |
| 69 }; | |
| 70 | |
| 71 } // namespace protocol | |
| 72 } // namespace remoting | |
| 73 | |
| 74 #endif // REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_ | |
| OLD | NEW |