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