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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace protocol { | 31 namespace protocol { |
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 JingleSessionManager( | 40 virtual ~JingleSessionManager(); |
| 41 |
| 42 static JingleSessionManager* CreateNotSandboxed(); |
| 43 static JingleSessionManager* CreateSandboxed( |
41 talk_base::NetworkManager* network_manager, | 44 talk_base::NetworkManager* network_manager, |
42 talk_base::PacketSocketFactory* socket_factory, | 45 talk_base::PacketSocketFactory* socket_factory, |
43 PortAllocatorSessionFactory* port_allocator_session_factory); | 46 PortAllocatorSessionFactory* port_allocator_session_factory); |
44 virtual ~JingleSessionManager(); | |
45 | 47 |
46 // SessionManager interface. | 48 // SessionManager interface. |
47 virtual void Init(const std::string& local_jid, | 49 virtual void Init(const std::string& local_jid, |
48 SignalStrategy* signal_strategy, | 50 SignalStrategy* signal_strategy, |
49 IncomingSessionCallback* incoming_session_callback, | 51 IncomingSessionCallback* incoming_session_callback, |
50 crypto::RSAPrivateKey* private_key, | 52 crypto::RSAPrivateKey* private_key, |
51 scoped_refptr<net::X509Certificate> certificate) OVERRIDE; | 53 scoped_refptr<net::X509Certificate> certificate) OVERRIDE; |
52 virtual Session* Connect( | 54 virtual Session* Connect( |
53 const std::string& host_jid, | 55 const std::string& host_jid, |
54 const std::string& host_public_key, | 56 const std::string& host_public_key, |
(...skipping 14 matching lines...) Expand all Loading... |
69 const cricket::ContentDescription** content, | 71 const cricket::ContentDescription** content, |
70 cricket::ParseError* error) OVERRIDE; | 72 cricket::ParseError* error) OVERRIDE; |
71 virtual bool WriteContent(cricket::SignalingProtocol protocol, | 73 virtual bool WriteContent(cricket::SignalingProtocol protocol, |
72 const cricket::ContentDescription* content, | 74 const cricket::ContentDescription* content, |
73 buzz::XmlElement** elem, | 75 buzz::XmlElement** elem, |
74 cricket::WriteError* error) OVERRIDE; | 76 cricket::WriteError* error) OVERRIDE; |
75 | 77 |
76 private: | 78 private: |
77 friend class JingleSession; | 79 friend class JingleSession; |
78 | 80 |
| 81 JingleSessionManager( |
| 82 talk_base::NetworkManager* network_manager, |
| 83 talk_base::PacketSocketFactory* socket_factory, |
| 84 PortAllocatorSessionFactory* port_allocator_session_factory); |
| 85 |
79 // Called by JingleSession when a new connection is | 86 // Called by JingleSession when a new connection is |
80 // initiated. Returns true if session is accepted. | 87 // initiated. Returns true if session is accepted. |
81 bool AcceptConnection(JingleSession* jingle_session, | 88 bool AcceptConnection(JingleSession* jingle_session, |
82 cricket::Session* cricket_session); | 89 cricket::Session* cricket_session); |
83 | 90 |
84 // Called by JingleSession when it is being destroyed. | 91 // Called by JingleSession when it is being destroyed. |
85 void SessionDestroyed(JingleSession* jingle_session); | 92 void SessionDestroyed(JingleSession* jingle_session); |
86 | 93 |
87 void DoConnect( | |
88 JingleSession* jingle_session, | |
89 const std::string& host_jid, | |
90 const std::string& host_public_key, | |
91 const std::string& client_token, | |
92 Session::StateChangeCallback* state_change_callback); | |
93 | |
94 // Callback for JingleInfoRequest. | 94 // Callback for JingleInfoRequest. |
95 void OnJingleInfo( | 95 void OnJingleInfo( |
96 const std::string& token, | 96 const std::string& token, |
97 const std::vector<std::string>& relay_hosts, | 97 const std::vector<std::string>& relay_hosts, |
98 const std::vector<talk_base::SocketAddress>& stun_hosts); | 98 const std::vector<talk_base::SocketAddress>& stun_hosts); |
99 | 99 |
100 // Creates cricket::SessionManager. | 100 // Creates cricket::SessionManager. |
101 void DoStartSessionManager(); | 101 void DoStartSessionManager(); |
102 | 102 |
103 // Creates session description for outgoing session. | 103 // Creates session description for outgoing session. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 ScopedRunnableMethodFactory<JingleSessionManager> task_factory_; | 140 ScopedRunnableMethodFactory<JingleSessionManager> task_factory_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); | 142 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); |
143 }; | 143 }; |
144 | 144 |
145 } // namespace protocol | 145 } // namespace protocol |
146 } // namespace remoting | 146 } // namespace remoting |
147 | 147 |
148 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ | 148 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_MANAGER_H_ |
OLD | NEW |