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

Side by Side Diff: remoting/protocol/clipboard_duplicate_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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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.
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.
19 class ClipboardDuplicateFilter {
20 public:
21 ClipboardDuplicateFilter();
22
23 // Sets the ClipboardStub that sends events to the client.
24 void set_to_client(ClipboardStub* clipboard_stub);
25
26 // Sets the ClipboardStub that sends events to the host.
27 void set_to_host(ClipboardStub* clipboard_stub);
28
29 // Gets the ClipboardStub that sends events through this filter and on to the
30 // client.
31 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.
32
33 // Gets the ClipboardStub that sends events through this filter and on to the
34 // host.
35 ClipboardStub* get_filter_to_host();
36
37 private:
38 class FilterToClient : public ClipboardStub {
39 public:
40 FilterToClient(ClipboardDuplicateFilter* filter);
41 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE;
42
43 private:
44 ClipboardDuplicateFilter* filter_;
45 };
46
47 class FilterToHost : public ClipboardStub {
48 public:
49 FilterToHost(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);
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
58
59 ClipboardStub* to_host_;
60 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.
61 FilterToClient filter_to_client_;
62 FilterToHost filter_to_host_;
63
64 // The most recent item sent to the client or host.
65 std::string recent_mime_type_;
66 std::string recent_data_;
67
68 DISALLOW_COPY_AND_ASSIGN(ClipboardDuplicateFilter);
69 };
70
71 } // namespace protocol
72 } // namespace remoting
73
74 #endif // REMOTING_PROTOCOL_CLIPBOARD_DUPLICATE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698