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

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

Issue 1778023002: Move NegotiatingClientAuthentication creation to ChromotingClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/jni/chromoting_jni_instance.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 "remoting/base/capabilities.h" 9 #include "remoting/base/capabilities.h"
10 #include "remoting/client/audio_decode_scheduler.h" 10 #include "remoting/client/audio_decode_scheduler.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 protocol_config_ = std::move(config); 46 protocol_config_ = std::move(config);
47 } 47 }
48 48
49 void ChromotingClient::SetConnectionToHostForTests( 49 void ChromotingClient::SetConnectionToHostForTests(
50 scoped_ptr<protocol::ConnectionToHost> connection_to_host) { 50 scoped_ptr<protocol::ConnectionToHost> connection_to_host) {
51 connection_ = std::move(connection_to_host); 51 connection_ = std::move(connection_to_host);
52 } 52 }
53 53
54 void ChromotingClient::Start( 54 void ChromotingClient::Start(
55 SignalStrategy* signal_strategy, 55 SignalStrategy* signal_strategy,
56 scoped_ptr<protocol::Authenticator> authenticator, 56 const protocol::ClientAuthenticationConfig& client_auth_config,
57 scoped_refptr<protocol::TransportContext> transport_context, 57 scoped_refptr<protocol::TransportContext> transport_context,
58 const std::string& host_jid, 58 const std::string& host_jid,
59 const std::string& capabilities) { 59 const std::string& capabilities) {
60 DCHECK(thread_checker_.CalledOnValidThread()); 60 DCHECK(thread_checker_.CalledOnValidThread());
61 DCHECK(!session_manager_); // Start must be called more than once. 61 DCHECK(!session_manager_); // Start must be called more than once.
62 62
63 host_jid_ = host_jid; 63 host_jid_ = host_jid;
64 local_capabilities_ = capabilities; 64 local_capabilities_ = capabilities;
65 65
66 if (!protocol_config_) 66 if (!protocol_config_)
(...skipping 15 matching lines...) Expand all
82 } 82 }
83 } 83 }
84 connection_->set_client_stub(this); 84 connection_->set_client_stub(this);
85 connection_->set_clipboard_stub(this); 85 connection_->set_clipboard_stub(this);
86 connection_->set_video_renderer(video_renderer_); 86 connection_->set_video_renderer(video_renderer_);
87 connection_->set_audio_stub(audio_decode_scheduler_.get()); 87 connection_->set_audio_stub(audio_decode_scheduler_.get());
88 88
89 session_manager_.reset(new protocol::JingleSessionManager(signal_strategy)); 89 session_manager_.reset(new protocol::JingleSessionManager(signal_strategy));
90 session_manager_->set_protocol_config(std::move(protocol_config_)); 90 session_manager_->set_protocol_config(std::move(protocol_config_));
91 91
92 authenticator_ = std::move(authenticator); 92 client_auth_config_ = client_auth_config;
93 transport_context_ = transport_context; 93 transport_context_ = transport_context;
94 94
95 signal_strategy_ = signal_strategy; 95 signal_strategy_ = signal_strategy;
96 signal_strategy_->AddListener(this); 96 signal_strategy_->AddListener(this);
97 97
98 switch (signal_strategy_->GetState()) { 98 switch (signal_strategy_->GetState()) {
99 case SignalStrategy::CONNECTING: 99 case SignalStrategy::CONNECTING:
100 // Nothing to do here. Just need to wait until |signal_strategy_| becomes 100 // Nothing to do here. Just need to wait until |signal_strategy_| becomes
101 // connected. 101 // connected.
102 break; 102 break;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 bool ChromotingClient::OnSignalStrategyIncomingStanza( 207 bool ChromotingClient::OnSignalStrategyIncomingStanza(
208 const buzz::XmlElement* stanza) { 208 const buzz::XmlElement* stanza) {
209 return false; 209 return false;
210 } 210 }
211 211
212 void ChromotingClient::StartConnection() { 212 void ChromotingClient::StartConnection() {
213 DCHECK(thread_checker_.CalledOnValidThread()); 213 DCHECK(thread_checker_.CalledOnValidThread());
214 connection_->Connect( 214 connection_->Connect(
215 session_manager_->Connect(host_jid_, std::move(authenticator_)), 215 session_manager_->Connect(
216 host_jid_,
217 make_scoped_ptr(new protocol::NegotiatingClientAuthenticator(
218 client_auth_config_))),
216 transport_context_, this); 219 transport_context_, this);
217 } 220 }
218 221
219 void ChromotingClient::OnAuthenticated() { 222 void ChromotingClient::OnAuthenticated() {
220 DCHECK(thread_checker_.CalledOnValidThread()); 223 DCHECK(thread_checker_.CalledOnValidThread());
221 224
222 // Initialize the decoder. 225 // Initialize the decoder.
223 if (connection_->config().is_audio_enabled()) 226 if (connection_->config().is_audio_enabled())
224 audio_decode_scheduler_->Initialize(connection_->config()); 227 audio_decode_scheduler_->Initialize(connection_->config());
225 } 228 }
226 229
227 void ChromotingClient::OnChannelsConnected() { 230 void ChromotingClient::OnChannelsConnected() {
228 DCHECK(thread_checker_.CalledOnValidThread()); 231 DCHECK(thread_checker_.CalledOnValidThread());
229 232
230 // Negotiate capabilities with the host. 233 // Negotiate capabilities with the host.
231 VLOG(1) << "Client capabilities: " << local_capabilities_; 234 VLOG(1) << "Client capabilities: " << local_capabilities_;
232 235
233 protocol::Capabilities capabilities; 236 protocol::Capabilities capabilities;
234 capabilities.set_capabilities(local_capabilities_); 237 capabilities.set_capabilities(local_capabilities_);
235 connection_->host_stub()->SetCapabilities(capabilities); 238 connection_->host_stub()->SetCapabilities(capabilities);
236 } 239 }
237 240
238 } // namespace remoting 241 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/jni/chromoting_jni_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698