OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ICE_TRANSPORT_FACTORY_H_ | 5 #ifndef REMOTING_PROTOCOL_ICE_TRANSPORT_FACTORY_H_ |
6 #define REMOTING_PROTOCOL_ICE_TRANSPORT_FACTORY_H_ | 6 #define REMOTING_PROTOCOL_ICE_TRANSPORT_FACTORY_H_ |
7 | 7 |
| 8 #include <list> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "remoting/protocol/network_settings.h" | 11 #include "remoting/protocol/network_settings.h" |
10 #include "remoting/protocol/transport.h" | 12 #include "remoting/protocol/transport.h" |
| 13 #include "remoting/signaling/jingle_info_request.h" |
11 | 14 |
12 namespace cricket { | 15 namespace cricket { |
13 class HttpPortAllocatorBase; | 16 class HttpPortAllocatorBase; |
14 } // namespace cricket | 17 } // namespace cricket |
15 | 18 |
16 namespace remoting { | 19 namespace remoting { |
17 | 20 |
18 class SignalStrategy; | 21 class SignalStrategy; |
19 | 22 |
20 namespace protocol { | 23 namespace protocol { |
21 | 24 |
22 class LibjingleTransportFactory; | |
23 | |
24 class IceTransportFactory : public TransportFactory { | 25 class IceTransportFactory : public TransportFactory { |
25 public: | 26 public: |
26 IceTransportFactory( | 27 IceTransportFactory( |
27 SignalStrategy* signal_strategy, | 28 SignalStrategy* signal_strategy, |
28 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, | 29 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, |
29 const NetworkSettings& network_settings, | 30 const NetworkSettings& network_settings, |
30 TransportRole role); | 31 TransportRole role); |
31 ~IceTransportFactory() override; | 32 ~IceTransportFactory() override; |
32 | 33 |
33 // TransportFactory interface. | 34 // TransportFactory interface. |
34 void PrepareTokens() override; | |
35 scoped_ptr<TransportSession> CreateTransportSession() override; | 35 scoped_ptr<TransportSession> CreateTransportSession() override; |
36 | 36 |
37 private: | 37 private: |
38 scoped_ptr<LibjingleTransportFactory> libjingle_transport_factory_; | 38 void EnsureFreshJingleInfo(); |
| 39 void OnJingleInfo(const std::string& relay_token, |
| 40 const std::vector<std::string>& relay_hosts, |
| 41 const std::vector<rtc::SocketAddress>& stun_hosts); |
| 42 |
| 43 SignalStrategy* signal_strategy_; |
| 44 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator_; |
| 45 NetworkSettings network_settings_; |
| 46 TransportRole role_; |
| 47 |
| 48 base::TimeTicks last_jingle_info_update_time_; |
| 49 scoped_ptr<JingleInfoRequest> jingle_info_request_; |
| 50 |
| 51 // When there is an active |jingle_info_request_| stores list of callbacks to |
| 52 // be called once the |jingle_info_request_| is finished. |
| 53 std::list<base::Closure> on_jingle_info_callbacks_; |
39 | 54 |
40 DISALLOW_COPY_AND_ASSIGN(IceTransportFactory); | 55 DISALLOW_COPY_AND_ASSIGN(IceTransportFactory); |
41 }; | 56 }; |
42 | 57 |
43 } // namespace protocol | 58 } // namespace protocol |
44 } // namespace remoting | 59 } // namespace remoting |
45 | 60 |
46 #endif // REMOTING_PROTOCOL_ICE_TRANSPORT_FACTORY_H_ | 61 #endif // REMOTING_PROTOCOL_ICE_TRANSPORT_FACTORY_H_ |
OLD | NEW |