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" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 scoped_ptr<Session> JingleSessionManager::Connect( | 47 scoped_ptr<Session> JingleSessionManager::Connect( |
48 const std::string& host_jid, | 48 const std::string& host_jid, |
49 scoped_ptr<Authenticator> authenticator, | 49 scoped_ptr<Authenticator> authenticator, |
50 scoped_ptr<CandidateSessionConfig> config) { | 50 scoped_ptr<CandidateSessionConfig> config) { |
51 // Notify |transport_factory_| that it may be used soon. | 51 // Notify |transport_factory_| that it may be used soon. |
52 transport_factory_->PrepareTokens(); | 52 transport_factory_->PrepareTokens(); |
53 | 53 |
54 scoped_ptr<JingleSession> session(new JingleSession(this)); | 54 scoped_ptr<JingleSession> session(new JingleSession(this)); |
55 session->StartConnection(host_jid, authenticator.Pass(), config.Pass()); | 55 session->StartConnection(host_jid, authenticator.Pass(), config.Pass()); |
56 sessions_[session->session_id_] = session.get(); | 56 sessions_[session->session_id_] = session.get(); |
57 return session.PassAs<Session>(); | 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_ = NULL; |
67 | 67 |
(...skipping 96 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 |