Index: remoting/protocol/clipboard_duplicate_filter.h |
diff --git a/remoting/protocol/clipboard_duplicate_filter.h b/remoting/protocol/clipboard_duplicate_filter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d7bb3ea0f8407cb04707dfbccd24ca7715a10a48 |
--- /dev/null |
+++ b/remoting/protocol/clipboard_duplicate_filter.h |
@@ -0,0 +1,74 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_PROTOCOL_CLIPBOARD_DUPLICATE_FILTER_H_ |
+#define REMOTING_PROTOCOL_CLIPBOARD_DUPLICATE_FILTER_H_ |
+ |
+#include <map> |
+#include <string> |
+ |
+#include "base/compiler_specific.h" |
+#include "remoting/protocol/clipboard_stub.h" |
+ |
+namespace remoting { |
+namespace protocol { |
+ |
+// ClipboardDuplicateFilter stops the host sending a clipboard item to the |
+// client, if it knows that the client already has that item on its clipboard. |
+class ClipboardDuplicateFilter { |
+ public: |
+ ClipboardDuplicateFilter(); |
+ |
+ // Sets the ClipboardStub that sends events to the client. |
+ void set_client_stub(ClipboardStub* client_stub); |
+ |
+ // Sets the ClipboardStub that sends events to the host. |
+ void set_host_stub(ClipboardStub* host_stub); |
+ |
+ // Gets the ClipboardStub that sends events through this filter and on to the |
+ // client. |
+ ClipboardStub* get_client_filter(); |
+ |
+ // Gets the ClipboardStub that sends events through this filter and on to the |
+ // host. |
+ ClipboardStub* get_host_filter(); |
+ |
+ private: |
+ class ClientFilter : public ClipboardStub { |
+ public: |
+ ClientFilter(ClipboardDuplicateFilter* filter); |
+ virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
+ |
+ private: |
+ ClipboardDuplicateFilter* filter_; |
+ }; |
+ |
+ class HostFilter : public ClipboardStub { |
+ public: |
+ HostFilter(ClipboardDuplicateFilter* filter); |
+ virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
+ |
+ private: |
+ ClipboardDuplicateFilter* filter_; |
+ }; |
+ |
+ void InjectClipboardEventToHost(const ClipboardEvent& event); |
+ void InjectClipboardEventToClient(const ClipboardEvent& event); |
+ |
+ ClipboardStub* host_stub_; |
+ ClipboardStub* client_stub_; |
+ ClientFilter client_filter_; |
+ 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
|
+ |
+ // The most recent item sent to the client or host. |
+ std::string recent_mime_type_; |
+ 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.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(ClipboardDuplicateFilter); |
+}; |
+ |
+} // namespace protocol |
+} // namespace remoting |
+ |
+#endif // REMOTING_PROTOCOL_CLIPBOARD_DUPLICATE_FILTER_H_ |