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_DUPLICATE_FILTER_H_ | |
| 6 #define REMOTING_PROTOCOL_CLIPBOARD_DUPLICATE_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 // ClipboardDuplicateFilter stops the host sending a clipboard item to the | |
| 18 // client, if it knows that the client already has that item on its clipboard. | |
| 19 class ClipboardDuplicateFilter { | |
| 20 public: | |
| 21 ClipboardDuplicateFilter(); | |
| 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(); | |
| 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(ClipboardDuplicateFilter* filter); | |
| 41 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; | |
| 42 | |
| 43 private: | |
| 44 ClipboardDuplicateFilter* filter_; | |
| 45 }; | |
| 46 | |
| 47 class HostFilter : public ClipboardStub { | |
| 48 public: | |
| 49 HostFilter(ClipboardDuplicateFilter* filter); | |
| 50 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; | |
| 51 | |
| 52 private: | |
| 53 ClipboardDuplicateFilter* 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_; | |
|
Wez
2012/05/18 18:51:52
If you make these scoped_ptr<Client/HostFilter>, o
simonmorris
2012/05/21 17:16:00
If the filter class definitions are in an anonymou
| |
| 63 | |
| 64 // The most recent item sent to the client or host. | |
| 65 std::string recent_mime_type_; | |
| 66 std::string recent_data_; | |
|
Wez
2012/05/18 18:51:52
nit: Since these will now reflect the most recent
simonmorris
2012/05/21 17:16:00
Done.
| |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(ClipboardDuplicateFilter); | |
| 69 }; | |
| 70 | |
| 71 } // namespace protocol | |
| 72 } // namespace remoting | |
| 73 | |
| 74 #endif // REMOTING_PROTOCOL_CLIPBOARD_DUPLICATE_FILTER_H_ | |
| OLD | NEW |