| 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_manager.h" | 5 #include "remoting/protocol/jingle_session_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "remoting/protocol/authenticator.h" | 10 #include "remoting/protocol/authenticator.h" |
| 11 #include "remoting/protocol/content_description.h" | 11 #include "remoting/protocol/content_description.h" |
| 12 #include "remoting/protocol/jingle_messages.h" | 12 #include "remoting/protocol/jingle_messages.h" |
| 13 #include "remoting/protocol/jingle_session.h" | 13 #include "remoting/protocol/jingle_session.h" |
| 14 #include "remoting/protocol/transport.h" | 14 #include "remoting/protocol/transport.h" |
| 15 #include "remoting/signaling/iq_sender.h" | 15 #include "remoting/signaling/iq_sender.h" |
| 16 #include "remoting/signaling/signal_strategy.h" | 16 #include "remoting/signaling/signal_strategy.h" |
| 17 #include "third_party/webrtc/base/socketaddress.h" | 17 #include "third_party/webrtc/base/socketaddress.h" |
| 18 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 18 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 19 | 19 |
| 20 using buzz::QName; | 20 using buzz::QName; |
| 21 | 21 |
| 22 namespace remoting { | 22 namespace remoting { |
| 23 namespace protocol { | 23 namespace protocol { |
| 24 | 24 |
| 25 JingleSessionManager::JingleSessionManager( | 25 JingleSessionManager::JingleSessionManager(SignalStrategy* signal_strategy) |
| 26 scoped_ptr<TransportFactory> transport_factory, | 26 : signal_strategy_(signal_strategy), |
| 27 SignalStrategy* signal_strategy) | |
| 28 : transport_factory_(std::move(transport_factory)), | |
| 29 signal_strategy_(signal_strategy), | |
| 30 protocol_config_(CandidateSessionConfig::CreateDefault()), | 27 protocol_config_(CandidateSessionConfig::CreateDefault()), |
| 31 iq_sender_(new IqSender(signal_strategy_)) { | 28 iq_sender_(new IqSender(signal_strategy_)) { |
| 32 signal_strategy_->AddListener(this); | 29 signal_strategy_->AddListener(this); |
| 33 } | 30 } |
| 34 | 31 |
| 35 JingleSessionManager::~JingleSessionManager() { | 32 JingleSessionManager::~JingleSessionManager() { |
| 36 DCHECK(sessions_.empty()); | 33 DCHECK(sessions_.empty()); |
| 37 signal_strategy_->RemoveListener(this); | 34 signal_strategy_->RemoveListener(this); |
| 38 } | 35 } |
| 39 | 36 |
| 40 void JingleSessionManager::AcceptIncoming( | 37 void JingleSessionManager::AcceptIncoming( |
| 41 const IncomingSessionCallback& incoming_session_callback) { | 38 const IncomingSessionCallback& incoming_session_callback) { |
| 42 incoming_session_callback_ = incoming_session_callback; | 39 incoming_session_callback_ = incoming_session_callback; |
| 43 | |
| 44 } | 40 } |
| 45 | 41 |
| 46 void JingleSessionManager::set_protocol_config( | 42 void JingleSessionManager::set_protocol_config( |
| 47 scoped_ptr<CandidateSessionConfig> config) { | 43 scoped_ptr<CandidateSessionConfig> config) { |
| 48 protocol_config_ = std::move(config); | 44 protocol_config_ = std::move(config); |
| 49 } | 45 } |
| 50 | 46 |
| 51 scoped_ptr<Session> JingleSessionManager::Connect( | 47 scoped_ptr<Session> JingleSessionManager::Connect( |
| 52 const std::string& host_jid, | 48 const std::string& host_jid, |
| 53 scoped_ptr<Authenticator> authenticator) { | 49 scoped_ptr<Authenticator> authenticator) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 signal_strategy_->SendStanza( | 142 signal_strategy_->SendStanza( |
| 147 JingleMessageReply(error).ToXml(original_stanza)); | 143 JingleMessageReply(error).ToXml(original_stanza)); |
| 148 } | 144 } |
| 149 | 145 |
| 150 void JingleSessionManager::SessionDestroyed(JingleSession* session) { | 146 void JingleSessionManager::SessionDestroyed(JingleSession* session) { |
| 151 sessions_.erase(session->session_id_); | 147 sessions_.erase(session->session_id_); |
| 152 } | 148 } |
| 153 | 149 |
| 154 } // namespace protocol | 150 } // namespace protocol |
| 155 } // namespace remoting | 151 } // namespace remoting |
| OLD | NEW |