| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_H_ | |
| 6 #define REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "remoting/protocol/port_allocator_base.h" | |
| 14 #include "remoting/protocol/port_allocator_factory.h" | |
| 15 | |
| 16 namespace net { | |
| 17 class URLRequestContextGetter; | |
| 18 } // namespace net | |
| 19 | |
| 20 namespace remoting { | |
| 21 namespace protocol { | |
| 22 | |
| 23 struct NetworkSettings; | |
| 24 | |
| 25 // An implementation of cricket::PortAllocator that uses Chromium's network | |
| 26 // stack. | |
| 27 class ChromiumPortAllocator : public PortAllocatorBase { | |
| 28 public: | |
| 29 ChromiumPortAllocator( | |
| 30 scoped_ptr<rtc::NetworkManager> network_manager, | |
| 31 scoped_ptr<rtc::PacketSocketFactory> socket_factory, | |
| 32 scoped_refptr<TransportContext> transport_context, | |
| 33 scoped_refptr<net::URLRequestContextGetter> url_context); | |
| 34 ~ChromiumPortAllocator() override; | |
| 35 | |
| 36 scoped_refptr<net::URLRequestContextGetter> url_context() { | |
| 37 return url_context_; | |
| 38 } | |
| 39 | |
| 40 // PortAllocatorBase overrides. | |
| 41 cricket::PortAllocatorSession* CreateSessionInternal( | |
| 42 const std::string& content_name, | |
| 43 int component, | |
| 44 const std::string& ice_username_fragment, | |
| 45 const std::string& ice_password) override; | |
| 46 | |
| 47 private: | |
| 48 scoped_refptr<net::URLRequestContextGetter> url_context_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(ChromiumPortAllocator); | |
| 51 }; | |
| 52 | |
| 53 class ChromiumPortAllocatorFactory : public PortAllocatorFactory { | |
| 54 public: | |
| 55 ChromiumPortAllocatorFactory( | |
| 56 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); | |
| 57 ~ChromiumPortAllocatorFactory() override; | |
| 58 | |
| 59 // PortAllocatorFactory interface. | |
| 60 scoped_ptr<cricket::PortAllocator> CreatePortAllocator( | |
| 61 scoped_refptr<TransportContext> transport_context) override; | |
| 62 | |
| 63 private: | |
| 64 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(ChromiumPortAllocatorFactory); | |
| 67 }; | |
| 68 | |
| 69 } // namespace protocol | |
| 70 } // namespace remoting | |
| 71 | |
| 72 #endif // REMOTING_HOST_HOST_PORT_ALLOCATOR_H_ | |
| OLD | NEW |