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 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ | 5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ |
6 #define REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ | 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 class JingleSession; | 26 class JingleSession; |
27 class TransportFactory; | 27 class TransportFactory; |
28 | 28 |
29 // JingleSessionManager and JingleSession implement the subset of the | 29 // JingleSessionManager and JingleSession implement the subset of the |
30 // Jingle protocol used in Chromoting. JingleSessionManager provides | 30 // Jingle protocol used in Chromoting. JingleSessionManager provides |
31 // the protocol::SessionManager interface for accepting incoming and | 31 // the protocol::SessionManager interface for accepting incoming and |
32 // creating outgoing sessions. | 32 // creating outgoing sessions. |
33 class JingleSessionManager : public SessionManager, | 33 class JingleSessionManager : public SessionManager, |
34 public SignalStrategy::Listener { | 34 public SignalStrategy::Listener { |
35 public: | 35 public: |
36 JingleSessionManager(scoped_ptr<TransportFactory> transport_factory, | 36 explicit JingleSessionManager(SignalStrategy* signal_strategy); |
37 SignalStrategy* signal_strategy); | |
38 ~JingleSessionManager() override; | 37 ~JingleSessionManager() override; |
39 | 38 |
40 // SessionManager interface. | 39 // SessionManager interface. |
41 void AcceptIncoming( | 40 void AcceptIncoming( |
42 const IncomingSessionCallback& incoming_session_callback) override; | 41 const IncomingSessionCallback& incoming_session_callback) override; |
43 void set_protocol_config(scoped_ptr<CandidateSessionConfig> config) override; | 42 void set_protocol_config(scoped_ptr<CandidateSessionConfig> config) override; |
44 scoped_ptr<Session> Connect( | 43 scoped_ptr<Session> Connect( |
45 const std::string& host_jid, | 44 const std::string& host_jid, |
46 scoped_ptr<Authenticator> authenticator) override; | 45 scoped_ptr<Authenticator> authenticator) override; |
47 void set_authenticator_factory( | 46 void set_authenticator_factory( |
48 scoped_ptr<AuthenticatorFactory> authenticator_factory) override; | 47 scoped_ptr<AuthenticatorFactory> authenticator_factory) override; |
49 | 48 |
50 private: | 49 private: |
51 friend class JingleSession; | 50 friend class JingleSession; |
52 | 51 |
53 // SignalStrategy::Listener interface. | 52 // SignalStrategy::Listener interface. |
54 void OnSignalStrategyStateChange(SignalStrategy::State state) override; | 53 void OnSignalStrategyStateChange(SignalStrategy::State state) override; |
55 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; | 54 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; |
56 | 55 |
57 typedef std::map<std::string, JingleSession*> SessionsMap; | 56 typedef std::map<std::string, JingleSession*> SessionsMap; |
58 | 57 |
59 IqSender* iq_sender() { return iq_sender_.get(); } | 58 IqSender* iq_sender() { return iq_sender_.get(); } |
60 void SendReply(const buzz::XmlElement* original_stanza, | 59 void SendReply(const buzz::XmlElement* original_stanza, |
61 JingleMessageReply::ErrorType error); | 60 JingleMessageReply::ErrorType error); |
62 | 61 |
63 // Called by JingleSession when it is being destroyed. | 62 // Called by JingleSession when it is being destroyed. |
64 void SessionDestroyed(JingleSession* session); | 63 void SessionDestroyed(JingleSession* session); |
65 | 64 |
66 scoped_ptr<TransportFactory> transport_factory_; | 65 SignalStrategy* signal_strategy_ = nullptr; |
67 SignalStrategy* signal_strategy_; | |
68 IncomingSessionCallback incoming_session_callback_; | 66 IncomingSessionCallback incoming_session_callback_; |
69 scoped_ptr<CandidateSessionConfig> protocol_config_; | 67 scoped_ptr<CandidateSessionConfig> protocol_config_; |
70 | 68 |
71 scoped_ptr<AuthenticatorFactory> authenticator_factory_; | 69 scoped_ptr<AuthenticatorFactory> authenticator_factory_; |
72 scoped_ptr<IqSender> iq_sender_; | 70 scoped_ptr<IqSender> iq_sender_; |
73 | 71 |
74 SessionsMap sessions_; | 72 SessionsMap sessions_; |
75 | 73 |
76 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); | 74 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); |
77 }; | 75 }; |
78 | 76 |
79 } // namespace protocol | 77 } // namespace protocol |
80 } // namespace remoting | 78 } // namespace remoting |
81 | 79 |
82 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ | 80 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ |
OLD | NEW |