| 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_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 <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // This class implements SessionClient for Chromoting sessions. It acts as a | 33 // This class implements SessionClient for Chromoting sessions. It acts as a |
| 34 // server that accepts chromoting connections and can also make new connections | 34 // server that accepts chromoting connections and can also make new connections |
| 35 // to other hosts. | 35 // to other hosts. |
| 36 class JingleSessionManager | 36 class JingleSessionManager |
| 37 : public SessionManager, | 37 : public SessionManager, |
| 38 public cricket::SessionClient { | 38 public cricket::SessionClient { |
| 39 public: | 39 public: |
| 40 virtual ~JingleSessionManager(); | 40 virtual ~JingleSessionManager(); |
| 41 | 41 |
| 42 static JingleSessionManager* CreateNotSandboxed(); | 42 static JingleSessionManager* CreateNotSandboxed( |
| 43 base::MessageLoopProxy* message_loop); |
| 43 static JingleSessionManager* CreateSandboxed( | 44 static JingleSessionManager* CreateSandboxed( |
| 45 base::MessageLoopProxy* message_loop, |
| 44 talk_base::NetworkManager* network_manager, | 46 talk_base::NetworkManager* network_manager, |
| 45 talk_base::PacketSocketFactory* socket_factory, | 47 talk_base::PacketSocketFactory* socket_factory, |
| 46 HostResolverFactory* host_resolver_factory, | 48 HostResolverFactory* host_resolver_factory, |
| 47 PortAllocatorSessionFactory* port_allocator_session_factory); | 49 PortAllocatorSessionFactory* port_allocator_session_factory); |
| 48 | 50 |
| 49 // SessionManager interface. | 51 // SessionManager interface. |
| 50 virtual void Init(const std::string& local_jid, | 52 virtual void Init(const std::string& local_jid, |
| 51 SignalStrategy* signal_strategy, | 53 SignalStrategy* signal_strategy, |
| 52 Listener* listener, | 54 Listener* listener, |
| 53 crypto::RSAPrivateKey* private_key, | 55 crypto::RSAPrivateKey* private_key, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 74 cricket::ParseError* error) OVERRIDE; | 76 cricket::ParseError* error) OVERRIDE; |
| 75 virtual bool WriteContent(cricket::SignalingProtocol protocol, | 77 virtual bool WriteContent(cricket::SignalingProtocol protocol, |
| 76 const cricket::ContentDescription* content, | 78 const cricket::ContentDescription* content, |
| 77 buzz::XmlElement** elem, | 79 buzz::XmlElement** elem, |
| 78 cricket::WriteError* error) OVERRIDE; | 80 cricket::WriteError* error) OVERRIDE; |
| 79 | 81 |
| 80 private: | 82 private: |
| 81 friend class JingleSession; | 83 friend class JingleSession; |
| 82 | 84 |
| 83 JingleSessionManager( | 85 JingleSessionManager( |
| 86 base::MessageLoopProxy* message_loop, |
| 84 talk_base::NetworkManager* network_manager, | 87 talk_base::NetworkManager* network_manager, |
| 85 talk_base::PacketSocketFactory* socket_factory, | 88 talk_base::PacketSocketFactory* socket_factory, |
| 86 HostResolverFactory* host_resolver_factory, | 89 HostResolverFactory* host_resolver_factory, |
| 87 PortAllocatorSessionFactory* port_allocator_session_factory); | 90 PortAllocatorSessionFactory* port_allocator_session_factory); |
| 88 | 91 |
| 89 // Called by JingleSession when a new connection is | 92 // Called by JingleSession when a new connection is |
| 90 // initiated. Returns true if session is accepted. | 93 // initiated. Returns true if session is accepted. |
| 91 bool AcceptConnection(JingleSession* jingle_session, | 94 bool AcceptConnection(JingleSession* jingle_session, |
| 92 cricket::Session* cricket_session); | 95 cricket::Session* cricket_session); |
| 93 | 96 |
| 94 // Called by JingleSession when it is being destroyed. | 97 // Called by JingleSession when it is being destroyed. |
| 95 void SessionDestroyed(JingleSession* jingle_session); | 98 void SessionDestroyed(JingleSession* jingle_session); |
| 96 | 99 |
| 97 // Callback for JingleInfoRequest. | 100 // Callback for JingleInfoRequest. |
| 98 void OnJingleInfo( | 101 void OnJingleInfo( |
| 99 const std::string& token, | 102 const std::string& token, |
| 100 const std::vector<std::string>& relay_hosts, | 103 const std::vector<std::string>& relay_hosts, |
| 101 const std::vector<talk_base::SocketAddress>& stun_hosts); | 104 const std::vector<talk_base::SocketAddress>& stun_hosts); |
| 102 | 105 |
| 103 // Creates session description for outgoing session. | 106 // Creates session description for outgoing session. |
| 104 static cricket::SessionDescription* CreateClientSessionDescription( | 107 static cricket::SessionDescription* CreateClientSessionDescription( |
| 105 const CandidateSessionConfig* candidate_config, | 108 const CandidateSessionConfig* candidate_config, |
| 106 const std::string& auth_token); | 109 const std::string& auth_token); |
| 107 // Creates session description for incoming session. | 110 // Creates session description for incoming session. |
| 108 static cricket::SessionDescription* CreateHostSessionDescription( | 111 static cricket::SessionDescription* CreateHostSessionDescription( |
| 109 const CandidateSessionConfig* candidate_config, | 112 const CandidateSessionConfig* candidate_config, |
| 110 const std::string& certificate); | 113 const std::string& certificate); |
| 111 | 114 |
| 115 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 116 |
| 112 scoped_ptr<talk_base::NetworkManager> network_manager_; | 117 scoped_ptr<talk_base::NetworkManager> network_manager_; |
| 113 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | 118 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
| 114 scoped_ptr<HostResolverFactory> host_resolver_factory_; | 119 scoped_ptr<HostResolverFactory> host_resolver_factory_; |
| 115 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; | 120 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; |
| 116 | 121 |
| 117 std::string local_jid_; // Full jid for the local side of the session. | 122 std::string local_jid_; // Full jid for the local side of the session. |
| 118 SignalStrategy* signal_strategy_; | 123 SignalStrategy* signal_strategy_; |
| 119 Listener* listener_; | 124 Listener* listener_; |
| 120 std::string certificate_; | 125 std::string certificate_; |
| 121 scoped_ptr<crypto::RSAPrivateKey> private_key_; | 126 scoped_ptr<crypto::RSAPrivateKey> private_key_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 135 | 140 |
| 136 ScopedRunnableMethodFactory<JingleSessionManager> task_factory_; | 141 ScopedRunnableMethodFactory<JingleSessionManager> task_factory_; |
| 137 | 142 |
| 138 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); | 143 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); |
| 139 }; | 144 }; |
| 140 | 145 |
| 141 } // namespace protocol | 146 } // namespace protocol |
| 142 } // namespace remoting | 147 } // namespace remoting |
| 143 | 148 |
| 144 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ | 149 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ |
| OLD | NEW |