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
3 // found in the LICENSE file.
5 #ifndef REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_
6 #define REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_
10 #include "base/callback_forward.h"
11 #include "remoting/protocol/network_settings.h"
12 #include "remoting/protocol/transport.h"
15 class HttpPortAllocatorBase
;
17 } // namespace cricket
20 class URLRequestContextGetter
;
25 class PacketSocketFactory
;
32 class JingleInfoRequest
;
36 class LibjingleTransportFactory
: public TransportFactory
{
38 // |signal_strategy| must outlive LibjingleTransportFactory. Need to use
39 // cricket::HttpPortAllocatorBase pointer for the |port_allocator|, so that it
40 // is possible to configure |port_allocator| with STUN/Relay addresses.
41 LibjingleTransportFactory(
42 SignalStrategy
* signal_strategy
,
43 scoped_ptr
<cricket::HttpPortAllocatorBase
> port_allocator
,
44 const NetworkSettings
& network_settings
);
46 ~LibjingleTransportFactory() override
;
48 // TransportFactory interface.
49 void PrepareTokens() override
;
50 scoped_ptr
<Transport
> CreateTransport() override
;
53 void EnsureFreshJingleInfo();
54 void OnJingleInfo(const std::string
& relay_token
,
55 const std::vector
<std::string
>& relay_hosts
,
56 const std::vector
<rtc::SocketAddress
>& stun_hosts
);
58 SignalStrategy
* signal_strategy_
;
59 scoped_ptr
<cricket::HttpPortAllocatorBase
> port_allocator_
;
60 NetworkSettings network_settings_
;
62 base::TimeTicks last_jingle_info_update_time_
;
63 scoped_ptr
<JingleInfoRequest
> jingle_info_request_
;
65 // When there is an active |jingle_info_request_| stores list of callbacks to
66 // be called once the |jingle_info_request_| is finished.
67 std::list
<base::Closure
> on_jingle_info_callbacks_
;
69 DISALLOW_COPY_AND_ASSIGN(LibjingleTransportFactory
);
72 } // namespace protocol
73 } // namespace remoting
75 #endif // REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_