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