| 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_LIBJINGLE_TRANSPORT_FACTORY_H_ | 5 #ifndef REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_ |
| 6 #define REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_ | 6 #define REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "remoting/protocol/network_settings.h" | 11 #include "remoting/protocol/network_settings.h" |
| 12 #include "remoting/protocol/transport.h" | 12 #include "remoting/protocol/transport.h" |
| 13 | 13 |
| 14 namespace cricket { | 14 namespace cricket { |
| 15 class HttpPortAllocatorBase; | 15 class HttpPortAllocatorBase; |
| 16 class PortAllocator; |
| 16 } // namespace cricket | 17 } // namespace cricket |
| 17 | 18 |
| 19 namespace net { |
| 20 class URLRequestContextGetter; |
| 21 } // namespace net |
| 22 |
| 18 namespace rtc { | 23 namespace rtc { |
| 24 class NetworkManager; |
| 25 class PacketSocketFactory; |
| 19 class SocketAddress; | 26 class SocketAddress; |
| 20 } // namespace rtc | 27 } // namespace rtc |
| 21 | 28 |
| 22 namespace remoting { | 29 namespace remoting { |
| 23 | 30 |
| 24 class SignalStrategy; | 31 class SignalStrategy; |
| 25 class JingleInfoRequest; | 32 class JingleInfoRequest; |
| 26 | 33 |
| 27 namespace protocol { | 34 namespace protocol { |
| 28 | 35 |
| 29 // TODO(sergeyu): Remove this class and move all code to IceTransportFactory. | 36 class LibjingleTransportFactory : public TransportFactory { |
| 30 class LibjingleTransportFactory { | |
| 31 public: | 37 public: |
| 32 // |signal_strategy| must outlive LibjingleTransportFactory. Need to use | 38 // |signal_strategy| must outlive LibjingleTransportFactory. Need to use |
| 33 // cricket::HttpPortAllocatorBase pointer for the |port_allocator|, so that it | 39 // cricket::HttpPortAllocatorBase pointer for the |port_allocator|, so that it |
| 34 // is possible to configure |port_allocator| with STUN/Relay addresses. | 40 // is possible to configure |port_allocator| with STUN/Relay addresses. |
| 35 LibjingleTransportFactory( | 41 LibjingleTransportFactory( |
| 36 SignalStrategy* signal_strategy, | 42 SignalStrategy* signal_strategy, |
| 37 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, | 43 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator, |
| 38 const NetworkSettings& network_settings, | 44 const NetworkSettings& network_settings, |
| 39 TransportRole role); | 45 TransportRole role); |
| 40 ~LibjingleTransportFactory(); | |
| 41 | 46 |
| 42 void PrepareTokens(); | 47 ~LibjingleTransportFactory() override; |
| 43 scoped_ptr<Transport> CreateTransport(); | 48 |
| 49 // TransportFactory interface. |
| 50 void PrepareTokens() override; |
| 51 scoped_ptr<Transport> CreateTransport() override; |
| 44 | 52 |
| 45 private: | 53 private: |
| 46 void EnsureFreshJingleInfo(); | 54 void EnsureFreshJingleInfo(); |
| 47 void OnJingleInfo(const std::string& relay_token, | 55 void OnJingleInfo(const std::string& relay_token, |
| 48 const std::vector<std::string>& relay_hosts, | 56 const std::vector<std::string>& relay_hosts, |
| 49 const std::vector<rtc::SocketAddress>& stun_hosts); | 57 const std::vector<rtc::SocketAddress>& stun_hosts); |
| 50 | 58 |
| 51 SignalStrategy* signal_strategy_; | 59 SignalStrategy* signal_strategy_; |
| 52 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator_; | 60 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator_; |
| 53 NetworkSettings network_settings_; | 61 NetworkSettings network_settings_; |
| 54 TransportRole role_; | 62 TransportRole role_; |
| 55 | 63 |
| 56 base::TimeTicks last_jingle_info_update_time_; | 64 base::TimeTicks last_jingle_info_update_time_; |
| 57 scoped_ptr<JingleInfoRequest> jingle_info_request_; | 65 scoped_ptr<JingleInfoRequest> jingle_info_request_; |
| 58 | 66 |
| 59 // When there is an active |jingle_info_request_| stores list of callbacks to | 67 // When there is an active |jingle_info_request_| stores list of callbacks to |
| 60 // be called once the |jingle_info_request_| is finished. | 68 // be called once the |jingle_info_request_| is finished. |
| 61 std::list<base::Closure> on_jingle_info_callbacks_; | 69 std::list<base::Closure> on_jingle_info_callbacks_; |
| 62 | 70 |
| 63 DISALLOW_COPY_AND_ASSIGN(LibjingleTransportFactory); | 71 DISALLOW_COPY_AND_ASSIGN(LibjingleTransportFactory); |
| 64 }; | 72 }; |
| 65 | 73 |
| 66 } // namespace protocol | 74 } // namespace protocol |
| 67 } // namespace remoting | 75 } // namespace remoting |
| 68 | 76 |
| 69 #endif // REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_ | 77 #endif // REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_ |
| OLD | NEW |