| 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 #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 "base/memory/ptr_util.h" |
| 10 #include "remoting/base/capabilities.h" | 10 #include "remoting/base/capabilities.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 VLOG(0) << "Using " << protocol::TransportRoute::GetTypeString(route.type) | 226 VLOG(0) << "Using " << protocol::TransportRoute::GetTypeString(route.type) |
| 227 << " connection for " << channel_name << " channel"; | 227 << " connection for " << channel_name << " channel"; |
| 228 user_interface_->OnRouteChanged(channel_name, route); | 228 user_interface_->OnRouteChanged(channel_name, route); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void ChromotingClient::OnSignalStrategyStateChange( | 231 void ChromotingClient::OnSignalStrategyStateChange( |
| 232 SignalStrategy::State state) { | 232 SignalStrategy::State state) { |
| 233 DCHECK(thread_checker_.CalledOnValidThread()); | 233 DCHECK(thread_checker_.CalledOnValidThread()); |
| 234 | 234 |
| 235 if (state == SignalStrategy::CONNECTED) { | 235 if (state == SignalStrategy::CONNECTED) { |
| 236 VLOG(1) << "Connected as: " << signal_strategy_->GetLocalJid(); | 236 VLOG(1) << "Connected as: " << signal_strategy_->GetLocalAddress().jid(); |
| 237 // After signaling has been connected we can try connecting to the host. | 237 // After signaling has been connected we can try connecting to the host. |
| 238 if (connection_ && | 238 if (connection_ && |
| 239 connection_->state() == protocol::ConnectionToHost::INITIALIZING) { | 239 connection_->state() == protocol::ConnectionToHost::INITIALIZING) { |
| 240 StartConnection(); | 240 StartConnection(); |
| 241 } | 241 } |
| 242 } else if (state == SignalStrategy::DISCONNECTED) { | 242 } else if (state == SignalStrategy::DISCONNECTED) { |
| 243 VLOG(1) << "Signaling connection closed."; | 243 VLOG(1) << "Signaling connection closed."; |
| 244 connection_.reset(); | 244 connection_.reset(); |
| 245 user_interface_->OnConnectionState(protocol::ConnectionToHost::CLOSED, | 245 user_interface_->OnConnectionState(protocol::ConnectionToHost::CLOSED, |
| 246 protocol::SIGNALING_ERROR); | 246 protocol::SIGNALING_ERROR); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool ChromotingClient::OnSignalStrategyIncomingStanza( | 250 bool ChromotingClient::OnSignalStrategyIncomingStanza( |
| 251 const buzz::XmlElement* stanza) { | 251 const buzz::XmlElement* stanza) { |
| 252 return false; | 252 return false; |
| 253 } | 253 } |
| 254 | 254 |
| 255 void ChromotingClient::StartConnection() { | 255 void ChromotingClient::StartConnection() { |
| 256 DCHECK(thread_checker_.CalledOnValidThread()); | 256 DCHECK(thread_checker_.CalledOnValidThread()); |
| 257 auto session = session_manager_->Connect( | 257 auto session = session_manager_->Connect( |
| 258 host_jid_, base::MakeUnique<protocol::NegotiatingClientAuthenticator>( | 258 SignalingAddress(host_jid_), |
| 259 NormalizeJid(signal_strategy_->GetLocalJid()), host_jid_, | 259 base::MakeUnique<protocol::NegotiatingClientAuthenticator>( |
| 260 client_auth_config_)); | 260 signal_strategy_->GetLocalAddress().id(), host_jid_, |
| 261 client_auth_config_)); |
| 261 if (host_experiment_sender_) { | 262 if (host_experiment_sender_) { |
| 262 session->AddPlugin(host_experiment_sender_.get()); | 263 session->AddPlugin(host_experiment_sender_.get()); |
| 263 } | 264 } |
| 264 connection_->Connect(std::move(session), transport_context_, this); | 265 connection_->Connect(std::move(session), transport_context_, this); |
| 265 } | 266 } |
| 266 | 267 |
| 267 void ChromotingClient::OnChannelsConnected() { | 268 void ChromotingClient::OnChannelsConnected() { |
| 268 DCHECK(thread_checker_.CalledOnValidThread()); | 269 DCHECK(thread_checker_.CalledOnValidThread()); |
| 269 | 270 |
| 270 // Negotiate capabilities with the host. | 271 // Negotiate capabilities with the host. |
| 271 VLOG(1) << "Client capabilities: " << local_capabilities_; | 272 VLOG(1) << "Client capabilities: " << local_capabilities_; |
| 272 | 273 |
| 273 protocol::Capabilities capabilities; | 274 protocol::Capabilities capabilities; |
| 274 capabilities.set_capabilities(local_capabilities_); | 275 capabilities.set_capabilities(local_capabilities_); |
| 275 connection_->host_stub()->SetCapabilities(capabilities); | 276 connection_->host_stub()->SetCapabilities(capabilities); |
| 276 | 277 |
| 277 mouse_input_scaler_.set_input_stub(connection_->input_stub()); | 278 mouse_input_scaler_.set_input_stub(connection_->input_stub()); |
| 278 } | 279 } |
| 279 | 280 |
| 280 } // namespace remoting | 281 } // namespace remoting |
| OLD | NEW |