Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: remoting/client/chromoting_client.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/chromoting_client_runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "remoting/client/chromoting_client.h" 5 #include "remoting/client/chromoting_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h"
9 #include "remoting/base/capabilities.h" 10 #include "remoting/base/capabilities.h"
10 #include "remoting/base/constants.h" 11 #include "remoting/base/constants.h"
11 #include "remoting/client/audio_decode_scheduler.h" 12 #include "remoting/client/audio_decode_scheduler.h"
12 #include "remoting/client/audio_player.h" 13 #include "remoting/client/audio_player.h"
13 #include "remoting/client/client_context.h" 14 #include "remoting/client/client_context.h"
14 #include "remoting/client/client_user_interface.h" 15 #include "remoting/client/client_user_interface.h"
15 #include "remoting/protocol/authenticator.h" 16 #include "remoting/protocol/authenticator.h"
16 #include "remoting/protocol/connection_to_host.h" 17 #include "remoting/protocol/connection_to_host.h"
17 #include "remoting/protocol/host_stub.h" 18 #include "remoting/protocol/host_stub.h"
18 #include "remoting/protocol/ice_connection_to_host.h" 19 #include "remoting/protocol/ice_connection_to_host.h"
19 #include "remoting/protocol/jingle_session_manager.h" 20 #include "remoting/protocol/jingle_session_manager.h"
20 #include "remoting/protocol/negotiating_client_authenticator.h" 21 #include "remoting/protocol/negotiating_client_authenticator.h"
21 #include "remoting/protocol/session_config.h" 22 #include "remoting/protocol/session_config.h"
22 #include "remoting/protocol/transport_context.h" 23 #include "remoting/protocol/transport_context.h"
23 #include "remoting/protocol/video_renderer.h" 24 #include "remoting/protocol/video_renderer.h"
24 #include "remoting/protocol/webrtc_connection_to_host.h" 25 #include "remoting/protocol/webrtc_connection_to_host.h"
25 #include "remoting/signaling/jid_util.h" 26 #include "remoting/signaling/jid_util.h"
26 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 27 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
27 28
28 namespace remoting { 29 namespace remoting {
29 30
30 ChromotingClient::ChromotingClient(ClientContext* client_context, 31 ChromotingClient::ChromotingClient(ClientContext* client_context,
31 ClientUserInterface* user_interface, 32 ClientUserInterface* user_interface,
32 protocol::VideoRenderer* video_renderer, 33 protocol::VideoRenderer* video_renderer,
33 scoped_ptr<AudioPlayer> audio_player) 34 std::unique_ptr<AudioPlayer> audio_player)
34 : user_interface_(user_interface), video_renderer_(video_renderer) { 35 : user_interface_(user_interface), video_renderer_(video_renderer) {
35 DCHECK(client_context->main_task_runner()->BelongsToCurrentThread()); 36 DCHECK(client_context->main_task_runner()->BelongsToCurrentThread());
36 if (audio_player) { 37 if (audio_player) {
37 audio_decode_scheduler_.reset(new AudioDecodeScheduler( 38 audio_decode_scheduler_.reset(new AudioDecodeScheduler(
38 client_context->main_task_runner(), 39 client_context->main_task_runner(),
39 client_context->audio_decode_task_runner(), std::move(audio_player))); 40 client_context->audio_decode_task_runner(), std::move(audio_player)));
40 } 41 }
41 } 42 }
42 43
43 ChromotingClient::~ChromotingClient() { 44 ChromotingClient::~ChromotingClient() {
44 if (signal_strategy_) 45 if (signal_strategy_)
45 signal_strategy_->RemoveListener(this); 46 signal_strategy_->RemoveListener(this);
46 } 47 }
47 48
48 void ChromotingClient::set_protocol_config( 49 void ChromotingClient::set_protocol_config(
49 scoped_ptr<protocol::CandidateSessionConfig> config) { 50 std::unique_ptr<protocol::CandidateSessionConfig> config) {
50 protocol_config_ = std::move(config); 51 protocol_config_ = std::move(config);
51 } 52 }
52 53
53 void ChromotingClient::SetConnectionToHostForTests( 54 void ChromotingClient::SetConnectionToHostForTests(
54 scoped_ptr<protocol::ConnectionToHost> connection_to_host) { 55 std::unique_ptr<protocol::ConnectionToHost> connection_to_host) {
55 connection_ = std::move(connection_to_host); 56 connection_ = std::move(connection_to_host);
56 } 57 }
57 58
58 void ChromotingClient::Start( 59 void ChromotingClient::Start(
59 SignalStrategy* signal_strategy, 60 SignalStrategy* signal_strategy,
60 const protocol::ClientAuthenticationConfig& client_auth_config, 61 const protocol::ClientAuthenticationConfig& client_auth_config,
61 scoped_refptr<protocol::TransportContext> transport_context, 62 scoped_refptr<protocol::TransportContext> transport_context,
62 const std::string& host_jid, 63 const std::string& host_jid,
63 const std::string& capabilities) { 64 const std::string& capabilities) {
64 DCHECK(thread_checker_.CalledOnValidThread()); 65 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 bool ChromotingClient::OnSignalStrategyIncomingStanza( 233 bool ChromotingClient::OnSignalStrategyIncomingStanza(
233 const buzz::XmlElement* stanza) { 234 const buzz::XmlElement* stanza) {
234 return false; 235 return false;
235 } 236 }
236 237
237 void ChromotingClient::StartConnection() { 238 void ChromotingClient::StartConnection() {
238 DCHECK(thread_checker_.CalledOnValidThread()); 239 DCHECK(thread_checker_.CalledOnValidThread());
239 connection_->Connect( 240 connection_->Connect(
240 session_manager_->Connect( 241 session_manager_->Connect(
241 host_jid_, 242 host_jid_,
242 make_scoped_ptr(new protocol::NegotiatingClientAuthenticator( 243 base::WrapUnique(new protocol::NegotiatingClientAuthenticator(
243 NormalizeJid(signal_strategy_->GetLocalJid()), host_jid_, 244 NormalizeJid(signal_strategy_->GetLocalJid()), host_jid_,
244 client_auth_config_))), 245 client_auth_config_))),
245 transport_context_, this); 246 transport_context_, this);
246 } 247 }
247 248
248 void ChromotingClient::OnAuthenticated() { 249 void ChromotingClient::OnAuthenticated() {
249 DCHECK(thread_checker_.CalledOnValidThread()); 250 DCHECK(thread_checker_.CalledOnValidThread());
250 251
251 // Initialize the decoder. 252 // Initialize the decoder.
252 if (connection_->config().is_audio_enabled()) 253 if (connection_->config().is_audio_enabled())
253 audio_decode_scheduler_->Initialize(connection_->config()); 254 audio_decode_scheduler_->Initialize(connection_->config());
254 } 255 }
255 256
256 void ChromotingClient::OnChannelsConnected() { 257 void ChromotingClient::OnChannelsConnected() {
257 DCHECK(thread_checker_.CalledOnValidThread()); 258 DCHECK(thread_checker_.CalledOnValidThread());
258 259
259 // Negotiate capabilities with the host. 260 // Negotiate capabilities with the host.
260 VLOG(1) << "Client capabilities: " << local_capabilities_; 261 VLOG(1) << "Client capabilities: " << local_capabilities_;
261 262
262 protocol::Capabilities capabilities; 263 protocol::Capabilities capabilities;
263 capabilities.set_capabilities(local_capabilities_); 264 capabilities.set_capabilities(local_capabilities_);
264 connection_->host_stub()->SetCapabilities(capabilities); 265 connection_->host_stub()->SetCapabilities(capabilities);
265 } 266 }
266 267
267 } // namespace remoting 268 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/chromoting_client_runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698