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_CLIENT_CONTROL_DISPATCHER_H_ | 5 #ifndef REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_ |
6 #define REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_ | 6 #define REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class Session; | 21 class Session; |
22 | 22 |
23 // ClientControlDispatcher dispatches incoming messages on the control | 23 // ClientControlDispatcher dispatches incoming messages on the control |
24 // channel to ClientStub, ClipboardStub or CursorShapeStub. | 24 // channel to ClientStub, ClipboardStub or CursorShapeStub. |
25 // It also implements ClipboardStub and HostStub for outgoing messages. | 25 // It also implements ClipboardStub and HostStub for outgoing messages. |
26 class ClientControlDispatcher : public ChannelDispatcherBase, | 26 class ClientControlDispatcher : public ChannelDispatcherBase, |
27 public ClipboardStub, | 27 public ClipboardStub, |
28 public HostStub { | 28 public HostStub { |
29 public: | 29 public: |
30 ClientControlDispatcher(); | 30 ClientControlDispatcher(); |
31 virtual ~ClientControlDispatcher(); | 31 ~ClientControlDispatcher() override; |
32 | 32 |
33 // ClipboardStub implementation. | 33 // ClipboardStub implementation. |
34 virtual void InjectClipboardEvent(const ClipboardEvent& event) override; | 34 void InjectClipboardEvent(const ClipboardEvent& event) override; |
35 | 35 |
36 // HostStub implementation. | 36 // HostStub implementation. |
37 virtual void NotifyClientResolution( | 37 void NotifyClientResolution(const ClientResolution& resolution) override; |
38 const ClientResolution& resolution) override; | 38 void ControlVideo(const VideoControl& video_control) override; |
39 virtual void ControlVideo(const VideoControl& video_control) override; | 39 void ControlAudio(const AudioControl& audio_control) override; |
40 virtual void ControlAudio(const AudioControl& audio_control) override; | 40 void SetCapabilities(const Capabilities& capabilities) override; |
41 virtual void SetCapabilities(const Capabilities& capabilities) override; | 41 void RequestPairing(const PairingRequest& pairing_request) override; |
42 virtual void RequestPairing(const PairingRequest& pairing_request) override; | 42 void DeliverClientMessage(const ExtensionMessage& message) override; |
43 virtual void DeliverClientMessage(const ExtensionMessage& message) override; | |
44 | 43 |
45 // Sets the ClientStub that will be called for each incoming control | 44 // Sets the ClientStub that will be called for each incoming control |
46 // message. |client_stub| must outlive this object. | 45 // message. |client_stub| must outlive this object. |
47 void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; } | 46 void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; } |
48 | 47 |
49 // Sets the ClipboardStub that will be called for each incoming clipboard | 48 // Sets the ClipboardStub that will be called for each incoming clipboard |
50 // message. |clipboard_stub| must outlive this object. | 49 // message. |clipboard_stub| must outlive this object. |
51 void set_clipboard_stub(ClipboardStub* clipboard_stub) { | 50 void set_clipboard_stub(ClipboardStub* clipboard_stub) { |
52 clipboard_stub_ = clipboard_stub; | 51 clipboard_stub_ = clipboard_stub; |
53 } | 52 } |
54 | 53 |
55 protected: | 54 protected: |
56 // ChannelDispatcherBase overrides. | 55 // ChannelDispatcherBase overrides. |
57 virtual void OnInitialized() override; | 56 void OnInitialized() override; |
58 | 57 |
59 private: | 58 private: |
60 void OnMessageReceived(scoped_ptr<ControlMessage> message, | 59 void OnMessageReceived(scoped_ptr<ControlMessage> message, |
61 const base::Closure& done_task); | 60 const base::Closure& done_task); |
62 | 61 |
63 ClientStub* client_stub_; | 62 ClientStub* client_stub_; |
64 ClipboardStub* clipboard_stub_; | 63 ClipboardStub* clipboard_stub_; |
65 | 64 |
66 ProtobufMessageReader<ControlMessage> reader_; | 65 ProtobufMessageReader<ControlMessage> reader_; |
67 BufferedSocketWriter writer_; | 66 BufferedSocketWriter writer_; |
68 | 67 |
69 DISALLOW_COPY_AND_ASSIGN(ClientControlDispatcher); | 68 DISALLOW_COPY_AND_ASSIGN(ClientControlDispatcher); |
70 }; | 69 }; |
71 | 70 |
72 } // namespace protocol | 71 } // namespace protocol |
73 } // namespace remoting | 72 } // namespace remoting |
74 | 73 |
75 #endif // REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_ | 74 #endif // REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_ |
OLD | NEW |