OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // TODO(hclam): Instead of generating we should restore them from the disk. | 281 // TODO(hclam): Instead of generating we should restore them from the disk. |
282 if (!certificate_) { | 282 if (!certificate_) { |
283 private_key_.reset(base::RSAPrivateKey::Create(1024)); | 283 private_key_.reset(base::RSAPrivateKey::Create(1024)); |
284 certificate_ = net::X509Certificate::CreateSelfSigned( | 284 certificate_ = net::X509Certificate::CreateSelfSigned( |
285 private_key_.get(), "CN=chromoting", 1, | 285 private_key_.get(), "CN=chromoting", 1, |
286 base::TimeDelta::FromDays(1)); | 286 base::TimeDelta::FromDays(1)); |
287 CHECK(certificate_); | 287 CHECK(certificate_); |
288 } | 288 } |
289 JingleSession* jingle_session = | 289 JingleSession* jingle_session = |
290 JingleSession::CreateServerSession(this, certificate_, | 290 JingleSession::CreateServerSession(this, certificate_, |
291 private_key_.release()); | 291 private_key_.get()); |
292 certificate_ = NULL; | 292 certificate_ = NULL; |
293 sessions_.push_back(make_scoped_refptr(jingle_session)); | 293 sessions_.push_back(make_scoped_refptr(jingle_session)); |
294 jingle_session->Init(cricket_session); | 294 jingle_session->Init(cricket_session); |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 void JingleSessionManager::OnSessionDestroy(cricket::Session* cricket_session) { | 298 void JingleSessionManager::OnSessionDestroy(cricket::Session* cricket_session) { |
299 DCHECK_EQ(message_loop(), MessageLoop::current()); | 299 DCHECK_EQ(message_loop(), MessageLoop::current()); |
300 | 300 |
301 std::list<scoped_refptr<JingleSession> >::iterator it; | 301 std::list<scoped_refptr<JingleSession> >::iterator it; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 scoped_refptr<net::X509Certificate> certificate) { | 545 scoped_refptr<net::X509Certificate> certificate) { |
546 cricket::SessionDescription* desc = new cricket::SessionDescription(); | 546 cricket::SessionDescription* desc = new cricket::SessionDescription(); |
547 desc->AddContent(JingleSession::kChromotingContentName, | 547 desc->AddContent(JingleSession::kChromotingContentName, |
548 kChromotingXmlNamespace, | 548 kChromotingXmlNamespace, |
549 new ContentDescription(config, auth_token, certificate)); | 549 new ContentDescription(config, auth_token, certificate)); |
550 return desc; | 550 return desc; |
551 } | 551 } |
552 | 552 |
553 } // namespace protocol | 553 } // namespace protocol |
554 } // namespace remoting | 554 } // namespace remoting |
OLD | NEW |