| 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/weak_ptr.h" |
| 9 #include "remoting/protocol/buffered_socket_writer.h" | 9 #include "remoting/protocol/buffered_socket_writer.h" |
| 10 #include "remoting/protocol/channel_dispatcher_base.h" | 10 #include "remoting/protocol/channel_dispatcher_base.h" |
| 11 #include "remoting/protocol/client_stub.h" | 11 #include "remoting/protocol/client_stub.h" |
| 12 #include "remoting/protocol/clipboard_stub.h" | 12 #include "remoting/protocol/clipboard_stub.h" |
| 13 #include "remoting/protocol/cursor_shape_stub.h" | 13 #include "remoting/protocol/cursor_shape_stub.h" |
| 14 #include "remoting/protocol/message_reader.h" | 14 #include "remoting/protocol/message_reader.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 class StreamSocket; | 17 class StreamSocket; |
| 18 } // namespace net | 18 } // namespace net |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 namespace protocol { | 21 namespace protocol { |
| 22 | 22 |
| 23 class ControlMessage; | 23 class ControlMessage; |
| 24 class HostStub; | 24 class HostStub; |
| 25 class PairingReply; |
| 25 class Session; | 26 class Session; |
| 26 | 27 |
| 27 // HostControlDispatcher dispatches incoming messages on the control | 28 // HostControlDispatcher dispatches incoming messages on the control |
| 28 // channel to HostStub or ClipboardStub, and also implements ClientStub and | 29 // channel to HostStub or ClipboardStub, and also implements ClientStub and |
| 29 // CursorShapeStub for outgoing messages. | 30 // CursorShapeStub for outgoing messages. |
| 30 class HostControlDispatcher : public ChannelDispatcherBase, | 31 class HostControlDispatcher : public ChannelDispatcherBase, |
| 31 public ClientStub { | 32 public ClientStub { |
| 32 public: | 33 public: |
| 33 HostControlDispatcher(); | 34 HostControlDispatcher(); |
| 34 virtual ~HostControlDispatcher(); | 35 virtual ~HostControlDispatcher(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 52 // message. |host_stub| must outlive this object. | 53 // message. |host_stub| must outlive this object. |
| 53 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } | 54 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } |
| 54 | 55 |
| 55 protected: | 56 protected: |
| 56 // ChannelDispatcherBase overrides. | 57 // ChannelDispatcherBase overrides. |
| 57 virtual void OnInitialized() OVERRIDE; | 58 virtual void OnInitialized() OVERRIDE; |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 void OnMessageReceived(scoped_ptr<ControlMessage> message, | 61 void OnMessageReceived(scoped_ptr<ControlMessage> message, |
| 61 const base::Closure& done_task); | 62 const base::Closure& done_task); |
| 63 void OnPairingReply(const PairingReply& pairing_reply); |
| 62 | 64 |
| 63 ClipboardStub* clipboard_stub_; | 65 ClipboardStub* clipboard_stub_; |
| 64 HostStub* host_stub_; | 66 HostStub* host_stub_; |
| 65 | 67 |
| 66 ProtobufMessageReader<ControlMessage> reader_; | 68 ProtobufMessageReader<ControlMessage> reader_; |
| 67 BufferedSocketWriter writer_; | 69 BufferedSocketWriter writer_; |
| 68 | 70 |
| 71 base::WeakPtrFactory<HostControlDispatcher> weak_factory_; |
| 72 |
| 69 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); | 73 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 } // namespace protocol | 76 } // namespace protocol |
| 73 } // namespace remoting | 77 } // namespace remoting |
| 74 | 78 |
| 75 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ | 79 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ |
| OLD | NEW |