| 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/protocol/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 void JingleSession::CreateStreamChannel( | 181 void JingleSession::CreateStreamChannel( |
| 182 const std::string& name, | 182 const std::string& name, |
| 183 const StreamChannelCallback& callback) { | 183 const StreamChannelCallback& callback) { |
| 184 DCHECK(!channels_[name]); | 184 DCHECK(!channels_[name]); |
| 185 | 185 |
| 186 scoped_ptr<ChannelAuthenticator> channel_authenticator = | 186 scoped_ptr<ChannelAuthenticator> channel_authenticator = |
| 187 authenticator_->CreateChannelAuthenticator(); | 187 authenticator_->CreateChannelAuthenticator(); |
| 188 scoped_ptr<StreamTransport> channel = | 188 scoped_ptr<StreamTransport> channel = |
| 189 session_manager_->transport_factory_->CreateStreamTransport(); | 189 session_manager_->transport_factory_->CreateStreamTransport(); |
| 190 channel->Initialize(name, session_manager_->transport_config_, | 190 channel->Initialize(name, this, channel_authenticator.Pass()); |
| 191 this, channel_authenticator.Pass()); | |
| 192 channel->Connect(callback); | 191 channel->Connect(callback); |
| 193 channels_[name] = channel.release(); | 192 channels_[name] = channel.release(); |
| 194 } | 193 } |
| 195 | 194 |
| 196 void JingleSession::CreateDatagramChannel( | 195 void JingleSession::CreateDatagramChannel( |
| 197 const std::string& name, | 196 const std::string& name, |
| 198 const DatagramChannelCallback& callback) { | 197 const DatagramChannelCallback& callback) { |
| 199 DCHECK(!channels_[name]); | 198 DCHECK(!channels_[name]); |
| 200 | 199 |
| 201 scoped_ptr<ChannelAuthenticator> channel_authenticator = | 200 scoped_ptr<ChannelAuthenticator> channel_authenticator = |
| 202 authenticator_->CreateChannelAuthenticator(); | 201 authenticator_->CreateChannelAuthenticator(); |
| 203 scoped_ptr<DatagramTransport> channel = | 202 scoped_ptr<DatagramTransport> channel = |
| 204 session_manager_->transport_factory_->CreateDatagramTransport(); | 203 session_manager_->transport_factory_->CreateDatagramTransport(); |
| 205 channel->Initialize(name, session_manager_->transport_config_, | 204 channel->Initialize(name, this, channel_authenticator.Pass()); |
| 206 this, channel_authenticator.Pass()); | |
| 207 channel->Connect(callback); | 205 channel->Connect(callback); |
| 208 channels_[name] = channel.release(); | 206 channels_[name] = channel.release(); |
| 209 } | 207 } |
| 210 | 208 |
| 211 void JingleSession::CancelChannelCreation(const std::string& name) { | 209 void JingleSession::CancelChannelCreation(const std::string& name) { |
| 212 ChannelsMap::iterator it = channels_.find(name); | 210 ChannelsMap::iterator it = channels_.find(name); |
| 213 if (it != channels_.end() && !it->second->is_connected()) { | 211 if (it != channels_.end() && !it->second->is_connected()) { |
| 214 delete it->second; | 212 delete it->second; |
| 215 DCHECK(!channels_[name]); | 213 DCHECK(!channels_[name]); |
| 216 } | 214 } |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 DCHECK_NE(state_, FAILED); | 580 DCHECK_NE(state_, FAILED); |
| 583 | 581 |
| 584 state_ = new_state; | 582 state_ = new_state; |
| 585 if (!state_change_callback_.is_null()) | 583 if (!state_change_callback_.is_null()) |
| 586 state_change_callback_.Run(new_state); | 584 state_change_callback_.Run(new_state); |
| 587 } | 585 } |
| 588 } | 586 } |
| 589 | 587 |
| 590 } // namespace protocol | 588 } // namespace protocol |
| 591 } // namespace remoting | 589 } // namespace remoting |
| OLD | NEW |