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/macros.h" | 8 #include "base/macros.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/protobuf_message_parser.h" | |
14 | 13 |
15 namespace net { | 14 namespace net { |
16 class StreamSocket; | 15 class StreamSocket; |
17 } // namespace net | 16 } // namespace net |
18 | 17 |
19 namespace remoting { | 18 namespace remoting { |
20 namespace protocol { | 19 namespace protocol { |
21 | 20 |
22 class ControlMessage; | |
23 class HostStub; | 21 class HostStub; |
24 class PairingResponse; | 22 class PairingResponse; |
25 class Session; | 23 class Session; |
26 | 24 |
27 // HostControlDispatcher dispatches incoming messages on the control | 25 // HostControlDispatcher dispatches incoming messages on the control |
28 // channel to HostStub or ClipboardStub, and also implements ClientStub and | 26 // channel to HostStub or ClipboardStub, and also implements ClientStub and |
29 // CursorShapeStub for outgoing messages. | 27 // CursorShapeStub for outgoing messages. |
30 class HostControlDispatcher : public ChannelDispatcherBase, | 28 class HostControlDispatcher : public ChannelDispatcherBase, |
31 public ClientStub { | 29 public ClientStub { |
32 public: | 30 public: |
(...skipping 15 matching lines...) Expand all Loading... |
48 // message. |clipboard_stub| must outlive this object. | 46 // message. |clipboard_stub| must outlive this object. |
49 void set_clipboard_stub(ClipboardStub* clipboard_stub) { | 47 void set_clipboard_stub(ClipboardStub* clipboard_stub) { |
50 clipboard_stub_ = clipboard_stub; | 48 clipboard_stub_ = clipboard_stub; |
51 } | 49 } |
52 | 50 |
53 // Sets the HostStub that will be called for each incoming control | 51 // Sets the HostStub that will be called for each incoming control |
54 // message. |host_stub| must outlive this object. | 52 // message. |host_stub| must outlive this object. |
55 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } | 53 void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } |
56 | 54 |
57 private: | 55 private: |
58 void OnMessageReceived(scoped_ptr<ControlMessage> message); | 56 void OnIncomingMessage(scoped_ptr<CompoundBuffer> buffer) override; |
59 | 57 |
60 ClipboardStub* clipboard_stub_; | 58 ClipboardStub* clipboard_stub_ = nullptr; |
61 HostStub* host_stub_; | 59 HostStub* host_stub_ = nullptr; |
62 | |
63 ProtobufMessageParser<ControlMessage> parser_; | |
64 | 60 |
65 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); | 61 DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher); |
66 }; | 62 }; |
67 | 63 |
68 } // namespace protocol | 64 } // namespace protocol |
69 } // namespace remoting | 65 } // namespace remoting |
70 | 66 |
71 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ | 67 #endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ |
OLD | NEW |