Chromium Code Reviews| 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..1de148c8297ba62715193012665cd69e9bd26e64 |
| --- /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. |
|
Wez
2012/05/16 20:51:43
I don't think the filter behaviour actually needs
simonmorris
2012/05/16 22:35:25
I agree that we want to suppress local clipboard e
Wez
2012/05/18 18:51:52
As discussed offline, we'll have this class suppre
Wez
2012/05/18 18:51:52
Please consider this change to derived the filter
simonmorris
2012/05/21 17:15:58
Done.
simonmorris
2012/05/21 17:15:58
I'd prefer not to inherit an implementation.
Wez
2012/05/21 22:33:15
That's a fair point, and it's not something I'd su
simonmorris
2012/05/21 23:01:33
OK. Sounds like a question for a separate CL.
|
| +class ClipboardDuplicateFilter { |
| + public: |
| + ClipboardDuplicateFilter(); |
| + |
| + // Sets the ClipboardStub that sends events to the client. |
| + void set_to_client(ClipboardStub* clipboard_stub); |
| + |
| + // Sets the ClipboardStub that sends events to the host. |
| + void set_to_host(ClipboardStub* clipboard_stub); |
| + |
| + // Gets the ClipboardStub that sends events through this filter and on to the |
| + // client. |
| + ClipboardStub* get_filter_to_client(); |
|
Wez
2012/05/16 20:51:43
teensy nit: get_client_filter()?
simonmorris
2012/05/16 22:35:25
Done.
|
| + |
| + // Gets the ClipboardStub that sends events through this filter and on to the |
| + // host. |
| + ClipboardStub* get_filter_to_host(); |
| + |
| + private: |
| + class FilterToClient : public ClipboardStub { |
| + public: |
| + FilterToClient(ClipboardDuplicateFilter* filter); |
| + virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
| + |
| + private: |
| + ClipboardDuplicateFilter* filter_; |
| + }; |
| + |
| + class FilterToHost : public ClipboardStub { |
| + public: |
| + FilterToHost(ClipboardDuplicateFilter* filter); |
| + virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
| + |
| + private: |
| + ClipboardDuplicateFilter* filter_; |
| + }; |
| + |
| + void InjectClipboardEventToHost(const ClipboardEvent& event); |
| + void InjectClipboardEventToClient(const ClipboardEvent& event); |
|
Wez
2012/05/18 18:51:52
nit: If we're moving to just have this class suppr
simonmorris
2012/05/21 17:15:58
But then the logic is split across two classes. It
Wez
2012/05/21 22:33:15
Actually, what I have in mind is pushing the logic
simonmorris
2012/05/21 23:01:33
The code would still be split across two separate
|
| + |
| + ClipboardStub* to_host_; |
| + ClipboardStub* to_client_; |
|
Wez
2012/05/16 20:51:43
teensy nit: I think these should be client_stub_ a
simonmorris
2012/05/16 22:35:25
Done.
|
| + FilterToClient filter_to_client_; |
| + FilterToHost filter_to_host_; |
| + |
| + // The most recent item sent to the client or host. |
| + std::string recent_mime_type_; |
| + std::string recent_data_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ClipboardDuplicateFilter); |
| +}; |
| + |
| +} // namespace protocol |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_PROTOCOL_CLIPBOARD_DUPLICATE_FILTER_H_ |