| 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/pepper_session.h" | 5 #include "remoting/protocol/pepper_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" |
| 11 #include "remoting/base/constants.h" | 11 #include "remoting/base/constants.h" |
| 12 #include "remoting/jingle_glue/iq_sender.h" | 12 #include "remoting/jingle_glue/iq_sender.h" |
| 13 #include "remoting/protocol/content_description.h" | 13 #include "remoting/protocol/content_description.h" |
| 14 #include "remoting/protocol/jingle_messages.h" | 14 #include "remoting/protocol/jingle_messages.h" |
| 15 #include "remoting/protocol/pepper_session_manager.h" | 15 #include "remoting/protocol/pepper_session_manager.h" |
| 16 #include "remoting/protocol/pepper_stream_channel.h" | 16 #include "remoting/protocol/pepper_stream_channel.h" |
| 17 #include "remoting/protocol/v1_client_channel_authenticator.h" |
| 17 #include "third_party/libjingle/source/talk/p2p/base/candidate.h" | 18 #include "third_party/libjingle/source/talk/p2p/base/candidate.h" |
| 18 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 19 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
| 19 | 20 |
| 20 using buzz::XmlElement; | 21 using buzz::XmlElement; |
| 21 | 22 |
| 22 namespace remoting { | 23 namespace remoting { |
| 23 namespace protocol { | 24 namespace protocol { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 // Delay after candidate creation before sending transport-info | 27 // Delay after candidate creation before sending transport-info |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 108 } |
| 108 | 109 |
| 109 void PepperSession::CreateStreamChannel( | 110 void PepperSession::CreateStreamChannel( |
| 110 const std::string& name, | 111 const std::string& name, |
| 111 const StreamChannelCallback& callback) { | 112 const StreamChannelCallback& callback) { |
| 112 DCHECK(!channels_[name]); | 113 DCHECK(!channels_[name]); |
| 113 | 114 |
| 114 PepperStreamChannel* channel = new PepperStreamChannel(this, name, callback); | 115 PepperStreamChannel* channel = new PepperStreamChannel(this, name, callback); |
| 115 channels_[name] = channel; | 116 channels_[name] = channel; |
| 116 channel->Connect(session_manager_->pp_instance_, | 117 channel->Connect(session_manager_->pp_instance_, |
| 117 session_manager_->transport_config_, remote_cert_); | 118 session_manager_->transport_config_, |
| 119 new V1ClientChannelAuthenticator( |
| 120 remote_cert_, shared_secret_)); |
| 118 } | 121 } |
| 119 | 122 |
| 120 void PepperSession::CreateDatagramChannel( | 123 void PepperSession::CreateDatagramChannel( |
| 121 const std::string& name, | 124 const std::string& name, |
| 122 const DatagramChannelCallback& callback) { | 125 const DatagramChannelCallback& callback) { |
| 123 // TODO(sergeyu): Implement datagram channel support. | 126 // TODO(sergeyu): Implement datagram channel support. |
| 124 NOTREACHED(); | 127 NOTREACHED(); |
| 125 } | 128 } |
| 126 | 129 |
| 127 void PepperSession::CancelChannelCreation(const std::string& name) { | 130 void PepperSession::CancelChannelCreation(const std::string& name) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 DCHECK_NE(state_, FAILED); | 378 DCHECK_NE(state_, FAILED); |
| 376 | 379 |
| 377 state_ = new_state; | 380 state_ = new_state; |
| 378 if (!state_change_callback_.is_null()) | 381 if (!state_change_callback_.is_null()) |
| 379 state_change_callback_.Run(new_state); | 382 state_change_callback_.Run(new_state); |
| 380 } | 383 } |
| 381 } | 384 } |
| 382 | 385 |
| 383 } // namespace protocol | 386 } // namespace protocol |
| 384 } // namespace remoting | 387 } // namespace remoting |
| OLD | NEW |