Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: remoting/protocol/clipboard_echo_filter.h

Issue 10399052: [Chromoting] Add a filter that will stop the host sending unnecessary clipboard events to the clien… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/clipboard_echo_filter.h
diff --git a/remoting/protocol/clipboard_echo_filter.h b/remoting/protocol/clipboard_echo_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..95926eb2402df5ac401d670a47551dd629d073f9
--- /dev/null
+++ b/remoting/protocol/clipboard_echo_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_ECHO_FILTER_H_
+#define REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_
+
+#include <map>
+#include <string>
+
+#include "base/compiler_specific.h"
+#include "remoting/protocol/clipboard_stub.h"
+
+namespace remoting {
+namespace protocol {
+
+// ClipboardEchoFilter stops the host sending a clipboard item to the
+// client, if that item was the latest item received from the client.
+class ClipboardEchoFilter {
+ public:
+ ClipboardEchoFilter();
+
+ // 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();
Wez 2012/05/21 22:33:15 nit: Since these are simple getters for members th
simonmorris 2012/05/21 23:01:33 Done.
+
+ // 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(ClipboardEchoFilter* filter);
+ virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE;
+
+ private:
+ ClipboardEchoFilter* filter_;
+ };
+
+ class HostFilter : public ClipboardStub {
+ public:
+ HostFilter(ClipboardEchoFilter* filter);
+ virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE;
+
+ private:
+ ClipboardEchoFilter* filter_;
+ };
+
+ void InjectClipboardEventToHost(const ClipboardEvent& event);
+ void InjectClipboardEventToClient(const ClipboardEvent& event);
+
+ ClipboardStub* host_stub_;
+ ClipboardStub* client_stub_;
+ ClientFilter client_filter_;
+ HostFilter host_filter_;
+
+ // The latest item received from the client.
+ std::string client_latest_mime_type_;
+ std::string client_latest_data_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClipboardEchoFilter);
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_CLIPBOARD_ECHO_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698