| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PEPPER_SESSION_MANAGER_H_ | 5 #ifndef REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
| 6 #define REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ | 6 #define REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // This class implements SessionManager interface on top of the Pepper | 42 // This class implements SessionManager interface on top of the Pepper |
| 43 // P2P Transport API. | 43 // P2P Transport API. |
| 44 class PepperSessionManager : public SessionManager, | 44 class PepperSessionManager : public SessionManager, |
| 45 public SignalStrategy::Listener { | 45 public SignalStrategy::Listener { |
| 46 public: | 46 public: |
| 47 explicit PepperSessionManager(pp::Instance* pp_instance); | 47 explicit PepperSessionManager(pp::Instance* pp_instance); |
| 48 virtual ~PepperSessionManager(); | 48 virtual ~PepperSessionManager(); |
| 49 | 49 |
| 50 // SessionManager interface. | 50 // SessionManager interface. |
| 51 virtual void Init(const std::string& local_jid, | 51 virtual void Init(SignalStrategy* signal_strategy, |
| 52 SignalStrategy* signal_strategy, | |
| 53 SessionManager::Listener* listener, | 52 SessionManager::Listener* listener, |
| 54 bool allow_nat_traversal) OVERRIDE; | 53 bool allow_nat_traversal) OVERRIDE; |
| 55 virtual Session* Connect( | 54 virtual Session* Connect( |
| 56 const std::string& host_jid, | 55 const std::string& host_jid, |
| 57 Authenticator* authenticator, | 56 Authenticator* authenticator, |
| 58 CandidateSessionConfig* config, | 57 CandidateSessionConfig* config, |
| 59 const Session::StateChangeCallback& state_change_callback) OVERRIDE; | 58 const Session::StateChangeCallback& state_change_callback) OVERRIDE; |
| 60 virtual void Close() OVERRIDE; | 59 virtual void Close() OVERRIDE; |
| 61 virtual void set_authenticator_factory( | 60 virtual void set_authenticator_factory( |
| 62 AuthenticatorFactory* authenticator_factory) OVERRIDE; | 61 AuthenticatorFactory* authenticator_factory) OVERRIDE; |
| 63 | 62 |
| 64 // SignalStrategy::Listener interface. | 63 // SignalStrategy::Listener interface. |
| 65 virtual bool OnIncomingStanza(const buzz::XmlElement* stanza) OVERRIDE; | 64 virtual void OnSignalStrategyStateChange( |
| 65 SignalStrategy::State state) OVERRIDE; |
| 66 virtual bool OnSignalStrategyIncomingStanza( |
| 67 const buzz::XmlElement* stanza) OVERRIDE; |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 friend class PepperSession; | 70 friend class PepperSession; |
| 69 | 71 |
| 70 typedef std::map<std::string, PepperSession*> SessionsMap; | 72 typedef std::map<std::string, PepperSession*> SessionsMap; |
| 71 | 73 |
| 72 void OnJingleInfo( | 74 void OnJingleInfo( |
| 73 const std::string& relay_token, | 75 const std::string& relay_token, |
| 74 const std::vector<std::string>& relay_hosts, | 76 const std::vector<std::string>& relay_hosts, |
| 75 const std::vector<talk_base::SocketAddress>& stun_hosts); | 77 const std::vector<talk_base::SocketAddress>& stun_hosts); |
| 76 | 78 |
| 77 IqSender* iq_sender() { return iq_sender_.get(); } | 79 IqSender* iq_sender() { return iq_sender_.get(); } |
| 78 void SendReply(const buzz::XmlElement* original_stanza, | 80 void SendReply(const buzz::XmlElement* original_stanza, |
| 79 const JingleMessageReply& reply); | 81 const JingleMessageReply& reply); |
| 80 | 82 |
| 81 // Called by PepperSession when it is being destroyed. | 83 // Called by PepperSession when it is being destroyed. |
| 82 void SessionDestroyed(PepperSession* session); | 84 void SessionDestroyed(PepperSession* session); |
| 83 | 85 |
| 84 pp::Instance* pp_instance_; | 86 pp::Instance* pp_instance_; |
| 85 | 87 |
| 86 std::string local_jid_; | |
| 87 SignalStrategy* signal_strategy_; | 88 SignalStrategy* signal_strategy_; |
| 88 scoped_ptr<AuthenticatorFactory> authenticator_factory_; | 89 scoped_ptr<AuthenticatorFactory> authenticator_factory_; |
| 89 scoped_ptr<IqSender> iq_sender_; | 90 scoped_ptr<IqSender> iq_sender_; |
| 90 SessionManager::Listener* listener_; | 91 SessionManager::Listener* listener_; |
| 91 bool allow_nat_traversal_; | 92 bool allow_nat_traversal_; |
| 92 | 93 |
| 94 bool ready_; |
| 95 |
| 93 TransportConfig transport_config_; | 96 TransportConfig transport_config_; |
| 94 | 97 |
| 95 scoped_ptr<JingleInfoRequest> jingle_info_request_; | 98 scoped_ptr<JingleInfoRequest> jingle_info_request_; |
| 96 | 99 |
| 97 SessionsMap sessions_; | 100 SessionsMap sessions_; |
| 98 | 101 |
| 99 DISALLOW_COPY_AND_ASSIGN(PepperSessionManager); | 102 DISALLOW_COPY_AND_ASSIGN(PepperSessionManager); |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 } // namespace protocol | 105 } // namespace protocol |
| 103 } // namespace remoting | 106 } // namespace remoting |
| 104 | 107 |
| 105 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ | 108 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
| OLD | NEW |