| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_HOST_HOST_PORT_ALLOCATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_NATIVE_PORT_ALLOCATOR_H_ |
| 6 #define REMOTING_HOST_HOST_PORT_ALLOCATOR_H_ | 6 #define REMOTING_PROTOCOL_NATIVE_PORT_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" | 12 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 class URLRequestContextGetter; | 15 class URLRequestContextGetter; |
| 16 } // namespace net | 16 } // namespace net |
| 17 | 17 |
| 18 namespace remoting { | 18 namespace remoting { |
| 19 | 19 |
| 20 namespace protocol { |
| 21 |
| 20 struct NetworkSettings; | 22 struct NetworkSettings; |
| 21 | 23 |
| 22 // An implementation of cricket::PortAllocator for libjingle that is | 24 // An implementation of cricket::PortAllocator for libjingle that is |
| 23 // used by the remoting host. The main difference from | 25 // used by the remoting host. The main difference from |
| 24 // cricket::HttpPortAllocator is that it uses Chromium's HTTP stack | 26 // cricket::HttpPortAllocator is that it uses Chromium's HTTP stack |
| 25 // when creating relay sessions. It also configures itself according | 27 // when creating relay sessions. It also configures itself according |
| 26 // to the specified NetworkSettings. | 28 // to the specified NetworkSettings. |
| 27 class HostPortAllocator : public cricket::HttpPortAllocatorBase { | 29 class NativePortAllocator : public cricket::HttpPortAllocatorBase { |
| 28 public: | 30 public: |
| 29 static scoped_ptr<HostPortAllocator> Create( | 31 static scoped_ptr<NativePortAllocator> Create( |
| 30 const scoped_refptr<net::URLRequestContextGetter>& url_context, | 32 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
| 31 const NetworkSettings& network_settings); | 33 const NetworkSettings& network_settings); |
| 32 | 34 |
| 33 virtual ~HostPortAllocator(); | 35 virtual ~NativePortAllocator(); |
| 34 | 36 |
| 35 // cricket::HttpPortAllocatorBase overrides. | 37 // cricket::HttpPortAllocatorBase overrides. |
| 36 virtual cricket::PortAllocatorSession* CreateSessionInternal( | 38 virtual cricket::PortAllocatorSession* CreateSessionInternal( |
| 37 const std::string& content_name, | 39 const std::string& content_name, |
| 38 int component, | 40 int component, |
| 39 const std::string& ice_username_fragment, | 41 const std::string& ice_username_fragment, |
| 40 const std::string& ice_password) OVERRIDE; | 42 const std::string& ice_password) OVERRIDE; |
| 41 | 43 |
| 42 private: | 44 private: |
| 43 HostPortAllocator( | 45 NativePortAllocator( |
| 44 const scoped_refptr<net::URLRequestContextGetter>& url_context, | 46 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
| 45 scoped_ptr<talk_base::NetworkManager> network_manager, | 47 scoped_ptr<talk_base::NetworkManager> network_manager, |
| 46 scoped_ptr<talk_base::PacketSocketFactory> socket_factory); | 48 scoped_ptr<talk_base::PacketSocketFactory> socket_factory); |
| 47 | 49 |
| 48 scoped_refptr<net::URLRequestContextGetter> url_context_; | 50 scoped_refptr<net::URLRequestContextGetter> url_context_; |
| 49 scoped_ptr<talk_base::NetworkManager> network_manager_; | 51 scoped_ptr<talk_base::NetworkManager> network_manager_; |
| 50 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | 52 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
| 51 | 53 |
| 52 DISALLOW_COPY_AND_ASSIGN(HostPortAllocator); | 54 DISALLOW_COPY_AND_ASSIGN(NativePortAllocator); |
| 53 }; | 55 }; |
| 54 | 56 |
| 57 } // namespace protocol |
| 58 |
| 55 } // namespace remoting | 59 } // namespace remoting |
| 56 | 60 |
| 57 #endif // REMOTING_HOST_HOST_PORT_ALLOCATOR_H_ | 61 #endif // REMOTING_HOST_HOST_PORT_ALLOCATOR_H_ |
| OLD | NEW |