OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef REMOTING_HOST_HOST_PORT_ALLOCATOR_H_ |
| 6 #define REMOTING_HOST_HOST_PORT_ALLOCATOR_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "remoting/host/url_fetcher.h" |
| 12 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" |
| 13 |
| 14 namespace net { |
| 15 class URLRequestContextGetter; |
| 16 } // namespace net |
| 17 |
| 18 namespace remoting { |
| 19 |
| 20 struct NetworkSettings; |
| 21 |
| 22 // An implementation of cricket::PortAllocator for libjingle that is |
| 23 // used by the remoting host. The main difference from |
| 24 // cricket::HttpPortAllocator is that it uses Chromium's HTTP stack |
| 25 // when creating relay sessions. It also configures itself according |
| 26 // to the specified NetworkSettings. |
| 27 class HostPortAllocator : public cricket::HttpPortAllocatorBase { |
| 28 public: |
| 29 static scoped_ptr<HostPortAllocator> Create( |
| 30 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
| 31 const NetworkSettings& network_settings); |
| 32 |
| 33 virtual ~HostPortAllocator(); |
| 34 |
| 35 // cricket::HttpPortAllocatorBase overrides. |
| 36 virtual cricket::PortAllocatorSession* CreateSession( |
| 37 const std::string& channel_name, |
| 38 int component) OVERRIDE; |
| 39 |
| 40 private: |
| 41 HostPortAllocator( |
| 42 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
| 43 scoped_ptr<talk_base::NetworkManager> network_manager, |
| 44 scoped_ptr<talk_base::PacketSocketFactory> socket_factory); |
| 45 |
| 46 scoped_refptr<net::URLRequestContextGetter> url_context_; |
| 47 scoped_ptr<talk_base::NetworkManager> network_manager_; |
| 48 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(HostPortAllocator); |
| 51 }; |
| 52 |
| 53 } // namespace remoting |
| 54 |
| 55 #endif // REMOTING_HOST_HOST_PORT_ALLOCATOR_H_ |
OLD | NEW |