Introduced IDR_SIGNIN_INTERNALS_INDEX_* strings to grit_whitelist.txt
[chromium-blink-merge.git] / remoting / protocol / libjingle_transport_factory.h
blob5c399bb7765701491e5aa02a4c6358efcf1912b4
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_
8 #include "remoting/protocol/transport.h"
10 namespace cricket {
11 class HttpPortAllocatorBase;
12 class PortAllocator;
13 } // namespace cricket
15 namespace net {
16 class URLRequestContextGetter;
17 } // namespace net
19 namespace talk_base {
20 class NetworkManager;
21 class PacketSocketFactory;
22 } // namespace talk_base
24 namespace remoting {
26 struct NetworkSettings;
28 namespace protocol {
30 class LibjingleTransportFactory : public TransportFactory {
31 public:
32 // Creates an instance of the class using ChromiumPortAllocator.
33 // Must be called from an IO thread.
34 static scoped_ptr<LibjingleTransportFactory> Create(
35 const NetworkSettings& network_settings,
36 const scoped_refptr<net::URLRequestContextGetter>&
37 url_request_context_getter);
39 // Need to use cricket::HttpPortAllocatorBase pointer for the
40 // |port_allocator|, so that it is possible to configure
41 // |port_allocator| with STUN/Relay addresses.
42 // TODO(sergeyu): Reconsider this design.
43 LibjingleTransportFactory(
44 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator,
45 bool incoming_only);
47 // Creates BasicNetworkManager, ChromiumPacketSocketFactory and
48 // BasicPortAllocator.
49 LibjingleTransportFactory();
51 virtual ~LibjingleTransportFactory();
53 // TransportFactory interface.
54 virtual void SetTransportConfig(const TransportConfig& config) OVERRIDE;
55 virtual scoped_ptr<StreamTransport> CreateStreamTransport() OVERRIDE;
56 virtual scoped_ptr<DatagramTransport> CreateDatagramTransport() OVERRIDE;
58 private:
59 scoped_ptr<talk_base::NetworkManager> network_manager_;
60 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_;
61 // Points to the same port allocator as |port_allocator_| or NULL if
62 // |port_allocator_| is not HttpPortAllocatorBase.
63 cricket::HttpPortAllocatorBase* http_port_allocator_;
64 scoped_ptr<cricket::PortAllocator> port_allocator_;
65 bool incoming_only_;
67 DISALLOW_COPY_AND_ASSIGN(LibjingleTransportFactory);
70 } // namespace protocol
71 } // namespace remoting
73 #endif // REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_