OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ |
| 6 #define REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/threading/thread_checker.h" |
| 13 #include "remoting/protocol/channel_dispatcher_base.h" |
| 14 #include "remoting/protocol/connection_to_client.h" |
| 15 #include "remoting/protocol/session.h" |
| 16 |
| 17 namespace remoting { |
| 18 namespace protocol { |
| 19 |
| 20 class AudioWriter; |
| 21 class HostControlDispatcher; |
| 22 class HostEventDispatcher; |
| 23 class HostVideoDispatcher; |
| 24 class VideoFeedbackStub; |
| 25 |
| 26 // This class represents a remote viewer connection to the chromoting |
| 27 // host. It sets up all protocol channels and connects them to the |
| 28 // stubs. |
| 29 class IceConnectionToClient : public ConnectionToClient, |
| 30 public Session::EventHandler, |
| 31 public ChannelDispatcherBase::EventHandler { |
| 32 public: |
| 33 explicit IceConnectionToClient(scoped_ptr<Session> session); |
| 34 ~IceConnectionToClient() override; |
| 35 |
| 36 // ConnectionToClient interface. |
| 37 void SetEventHandler( |
| 38 ConnectionToClient::EventHandler* event_handler) override; |
| 39 Session* session() override; |
| 40 void Disconnect(ErrorCode error) override; |
| 41 void OnInputEventReceived(int64_t timestamp) override; |
| 42 VideoStub* video_stub() override; |
| 43 AudioStub* audio_stub() override; |
| 44 ClientStub* client_stub() override; |
| 45 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; |
| 46 void set_host_stub(HostStub* host_stub) override; |
| 47 void set_input_stub(InputStub* input_stub) override; |
| 48 void set_video_feedback_stub(VideoFeedbackStub* video_feedback_stub) override; |
| 49 |
| 50 // Session::EventHandler interface. |
| 51 void OnSessionStateChange(Session::State state) override; |
| 52 void OnSessionRouteChange(const std::string& channel_name, |
| 53 const TransportRoute& route) override; |
| 54 |
| 55 // ChannelDispatcherBase::EventHandler interface. |
| 56 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; |
| 57 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, |
| 58 ErrorCode error) override; |
| 59 |
| 60 private: |
| 61 void NotifyIfChannelsReady(); |
| 62 |
| 63 void Close(ErrorCode error); |
| 64 |
| 65 // Stops writing in the channels. |
| 66 void CloseChannels(); |
| 67 |
| 68 base::ThreadChecker thread_checker_; |
| 69 |
| 70 // Event handler for handling events sent from this object. |
| 71 ConnectionToClient::EventHandler* handler_; |
| 72 |
| 73 // The libjingle channel used to send and receive data from the remote client. |
| 74 scoped_ptr<Session> session_; |
| 75 |
| 76 scoped_ptr<HostControlDispatcher> control_dispatcher_; |
| 77 scoped_ptr<HostEventDispatcher> event_dispatcher_; |
| 78 scoped_ptr<HostVideoDispatcher> video_dispatcher_; |
| 79 scoped_ptr<AudioWriter> audio_writer_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(IceConnectionToClient); |
| 82 }; |
| 83 |
| 84 } // namespace protocol |
| 85 } // namespace remoting |
| 86 |
| 87 #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |