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/pepper_session_manager.h" | 5 #include "remoting/protocol/pepper_session_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "remoting/jingle_glue/iq_sender.h" | 8 #include "remoting/jingle_glue/iq_sender.h" |
9 #include "remoting/jingle_glue/jingle_info_request.h" | 9 #include "remoting/jingle_glue/jingle_info_request.h" |
10 #include "remoting/jingle_glue/signal_strategy.h" | 10 #include "remoting/jingle_glue/signal_strategy.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 scoped_ptr<Session> PepperSessionManager::Connect( | 73 scoped_ptr<Session> PepperSessionManager::Connect( |
74 const std::string& host_jid, | 74 const std::string& host_jid, |
75 scoped_ptr<Authenticator> authenticator, | 75 scoped_ptr<Authenticator> authenticator, |
76 scoped_ptr<CandidateSessionConfig> config, | 76 scoped_ptr<CandidateSessionConfig> config, |
77 const Session::StateChangeCallback& state_change_callback) { | 77 const Session::StateChangeCallback& state_change_callback) { |
78 scoped_ptr<PepperSession> session(new PepperSession(this)); | 78 scoped_ptr<PepperSession> session(new PepperSession(this)); |
79 session->StartConnection(host_jid, authenticator.Pass(), config.Pass(), | 79 session->StartConnection(host_jid, authenticator.Pass(), config.Pass(), |
80 state_change_callback); | 80 state_change_callback); |
81 sessions_[session->session_id_] = session.get(); | 81 sessions_[session->session_id_] = session.get(); |
82 return scoped_ptr<Session>(session.Pass()); | 82 return session.PassAs<Session>(); |
83 } | 83 } |
84 | 84 |
85 void PepperSessionManager::Close() { | 85 void PepperSessionManager::Close() { |
86 DCHECK(CalledOnValidThread()); | 86 DCHECK(CalledOnValidThread()); |
87 | 87 |
88 // Close() can be called only after all sessions are destroyed. | 88 // Close() can be called only after all sessions are destroyed. |
89 DCHECK(sessions_.empty()); | 89 DCHECK(sessions_.empty()); |
90 | 90 |
91 listener_ = NULL; | 91 listener_ = NULL; |
92 jingle_info_request_.reset(); | 92 jingle_info_request_.reset(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 buzz::XmlElement* stanza = reply.ToXml(original_stanza); | 154 buzz::XmlElement* stanza = reply.ToXml(original_stanza); |
155 signal_strategy_->SendStanza(stanza); | 155 signal_strategy_->SendStanza(stanza); |
156 } | 156 } |
157 | 157 |
158 void PepperSessionManager::SessionDestroyed(PepperSession* session) { | 158 void PepperSessionManager::SessionDestroyed(PepperSession* session) { |
159 sessions_.erase(session->session_id_); | 159 sessions_.erase(session->session_id_); |
160 } | 160 } |
161 | 161 |
162 } // namespace protocol | 162 } // namespace protocol |
163 } // namespace remoting | 163 } // namespace remoting |
OLD | NEW |