Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/message_reader.h" | 11 #include "remoting/protocol/message_reader.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 class StreamSocket; | 14 class StreamSocket; |
| 15 } // namespace net | 15 } // namespace net |
| 16 | 16 |
| 17 namespace remoting { | 17 namespace remoting { |
| 18 namespace protocol { | 18 namespace protocol { |
| 19 | 19 |
| 20 class BufferedSocketWriter; | 20 class BufferedSocketWriter; |
| 21 class ClipboardStub; | |
| 21 class ControlMessage; | 22 class ControlMessage; |
| 22 class HostStub; | 23 class HostStub; |
| 23 class Session; | 24 class Session; |
| 24 | 25 |
| 25 // HostControlDispatcher dispatches incoming messages on the control | 26 // HostControlDispatcher dispatches incoming messages on the control |
| 26 // channel to HostStub, and also implements ClientStub for outgoing | 27 // channel to HostStub or ClipboardStub, and also implements ClientStub for |
| 27 // messages. | 28 // outgoing messages. |
| 28 class HostControlDispatcher : public ChannelDispatcherBase, public ClientStub { | 29 class HostControlDispatcher : public ChannelDispatcherBase, public ClientStub { |
| 29 public: | 30 public: |
| 30 HostControlDispatcher(); | 31 HostControlDispatcher(); |
| 31 virtual ~HostControlDispatcher(); | 32 virtual ~HostControlDispatcher(); |
| 32 | 33 |
| 34 // Set the ClipboardStub that will be called for each incoming clipboard | |
| 35 // message. Doesn't take ownership of |clipboard_stub|. It must outlive | |
|
Wez
2012/03/14 20:40:56
nit: ". It must" -> ", which must"
simonmorris
2012/03/14 21:20:21
Done.
| |
| 36 // the dispatcher. | |
| 37 void set_clipboard_stub(ClipboardStub* clipboard_stub) { | |
| 38 clipboard_stub_ = clipboard_stub; | |
| 39 } | |
| 40 | |
| 33 // Sets HostStub that will be called for each incoming control | 41 // Sets HostStub that will be called for each incoming control |
| 34 // message. Doesn't take ownership of |host_stub|. It must outlive | 42 // message. Doesn't take ownership of |host_stub|. It must outlive |
| 35 // this dispatcher. | 43 // this dispatcher. |
| 36 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } | 44 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } |
| 37 | 45 |
| 38 protected: | 46 protected: |
| 39 // ChannelDispatcherBase overrides. | 47 // ChannelDispatcherBase overrides. |
| 40 virtual void OnInitialized() OVERRIDE; | 48 virtual void OnInitialized() OVERRIDE; |
| 41 | 49 |
| 42 private: | 50 private: |
| 43 void OnMessageReceived(ControlMessage* message, | 51 void OnMessageReceived(ControlMessage* message, |
| 44 const base::Closure& done_task); | 52 const base::Closure& done_task); |
| 45 | 53 |
| 54 ClipboardStub* clipboard_stub_; | |
| 46 HostStub* host_stub_; | 55 HostStub* host_stub_; |
| 47 | 56 |
| 48 ProtobufMessageReader<ControlMessage> reader_; | 57 ProtobufMessageReader<ControlMessage> reader_; |
| 49 scoped_refptr<BufferedSocketWriter> writer_; | 58 scoped_refptr<BufferedSocketWriter> writer_; |
| 50 | 59 |
| 51 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); | 60 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); |
| 52 }; | 61 }; |
| 53 | 62 |
| 54 } // namespace protocol | 63 } // namespace protocol |
| 55 } // namespace remoting | 64 } // namespace remoting |
| 56 | 65 |
| 57 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ | 66 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ |
| OLD | NEW |