OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // ChromotingClient is the controller for the Client implementation. | 5 // ChromotingClient is the controller for the Client implementation. |
6 | 6 |
7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
9 | 9 |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "remoting/protocol/client_authentication_config.h" | 15 #include "remoting/protocol/client_authentication_config.h" |
16 #include "remoting/protocol/client_stub.h" | 16 #include "remoting/protocol/client_stub.h" |
17 #include "remoting/protocol/clipboard_stub.h" | 17 #include "remoting/protocol/clipboard_stub.h" |
18 #include "remoting/protocol/connection_to_host.h" | 18 #include "remoting/protocol/connection_to_host.h" |
19 #include "remoting/protocol/input_stub.h" | 19 #include "remoting/protocol/input_stub.h" |
20 #include "remoting/protocol/performance_tracker.h" | 20 #include "remoting/protocol/performance_tracker.h" |
21 #include "remoting/protocol/session_config.h" | 21 #include "remoting/protocol/session_config.h" |
22 #include "remoting/protocol/video_stub.h" | 22 #include "remoting/protocol/video_stub.h" |
23 #include "remoting/signaling/signal_strategy.h" | 23 #include "remoting/signaling/signal_strategy.h" |
24 | 24 |
(...skipping 19 matching lines...) Expand all Loading... |
44 class ChromotingClient : public SignalStrategy::Listener, | 44 class ChromotingClient : public SignalStrategy::Listener, |
45 public protocol::ConnectionToHost::HostEventCallback, | 45 public protocol::ConnectionToHost::HostEventCallback, |
46 public protocol::ClientStub { | 46 public protocol::ClientStub { |
47 public: | 47 public: |
48 // |client_context|, |user_interface| and |video_renderer| must outlive the | 48 // |client_context|, |user_interface| and |video_renderer| must outlive the |
49 // client. |audio_player| may be null, in which case audio will not be | 49 // client. |audio_player| may be null, in which case audio will not be |
50 // requested. | 50 // requested. |
51 ChromotingClient(ClientContext* client_context, | 51 ChromotingClient(ClientContext* client_context, |
52 ClientUserInterface* user_interface, | 52 ClientUserInterface* user_interface, |
53 protocol::VideoRenderer* video_renderer, | 53 protocol::VideoRenderer* video_renderer, |
54 scoped_ptr<AudioPlayer> audio_player); | 54 std::unique_ptr<AudioPlayer> audio_player); |
55 | 55 |
56 ~ChromotingClient() override; | 56 ~ChromotingClient() override; |
57 | 57 |
58 void set_protocol_config(scoped_ptr<protocol::CandidateSessionConfig> config); | 58 void set_protocol_config( |
| 59 std::unique_ptr<protocol::CandidateSessionConfig> config); |
59 | 60 |
60 // Used to set fake/mock objects for tests which use the ChromotingClient. | 61 // Used to set fake/mock objects for tests which use the ChromotingClient. |
61 void SetConnectionToHostForTests( | 62 void SetConnectionToHostForTests( |
62 scoped_ptr<protocol::ConnectionToHost> connection_to_host); | 63 std::unique_ptr<protocol::ConnectionToHost> connection_to_host); |
63 | 64 |
64 // Start the client. Must be called on the main thread. |signal_strategy| | 65 // Start the client. Must be called on the main thread. |signal_strategy| |
65 // must outlive the client. | 66 // must outlive the client. |
66 void Start(SignalStrategy* signal_strategy, | 67 void Start(SignalStrategy* signal_strategy, |
67 const protocol::ClientAuthenticationConfig& client_auth_config, | 68 const protocol::ClientAuthenticationConfig& client_auth_config, |
68 scoped_refptr<protocol::TransportContext> transport_context, | 69 scoped_refptr<protocol::TransportContext> transport_context, |
69 const std::string& host_jid, | 70 const std::string& host_jid, |
70 const std::string& capabilities); | 71 const std::string& capabilities); |
71 | 72 |
72 protocol::ConnectionToHost::State connection_state() const { | 73 protocol::ConnectionToHost::State connection_state() const { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void StartConnection(); | 109 void StartConnection(); |
109 | 110 |
110 // Called when the connection is authenticated. | 111 // Called when the connection is authenticated. |
111 void OnAuthenticated(); | 112 void OnAuthenticated(); |
112 | 113 |
113 // Called when all channels are connected. | 114 // Called when all channels are connected. |
114 void OnChannelsConnected(); | 115 void OnChannelsConnected(); |
115 | 116 |
116 base::ThreadChecker thread_checker_; | 117 base::ThreadChecker thread_checker_; |
117 | 118 |
118 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; | 119 std::unique_ptr<protocol::CandidateSessionConfig> protocol_config_; |
119 | 120 |
120 // The following are not owned by this class. | 121 // The following are not owned by this class. |
121 ClientUserInterface* user_interface_ = nullptr; | 122 ClientUserInterface* user_interface_ = nullptr; |
122 protocol::VideoRenderer* video_renderer_ = nullptr; | 123 protocol::VideoRenderer* video_renderer_ = nullptr; |
123 SignalStrategy* signal_strategy_ = nullptr; | 124 SignalStrategy* signal_strategy_ = nullptr; |
124 | 125 |
125 std::string host_jid_; | 126 std::string host_jid_; |
126 protocol::ClientAuthenticationConfig client_auth_config_; | 127 protocol::ClientAuthenticationConfig client_auth_config_; |
127 scoped_refptr<protocol::TransportContext> transport_context_; | 128 scoped_refptr<protocol::TransportContext> transport_context_; |
128 | 129 |
129 scoped_ptr<protocol::SessionManager> session_manager_; | 130 std::unique_ptr<protocol::SessionManager> session_manager_; |
130 scoped_ptr<protocol::ConnectionToHost> connection_; | 131 std::unique_ptr<protocol::ConnectionToHost> connection_; |
131 | 132 |
132 scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_; | 133 std::unique_ptr<AudioDecodeScheduler> audio_decode_scheduler_; |
133 | 134 |
134 std::string local_capabilities_; | 135 std::string local_capabilities_; |
135 | 136 |
136 // The set of all capabilities supported by the host. | 137 // The set of all capabilities supported by the host. |
137 std::string host_capabilities_; | 138 std::string host_capabilities_; |
138 | 139 |
139 // True if |protocol::Capabilities| message has been received. | 140 // True if |protocol::Capabilities| message has been received. |
140 bool host_capabilities_received_ = false; | 141 bool host_capabilities_received_ = false; |
141 | 142 |
142 // Record the statistics of the connection. | 143 // Record the statistics of the connection. |
143 protocol::PerformanceTracker perf_tracker_; | 144 protocol::PerformanceTracker perf_tracker_; |
144 | 145 |
145 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 146 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
146 }; | 147 }; |
147 | 148 |
148 } // namespace remoting | 149 } // namespace remoting |
149 | 150 |
150 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 151 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
OLD | NEW |