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