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(SignalStrategy* signal_strategy) |
24 scoped_ptr<TransportFactory> transport_factory, | 24 : signal_strategy_(signal_strategy), |
25 SignalStrategy* signal_strategy) | |
26 : transport_factory_(std::move(transport_factory)), | |
27 signal_strategy_(signal_strategy), | |
28 protocol_config_(CandidateSessionConfig::CreateDefault()), | 25 protocol_config_(CandidateSessionConfig::CreateDefault()), |
29 iq_sender_(new IqSender(signal_strategy_)) { | 26 iq_sender_(new IqSender(signal_strategy_)) { |
30 signal_strategy_->AddListener(this); | 27 signal_strategy_->AddListener(this); |
31 } | 28 } |
32 | 29 |
33 JingleSessionManager::~JingleSessionManager() { | 30 JingleSessionManager::~JingleSessionManager() { |
34 DCHECK(sessions_.empty()); | 31 DCHECK(sessions_.empty()); |
35 signal_strategy_->RemoveListener(this); | 32 signal_strategy_->RemoveListener(this); |
36 } | 33 } |
37 | 34 |
38 void JingleSessionManager::AcceptIncoming( | 35 void JingleSessionManager::AcceptIncoming( |
39 const IncomingSessionCallback& incoming_session_callback) { | 36 const IncomingSessionCallback& incoming_session_callback) { |
40 incoming_session_callback_ = incoming_session_callback; | 37 incoming_session_callback_ = incoming_session_callback; |
41 | |
42 } | 38 } |
43 | 39 |
44 void JingleSessionManager::set_protocol_config( | 40 void JingleSessionManager::set_protocol_config( |
45 scoped_ptr<CandidateSessionConfig> config) { | 41 scoped_ptr<CandidateSessionConfig> config) { |
46 protocol_config_ = std::move(config); | 42 protocol_config_ = std::move(config); |
47 } | 43 } |
48 | 44 |
49 scoped_ptr<Session> JingleSessionManager::Connect( | 45 scoped_ptr<Session> JingleSessionManager::Connect( |
50 const std::string& host_jid, | 46 const std::string& host_jid, |
51 scoped_ptr<Authenticator> authenticator) { | 47 scoped_ptr<Authenticator> authenticator) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 signal_strategy_->SendStanza( | 140 signal_strategy_->SendStanza( |
145 JingleMessageReply(error).ToXml(original_stanza)); | 141 JingleMessageReply(error).ToXml(original_stanza)); |
146 } | 142 } |
147 | 143 |
148 void JingleSessionManager::SessionDestroyed(JingleSession* session) { | 144 void JingleSessionManager::SessionDestroyed(JingleSession* session) { |
149 sessions_.erase(session->session_id_); | 145 sessions_.erase(session->session_id_); |
150 } | 146 } |
151 | 147 |
152 } // namespace protocol | 148 } // namespace protocol |
153 } // namespace remoting | 149 } // namespace remoting |
OLD | NEW |