| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "remoting/protocol/authenticator.h" | 8 #include "remoting/protocol/authenticator.h" |
| 9 #include "remoting/protocol/content_description.h" | 9 #include "remoting/protocol/content_description.h" |
| 10 #include "remoting/protocol/jingle_messages.h" | 10 #include "remoting/protocol/jingle_messages.h" |
| 11 #include "remoting/protocol/jingle_session.h" | 11 #include "remoting/protocol/jingle_session.h" |
| 12 #include "remoting/protocol/transport.h" | 12 #include "remoting/protocol/transport.h" |
| 13 #include "remoting/signaling/iq_sender.h" | 13 #include "remoting/signaling/iq_sender.h" |
| 14 #include "remoting/signaling/signal_strategy.h" | 14 #include "remoting/signaling/signal_strategy.h" |
| 15 #include "third_party/webrtc/base/socketaddress.h" | 15 #include "third_party/webrtc/base/socketaddress.h" |
| 16 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 16 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 17 | 17 |
| 18 using buzz::QName; | 18 using buzz::QName; |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 namespace protocol { | 21 namespace protocol { |
| 22 | 22 |
| 23 JingleSessionManager::JingleSessionManager( | 23 JingleSessionManager::JingleSessionManager( |
| 24 scoped_ptr<TransportFactory> transport_factory) | 24 scoped_ptr<TransportFactory> transport_factory) |
| 25 : transport_factory_(transport_factory.Pass()), | 25 : transport_factory_(transport_factory.Pass()), |
| 26 signal_strategy_(NULL), | 26 signal_strategy_(nullptr), |
| 27 listener_(NULL), | 27 listener_(nullptr), |
| 28 ready_(false) { | 28 ready_(false) { |
| 29 } | 29 } |
| 30 | 30 |
| 31 JingleSessionManager::~JingleSessionManager() { | 31 JingleSessionManager::~JingleSessionManager() { |
| 32 Close(); | 32 Close(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void JingleSessionManager::Init( | 35 void JingleSessionManager::Init( |
| 36 SignalStrategy* signal_strategy, | 36 SignalStrategy* signal_strategy, |
| 37 SessionManager::Listener* listener) { | 37 SessionManager::Listener* listener) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 56 sessions_[session->session_id_] = session.get(); | 56 sessions_[session->session_id_] = session.get(); |
| 57 return session.Pass(); | 57 return session.Pass(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void JingleSessionManager::Close() { | 60 void JingleSessionManager::Close() { |
| 61 DCHECK(CalledOnValidThread()); | 61 DCHECK(CalledOnValidThread()); |
| 62 | 62 |
| 63 // Close() can be called only after all sessions are destroyed. | 63 // Close() can be called only after all sessions are destroyed. |
| 64 DCHECK(sessions_.empty()); | 64 DCHECK(sessions_.empty()); |
| 65 | 65 |
| 66 listener_ = NULL; | 66 listener_ = nullptr; |
| 67 | 67 |
| 68 if (signal_strategy_) { | 68 if (signal_strategy_) { |
| 69 signal_strategy_->RemoveListener(this); | 69 signal_strategy_->RemoveListener(this); |
| 70 signal_strategy_ = NULL; | 70 signal_strategy_ = nullptr; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 void JingleSessionManager::set_authenticator_factory( | 74 void JingleSessionManager::set_authenticator_factory( |
| 75 scoped_ptr<AuthenticatorFactory> authenticator_factory) { | 75 scoped_ptr<AuthenticatorFactory> authenticator_factory) { |
| 76 DCHECK(CalledOnValidThread()); | 76 DCHECK(CalledOnValidThread()); |
| 77 authenticator_factory_ = authenticator_factory.Pass(); | 77 authenticator_factory_ = authenticator_factory.Pass(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void JingleSessionManager::OnSignalStrategyStateChange( | 80 void JingleSessionManager::OnSignalStrategyStateChange( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 signal_strategy_->SendStanza( | 164 signal_strategy_->SendStanza( |
| 165 JingleMessageReply(error).ToXml(original_stanza)); | 165 JingleMessageReply(error).ToXml(original_stanza)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void JingleSessionManager::SessionDestroyed(JingleSession* session) { | 168 void JingleSessionManager::SessionDestroyed(JingleSession* session) { |
| 169 sessions_.erase(session->session_id_); | 169 sessions_.erase(session->session_id_); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace protocol | 172 } // namespace protocol |
| 173 } // namespace remoting | 173 } // namespace remoting |
| OLD | NEW |