| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_manager.h" | 5 #include "remoting/protocol/jingle_session_manager.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 cricket::Session* cricket_session = cricket_session_manager_->CreateSession( | 170 cricket::Session* cricket_session = cricket_session_manager_->CreateSession( |
| 171 local_jid_, kChromotingXmlNamespace); | 171 local_jid_, kChromotingXmlNamespace); |
| 172 | 172 |
| 173 // Initialize connection object before we send initiate stanza. | 173 // Initialize connection object before we send initiate stanza. |
| 174 jingle_session->SetStateChangeCallback(state_change_callback); | 174 jingle_session->SetStateChangeCallback(state_change_callback); |
| 175 jingle_session->Init(cricket_session); | 175 jingle_session->Init(cricket_session); |
| 176 sessions_.push_back(jingle_session); | 176 sessions_.push_back(jingle_session); |
| 177 | 177 |
| 178 cricket_session->Initiate(host_jid, CreateClientSessionDescription( | 178 cricket_session->Initiate(host_jid, CreateClientSessionDescription( |
| 179 jingle_session->candidate_config()->Clone(), receiver_token, | 179 jingle_session->candidate_config()->Clone(), receiver_token)); |
| 180 jingle_session->GetEncryptedMasterKey())); | |
| 181 | 180 |
| 182 return jingle_session; | 181 return jingle_session; |
| 183 } | 182 } |
| 184 | 183 |
| 185 void JingleSessionManager::OnSessionCreate( | 184 void JingleSessionManager::OnSessionCreate( |
| 186 cricket::Session* cricket_session, bool incoming) { | 185 cricket::Session* cricket_session, bool incoming) { |
| 187 DCHECK(CalledOnValidThread()); | 186 DCHECK(CalledOnValidThread()); |
| 188 | 187 |
| 189 // Allow local connections if neccessary. | 188 // Allow local connections if neccessary. |
| 190 cricket_session->set_allow_local_ips(allow_local_ips_); | 189 cricket_session->set_allow_local_ips(allow_local_ips_); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 static_cast<const ContentDescription*>(content); | 324 static_cast<const ContentDescription*>(content); |
| 326 | 325 |
| 327 *elem = desc->ToXml(); | 326 *elem = desc->ToXml(); |
| 328 return true; | 327 return true; |
| 329 } | 328 } |
| 330 | 329 |
| 331 // static | 330 // static |
| 332 cricket::SessionDescription* | 331 cricket::SessionDescription* |
| 333 JingleSessionManager::CreateClientSessionDescription( | 332 JingleSessionManager::CreateClientSessionDescription( |
| 334 const CandidateSessionConfig* config, | 333 const CandidateSessionConfig* config, |
| 335 const std::string& auth_token, | 334 const std::string& auth_token) { |
| 336 const std::string& master_key) { | |
| 337 cricket::SessionDescription* desc = new cricket::SessionDescription(); | 335 cricket::SessionDescription* desc = new cricket::SessionDescription(); |
| 338 desc->AddContent( | 336 desc->AddContent( |
| 339 JingleSession::kChromotingContentName, kChromotingXmlNamespace, | 337 JingleSession::kChromotingContentName, kChromotingXmlNamespace, |
| 340 new ContentDescription(config, auth_token, master_key, "")); | 338 new ContentDescription(config, auth_token, "")); |
| 341 return desc; | 339 return desc; |
| 342 } | 340 } |
| 343 | 341 |
| 344 // static | 342 // static |
| 345 cricket::SessionDescription* JingleSessionManager::CreateHostSessionDescription( | 343 cricket::SessionDescription* JingleSessionManager::CreateHostSessionDescription( |
| 346 const CandidateSessionConfig* config, | 344 const CandidateSessionConfig* config, |
| 347 const std::string& certificate) { | 345 const std::string& certificate) { |
| 348 cricket::SessionDescription* desc = new cricket::SessionDescription(); | 346 cricket::SessionDescription* desc = new cricket::SessionDescription(); |
| 349 desc->AddContent( | 347 desc->AddContent( |
| 350 JingleSession::kChromotingContentName, kChromotingXmlNamespace, | 348 JingleSession::kChromotingContentName, kChromotingXmlNamespace, |
| 351 new ContentDescription(config, "", "", certificate)); | 349 new ContentDescription(config, "", certificate)); |
| 352 return desc; | 350 return desc; |
| 353 } | 351 } |
| 354 | 352 |
| 355 } // namespace protocol | 353 } // namespace protocol |
| 356 } // namespace remoting | 354 } // namespace remoting |
| OLD | NEW |