MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / remoting / protocol / chromium_port_allocator.h
bloba2b759c18739166cafae010205dc04ddedae8911
1 // Copyright 2014 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_CHROMIUM_PORT_ALLOCATOR_H_
6 #define REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_H_
8 #include <set>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "third_party/webrtc/p2p/client/httpportallocator.h"
14 namespace net {
15 class URLRequestContextGetter;
16 } // namespace net
18 namespace remoting {
19 namespace protocol {
21 struct NetworkSettings;
23 // An implementation of cricket::PortAllocator for libjingle that
24 // uses Chromium's network stack and configures itself according
25 // to the specified NetworkSettings.
26 class ChromiumPortAllocator : public cricket::HttpPortAllocatorBase {
27 public:
28 static scoped_ptr<ChromiumPortAllocator> Create(
29 const scoped_refptr<net::URLRequestContextGetter>& url_context,
30 const NetworkSettings& network_settings);
32 ~ChromiumPortAllocator() override;
34 // cricket::HttpPortAllocatorBase overrides.
35 cricket::PortAllocatorSession* CreateSessionInternal(
36 const std::string& content_name,
37 int component,
38 const std::string& ice_username_fragment,
39 const std::string& ice_password) override;
41 private:
42 ChromiumPortAllocator(
43 const scoped_refptr<net::URLRequestContextGetter>& url_context,
44 scoped_ptr<rtc::NetworkManager> network_manager,
45 scoped_ptr<rtc::PacketSocketFactory> socket_factory);
47 scoped_refptr<net::URLRequestContextGetter> url_context_;
48 scoped_ptr<rtc::NetworkManager> network_manager_;
49 scoped_ptr<rtc::PacketSocketFactory> socket_factory_;
51 DISALLOW_COPY_AND_ASSIGN(ChromiumPortAllocator);
54 } // namespace protocol
55 } // namespace remoting
57 #endif // REMOTING_HOST_HOST_PORT_ALLOCATOR_H_