| 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/channel_dispatcher_base.h" | 9 #include "remoting/protocol/channel_dispatcher_base.h" |
| 10 #include "remoting/protocol/clipboard_stub.h" |
| 10 #include "remoting/protocol/host_stub.h" | 11 #include "remoting/protocol/host_stub.h" |
| 11 #include "remoting/protocol/message_reader.h" | 12 #include "remoting/protocol/message_reader.h" |
| 12 | 13 |
| 13 namespace remoting { | 14 namespace remoting { |
| 14 namespace protocol { | 15 namespace protocol { |
| 15 | 16 |
| 16 class ClientStub; | 17 class ClientStub; |
| 17 class ControlMessage; | 18 class ControlMessage; |
| 18 class BufferedSocketWriter; | 19 class BufferedSocketWriter; |
| 19 class Session; | 20 class Session; |
| 20 | 21 |
| 21 // ClientControlDispatcher dispatches incoming messages on the control | 22 // ClientControlDispatcher dispatches incoming messages on the control |
| 22 // channel to ClientStub, and also implements HostStub for outgoing | 23 // channel to ClientStub, and also implements ClipboardStub and HostStub for |
| 23 // messages. | 24 // outgoing messages. |
| 24 class ClientControlDispatcher : public ChannelDispatcherBase, public HostStub { | 25 class ClientControlDispatcher : public ChannelDispatcherBase, |
| 26 public ClipboardStub, |
| 27 public HostStub { |
| 25 public: | 28 public: |
| 26 ClientControlDispatcher(); | 29 ClientControlDispatcher(); |
| 27 virtual ~ClientControlDispatcher(); | 30 virtual ~ClientControlDispatcher(); |
| 28 | 31 |
| 32 // ClipboardStub implementation. |
| 33 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
| 34 |
| 29 // Sets ClientStub that will be called for each incoming control | 35 // Sets ClientStub that will be called for each incoming control |
| 30 // message. Doesn't take ownership of |client_stub|. It must outlive | 36 // message. Doesn't take ownership of |client_stub|. It must outlive |
| 31 // this dispatcher. | 37 // this dispatcher. |
| 32 void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; } | 38 void set_client_stub(ClientStub* client_stub) { client_stub_ = client_stub; } |
| 33 | 39 |
| 34 protected: | 40 protected: |
| 35 // ChannelDispatcherBase overrides. | 41 // ChannelDispatcherBase overrides. |
| 36 virtual void OnInitialized() OVERRIDE; | 42 virtual void OnInitialized() OVERRIDE; |
| 37 | 43 |
| 38 private: | 44 private: |
| 39 void OnMessageReceived(ControlMessage* message, | 45 void OnMessageReceived(ControlMessage* message, |
| 40 const base::Closure& done_task); | 46 const base::Closure& done_task); |
| 41 | 47 |
| 42 ClientStub* client_stub_; | 48 ClientStub* client_stub_; |
| 43 | 49 |
| 44 ProtobufMessageReader<ControlMessage> reader_; | 50 ProtobufMessageReader<ControlMessage> reader_; |
| 45 scoped_refptr<BufferedSocketWriter> writer_; | 51 scoped_refptr<BufferedSocketWriter> writer_; |
| 46 | 52 |
| 47 DISALLOW_COPY_AND_ASSIGN(ClientControlDispatcher); | 53 DISALLOW_COPY_AND_ASSIGN(ClientControlDispatcher); |
| 48 }; | 54 }; |
| 49 | 55 |
| 50 } // namespace protocol | 56 } // namespace protocol |
| 51 } // namespace remoting | 57 } // namespace remoting |
| 52 | 58 |
| 53 #endif // REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_ | 59 #endif // REMOTING_PROTOCOL_CLIENT_CONTROL_DISPATCHER_H_ |
| OLD | NEW |