| 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 #include "remoting/host/host_port_allocator.h" | 5 #include "remoting/host/host_port_allocator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "net/http/http_status_code.h" | 11 #include "net/http/http_status_code.h" |
| 12 #include "net/url_request/url_fetcher.h" | 12 #include "net/url_request/url_fetcher.h" |
| 13 #include "net/url_request/url_fetcher_delegate.h" | 13 #include "net/url_request/url_fetcher_delegate.h" |
| 14 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
| 15 #include "remoting/host/network_settings.h" | 15 #include "remoting/host/network_settings.h" |
| 16 #include "third_party/libjingle/source/talk/base/basicpacketsocketfactory.h" | 16 #include "remoting/jingle_glue/chromium_socket_factory.h" |
| 17 | 17 |
| 18 namespace remoting { | 18 namespace remoting { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class HostPortAllocatorSession | 22 class HostPortAllocatorSession |
| 23 : public cricket::HttpPortAllocatorSessionBase, | 23 : public cricket::HttpPortAllocatorSessionBase, |
| 24 public net::URLFetcherDelegate { | 24 public net::URLFetcherDelegate { |
| 25 public: | 25 public: |
| 26 HostPortAllocatorSession( | 26 HostPortAllocatorSession( |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 } // namespace | 122 } // namespace |
| 123 | 123 |
| 124 // static | 124 // static |
| 125 scoped_ptr<HostPortAllocator> HostPortAllocator::Create( | 125 scoped_ptr<HostPortAllocator> HostPortAllocator::Create( |
| 126 const scoped_refptr<net::URLRequestContextGetter>& url_context, | 126 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
| 127 const NetworkSettings& network_settings) { | 127 const NetworkSettings& network_settings) { |
| 128 scoped_ptr<talk_base::NetworkManager> network_manager( | 128 scoped_ptr<talk_base::NetworkManager> network_manager( |
| 129 new talk_base::BasicNetworkManager()); | 129 new talk_base::BasicNetworkManager()); |
| 130 scoped_ptr<talk_base::PacketSocketFactory> socket_factory( | 130 scoped_ptr<talk_base::PacketSocketFactory> socket_factory( |
| 131 new talk_base::BasicPacketSocketFactory()); | 131 new remoting::ChromiumPacketSocketFactory()); |
| 132 scoped_ptr<HostPortAllocator> result( | 132 scoped_ptr<HostPortAllocator> result( |
| 133 new HostPortAllocator(url_context, network_manager.Pass(), | 133 new HostPortAllocator(url_context, network_manager.Pass(), |
| 134 socket_factory.Pass())); | 134 socket_factory.Pass())); |
| 135 | 135 |
| 136 // We always use PseudoTcp to provide a reliable channel. It | 136 // We always use PseudoTcp to provide a reliable channel. It |
| 137 // provides poor performance when combined with TCP-based transport, | 137 // provides poor performance when combined with TCP-based transport, |
| 138 // so we have to disable TCP ports. | 138 // so we have to disable TCP ports. |
| 139 // ENABLE_SHARED_UFRAG flag is | 139 // ENABLE_SHARED_UFRAG flag is |
| 140 // specified so that the same username fragment is shared between | 140 // specified so that the same username fragment is shared between |
| 141 // all candidates for this channel. | 141 // all candidates for this channel. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 170 const std::string& content_name, | 170 const std::string& content_name, |
| 171 int component, | 171 int component, |
| 172 const std::string& ice_username_fragment, | 172 const std::string& ice_username_fragment, |
| 173 const std::string& ice_password) { | 173 const std::string& ice_password) { |
| 174 return new HostPortAllocatorSession( | 174 return new HostPortAllocatorSession( |
| 175 this, content_name, component, ice_username_fragment, ice_password, | 175 this, content_name, component, ice_username_fragment, ice_password, |
| 176 stun_hosts(), relay_hosts(), relay_token(), url_context_); | 176 stun_hosts(), relay_hosts(), relay_token(), url_context_); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace remoting | 179 } // namespace remoting |
| OLD | NEW |