| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_WEBRTC_CONNECTION_TO_CLIENT_H_ | 5 #ifndef REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_ |
| 6 #define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "remoting/protocol/channel_dispatcher_base.h" | 15 #include "remoting/protocol/channel_dispatcher_base.h" |
| 16 #include "remoting/protocol/connection_to_client.h" | 16 #include "remoting/protocol/connection_to_client.h" |
| 17 #include "remoting/protocol/session.h" | 17 #include "remoting/protocol/session.h" |
| 18 #include "remoting/protocol/webrtc_transport.h" |
| 18 | 19 |
| 19 namespace remoting { | 20 namespace remoting { |
| 20 namespace protocol { | 21 namespace protocol { |
| 21 | 22 |
| 22 class HostControlDispatcher; | 23 class HostControlDispatcher; |
| 23 class HostEventDispatcher; | 24 class HostEventDispatcher; |
| 24 | 25 |
| 25 class WebrtcConnectionToClient : public ConnectionToClient, | 26 class WebrtcConnectionToClient : public ConnectionToClient, |
| 26 public Session::EventHandler, | 27 public Session::EventHandler, |
| 28 public WebrtcTransport::EventHandler, |
| 27 public ChannelDispatcherBase::EventHandler { | 29 public ChannelDispatcherBase::EventHandler { |
| 28 public: | 30 public: |
| 29 explicit WebrtcConnectionToClient(scoped_ptr<Session> session); | 31 WebrtcConnectionToClient( |
| 32 scoped_ptr<Session> session, |
| 33 scoped_refptr<protocol::TransportContext> transport_context); |
| 30 ~WebrtcConnectionToClient() override; | 34 ~WebrtcConnectionToClient() override; |
| 31 | 35 |
| 32 // ConnectionToClient interface. | 36 // ConnectionToClient interface. |
| 33 void SetEventHandler( | 37 void SetEventHandler( |
| 34 ConnectionToClient::EventHandler* event_handler) override; | 38 ConnectionToClient::EventHandler* event_handler) override; |
| 35 Session* session() override; | 39 Session* session() override; |
| 36 void Disconnect(ErrorCode error) override; | 40 void Disconnect(ErrorCode error) override; |
| 37 void OnInputEventReceived(int64_t timestamp) override; | 41 void OnInputEventReceived(int64_t timestamp) override; |
| 38 scoped_ptr<VideoStream> StartVideoStream( | 42 scoped_ptr<VideoStream> StartVideoStream( |
| 39 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override; | 43 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override; |
| 40 AudioStub* audio_stub() override; | 44 AudioStub* audio_stub() override; |
| 41 ClientStub* client_stub() override; | 45 ClientStub* client_stub() override; |
| 42 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; | 46 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; |
| 43 void set_host_stub(HostStub* host_stub) override; | 47 void set_host_stub(HostStub* host_stub) override; |
| 44 void set_input_stub(InputStub* input_stub) override; | 48 void set_input_stub(InputStub* input_stub) override; |
| 45 | 49 |
| 46 // Session::EventHandler interface. | 50 // Session::EventHandler interface. |
| 47 void OnSessionStateChange(Session::State state) override; | 51 void OnSessionStateChange(Session::State state) override; |
| 48 void OnSessionRouteChange(const std::string& channel_name, | 52 |
| 49 const TransportRoute& route) override; | 53 // WebrtcTransport::EventHandler interface |
| 54 void OnWebrtcTransportConnected() override; |
| 55 void OnWebrtcTransportError(ErrorCode error) override; |
| 50 | 56 |
| 51 // ChannelDispatcherBase::EventHandler interface. | 57 // ChannelDispatcherBase::EventHandler interface. |
| 52 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; | 58 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; |
| 53 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, | 59 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, |
| 54 ErrorCode error) override; | 60 ErrorCode error) override; |
| 55 | 61 |
| 56 private: | 62 private: |
| 57 base::ThreadChecker thread_checker_; | 63 base::ThreadChecker thread_checker_; |
| 58 | 64 |
| 59 // Event handler for handling events sent from this object. | 65 // Event handler for handling events sent from this object. |
| 60 ConnectionToClient::EventHandler* event_handler_ = nullptr; | 66 ConnectionToClient::EventHandler* event_handler_ = nullptr; |
| 61 | 67 |
| 68 WebrtcTransport transport_; |
| 69 |
| 62 scoped_ptr<Session> session_; | 70 scoped_ptr<Session> session_; |
| 63 | 71 |
| 64 scoped_ptr<HostControlDispatcher> control_dispatcher_; | 72 scoped_ptr<HostControlDispatcher> control_dispatcher_; |
| 65 scoped_ptr<HostEventDispatcher> event_dispatcher_; | 73 scoped_ptr<HostEventDispatcher> event_dispatcher_; |
| 66 | 74 |
| 67 DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToClient); | 75 DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToClient); |
| 68 }; | 76 }; |
| 69 | 77 |
| 70 } // namespace protocol | 78 } // namespace protocol |
| 71 } // namespace remoting | 79 } // namespace remoting |
| 72 | 80 |
| 73 #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_ | 81 #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_ |
| OLD | NEW |