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_ICE_CONNECTION_TO_CLIENT_H_ | 5 #ifndef REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ |
6 #define REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_ICE_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/ice_transport.h" | 17 #include "remoting/protocol/ice_transport.h" |
18 #include "remoting/protocol/session.h" | 18 #include "remoting/protocol/session.h" |
19 | 19 |
20 namespace remoting { | 20 namespace remoting { |
21 namespace protocol { | 21 namespace protocol { |
22 | 22 |
23 class AudioWriter; | 23 class AudioWriter; |
24 class HostControlDispatcher; | 24 class HostControlDispatcher; |
25 class HostEventDispatcher; | 25 class HostEventDispatcher; |
26 class HostVideoDispatcher; | 26 class HostVideoDispatcher; |
27 class VideoFeedbackStub; | 27 class VideoFeedbackStub; |
28 class VideoFramePump; | 28 class VideoFramePump; |
29 | 29 |
30 // This class represents a remote viewer connection to the chromoting | 30 // This class represents a remote viewer connection to the chromoting |
31 // host. It sets up all protocol channels and connects them to the | 31 // host. It sets up all protocol channels and connects them to the |
32 // stubs. | 32 // stubs. |
33 class IceConnectionToClient : public ConnectionToClient, | 33 class IceConnectionToClient : public ConnectionToClient, |
34 public Session::EventHandler, | 34 public Session::EventHandler, |
35 public IceTransport::EventHandler, | 35 public IceTransport::EventHandler, |
36 public ChannelDispatcherBase::EventHandler { | 36 public ChannelDispatcherBase::EventHandler { |
37 public: | 37 public: |
38 IceConnectionToClient( | 38 IceConnectionToClient( |
39 scoped_ptr<Session> session, | 39 std::unique_ptr<Session> session, |
40 scoped_refptr<TransportContext> transport_context, | 40 scoped_refptr<TransportContext> transport_context, |
41 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner); | 41 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner); |
42 ~IceConnectionToClient() override; | 42 ~IceConnectionToClient() override; |
43 | 43 |
44 // ConnectionToClient interface. | 44 // ConnectionToClient interface. |
45 void SetEventHandler( | 45 void SetEventHandler( |
46 ConnectionToClient::EventHandler* event_handler) override; | 46 ConnectionToClient::EventHandler* event_handler) override; |
47 Session* session() override; | 47 Session* session() override; |
48 void Disconnect(ErrorCode error) override; | 48 void Disconnect(ErrorCode error) override; |
49 void OnInputEventReceived(int64_t timestamp) override; | 49 void OnInputEventReceived(int64_t timestamp) override; |
50 scoped_ptr<VideoStream> StartVideoStream( | 50 std::unique_ptr<VideoStream> StartVideoStream( |
51 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override; | 51 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) override; |
52 AudioStub* audio_stub() override; | 52 AudioStub* audio_stub() override; |
53 ClientStub* client_stub() override; | 53 ClientStub* client_stub() override; |
54 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; | 54 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; |
55 void set_host_stub(HostStub* host_stub) override; | 55 void set_host_stub(HostStub* host_stub) override; |
56 void set_input_stub(InputStub* input_stub) override; | 56 void set_input_stub(InputStub* input_stub) override; |
57 | 57 |
58 // Session::EventHandler interface. | 58 // Session::EventHandler interface. |
59 void OnSessionStateChange(Session::State state) override; | 59 void OnSessionStateChange(Session::State state) override; |
60 | 60 |
61 // IceTransport::EventHandler interface. | 61 // IceTransport::EventHandler interface. |
62 void OnIceTransportRouteChange(const std::string& channel_name, | 62 void OnIceTransportRouteChange(const std::string& channel_name, |
63 const TransportRoute& route) override; | 63 const TransportRoute& route) override; |
64 void OnIceTransportError(ErrorCode error) override; | 64 void OnIceTransportError(ErrorCode error) override; |
65 | 65 |
66 // ChannelDispatcherBase::EventHandler interface. | 66 // ChannelDispatcherBase::EventHandler interface. |
67 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; | 67 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; |
68 | 68 |
69 private: | 69 private: |
70 void NotifyIfChannelsReady(); | 70 void NotifyIfChannelsReady(); |
71 | 71 |
72 void CloseChannels(); | 72 void CloseChannels(); |
73 | 73 |
74 base::ThreadChecker thread_checker_; | 74 base::ThreadChecker thread_checker_; |
75 | 75 |
76 // Event handler for handling events sent from this object. | 76 // Event handler for handling events sent from this object. |
77 ConnectionToClient::EventHandler* event_handler_; | 77 ConnectionToClient::EventHandler* event_handler_; |
78 | 78 |
79 scoped_ptr<Session> session_; | 79 std::unique_ptr<Session> session_; |
80 | 80 |
81 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; | 81 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; |
82 | 82 |
83 IceTransport transport_; | 83 IceTransport transport_; |
84 | 84 |
85 scoped_ptr<HostControlDispatcher> control_dispatcher_; | 85 std::unique_ptr<HostControlDispatcher> control_dispatcher_; |
86 scoped_ptr<HostEventDispatcher> event_dispatcher_; | 86 std::unique_ptr<HostEventDispatcher> event_dispatcher_; |
87 scoped_ptr<HostVideoDispatcher> video_dispatcher_; | 87 std::unique_ptr<HostVideoDispatcher> video_dispatcher_; |
88 scoped_ptr<AudioWriter> audio_writer_; | 88 std::unique_ptr<AudioWriter> audio_writer_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(IceConnectionToClient); | 90 DISALLOW_COPY_AND_ASSIGN(IceConnectionToClient); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace protocol | 93 } // namespace protocol |
94 } // namespace remoting | 94 } // namespace remoting |
95 | 95 |
96 #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ | 96 #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |