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

Side by Side Diff: remoting/protocol/host_control_dispatcher.h

Issue 9921034: [Chromoting] Add plumbing to carry clipboard events from the host to the client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ 5 #ifndef REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_
6 #define REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ 6 #define REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "remoting/protocol/channel_dispatcher_base.h" 9 #include "remoting/protocol/channel_dispatcher_base.h"
10 #include "remoting/protocol/client_stub.h" 10 #include "remoting/protocol/client_stub.h"
11 #include "remoting/protocol/clipboard_stub.h"
11 #include "remoting/protocol/message_reader.h" 12 #include "remoting/protocol/message_reader.h"
12 13
13 namespace net { 14 namespace net {
14 class StreamSocket; 15 class StreamSocket;
15 } // namespace net 16 } // namespace net
16 17
17 namespace remoting { 18 namespace remoting {
18 namespace protocol { 19 namespace protocol {
19 20
20 class BufferedSocketWriter; 21 class BufferedSocketWriter;
21 class ClipboardStub;
22 class ControlMessage; 22 class ControlMessage;
23 class HostStub; 23 class HostStub;
24 class Session; 24 class Session;
25 25
26 // HostControlDispatcher dispatches incoming messages on the control 26 // HostControlDispatcher dispatches incoming messages on the control
27 // channel to HostStub or ClipboardStub, and also implements ClientStub for 27 // channel to HostStub or ClipboardStub, and also implements ClientStub and
28 // outgoing messages. 28 // ClipboardStub for outgoing messages.
29 class HostControlDispatcher : public ChannelDispatcherBase, public ClientStub { 29 class HostControlDispatcher : public ChannelDispatcherBase, public ClientStub,
30 public ClipboardStub {
30 public: 31 public:
31 HostControlDispatcher(); 32 HostControlDispatcher();
32 virtual ~HostControlDispatcher(); 33 virtual ~HostControlDispatcher();
33 34
35 // ClipboardStub implementation.
36 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE;
37
34 // Sets the ClipboardStub that will be called for each incoming clipboard 38 // Sets the ClipboardStub that will be called for each incoming clipboard
35 // message. Doesn't take ownership of |clipboard_stub|, which must outlive 39 // message. Doesn't take ownership of |clipboard_stub|, which must outlive
36 // the dispatcher. 40 // the dispatcher.
37 void set_clipboard_stub(ClipboardStub* clipboard_stub) { 41 void set_clipboard_stub(ClipboardStub* clipboard_stub) {
38 clipboard_stub_ = clipboard_stub; 42 clipboard_stub_ = clipboard_stub;
39 } 43 }
40 44
41 // Sets HostStub that will be called for each incoming control 45 // Sets the HostStub that will be called for each incoming control
42 // message. Doesn't take ownership of |host_stub|. It must outlive 46 // message. Doesn't take ownership of |host_stub|, which must outlive
Wez 2012/03/30 22:20:15 nit: Could reword this as suggested for ClientCont
simonmorris 2012/03/30 22:36:07 Done.
43 // this dispatcher. 47 // this dispatcher.
44 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } 48 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; }
45 49
46 protected: 50 protected:
47 // ChannelDispatcherBase overrides. 51 // ChannelDispatcherBase overrides.
48 virtual void OnInitialized() OVERRIDE; 52 virtual void OnInitialized() OVERRIDE;
49 53
50 private: 54 private:
51 void OnMessageReceived(scoped_ptr<ControlMessage> message, 55 void OnMessageReceived(scoped_ptr<ControlMessage> message,
52 const base::Closure& done_task); 56 const base::Closure& done_task);
53 57
54 ClipboardStub* clipboard_stub_; 58 ClipboardStub* clipboard_stub_;
55 HostStub* host_stub_; 59 HostStub* host_stub_;
56 60
57 ProtobufMessageReader<ControlMessage> reader_; 61 ProtobufMessageReader<ControlMessage> reader_;
58 scoped_refptr<BufferedSocketWriter> writer_; 62 scoped_refptr<BufferedSocketWriter> writer_;
59 63
60 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); 64 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher);
61 }; 65 };
62 66
63 } // namespace protocol 67 } // namespace protocol
64 } // namespace remoting 68 } // namespace remoting
65 69
66 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ 70 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698