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 "remoting/protocol/buffered_socket_writer.h" | 8 #include "remoting/protocol/buffered_socket_writer.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/clipboard_stub.h" |
12 #include "remoting/protocol/cursor_shape_stub.h" | 12 #include "remoting/protocol/cursor_shape_stub.h" |
13 #include "remoting/protocol/message_reader.h" | 13 #include "remoting/protocol/protobuf_message_parser.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 class StreamSocket; | 16 class StreamSocket; |
17 } // namespace net | 17 } // namespace net |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 namespace protocol { | 20 namespace protocol { |
21 | 21 |
22 class ControlMessage; | 22 class ControlMessage; |
23 class HostStub; | 23 class HostStub; |
(...skipping 23 matching lines...) Expand all Loading... |
47 // Sets the ClipboardStub that will be called for each incoming clipboard | 47 // Sets the ClipboardStub that will be called for each incoming clipboard |
48 // message. |clipboard_stub| must outlive this object. | 48 // message. |clipboard_stub| must outlive this object. |
49 void set_clipboard_stub(ClipboardStub* clipboard_stub) { | 49 void set_clipboard_stub(ClipboardStub* clipboard_stub) { |
50 clipboard_stub_ = clipboard_stub; | 50 clipboard_stub_ = clipboard_stub; |
51 } | 51 } |
52 | 52 |
53 // Sets the HostStub that will be called for each incoming control | 53 // Sets the HostStub that will be called for each incoming control |
54 // message. |host_stub| must outlive this object. | 54 // message. |host_stub| must outlive this object. |
55 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } | 55 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } |
56 | 56 |
57 protected: | |
58 // ChannelDispatcherBase overrides. | |
59 void OnInitialized() override; | |
60 | |
61 private: | 57 private: |
62 void OnMessageReceived(scoped_ptr<ControlMessage> message, | 58 void OnMessageReceived(scoped_ptr<ControlMessage> message, |
63 const base::Closure& done_task); | 59 const base::Closure& done_task); |
64 | 60 |
65 ClipboardStub* clipboard_stub_; | 61 ClipboardStub* clipboard_stub_; |
66 HostStub* host_stub_; | 62 HostStub* host_stub_; |
67 | 63 |
68 ProtobufMessageReader<ControlMessage> reader_; | 64 ProtobufMessageParser<ControlMessage> parser_; |
69 BufferedSocketWriter writer_; | |
70 | 65 |
71 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); | 66 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); |
72 }; | 67 }; |
73 | 68 |
74 } // namespace protocol | 69 } // namespace protocol |
75 } // namespace remoting | 70 } // namespace remoting |
76 | 71 |
77 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ | 72 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ |
OLD | NEW |