OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/jingle_glue/chromium_port_allocator.h" | 5 #include "remoting/protocol/chromium_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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/http/http_status_code.h" | 10 #include "net/http/http_status_code.h" |
11 #include "net/url_request/url_fetcher.h" | 11 #include "net/url_request/url_fetcher.h" |
12 #include "net/url_request/url_fetcher_delegate.h" | 12 #include "net/url_request/url_fetcher_delegate.h" |
13 #include "net/url_request/url_request_context_getter.h" | 13 #include "net/url_request/url_request_context_getter.h" |
14 #include "remoting/jingle_glue/chromium_socket_factory.h" | 14 #include "remoting/protocol/chromium_socket_factory.h" |
15 #include "remoting/jingle_glue/network_settings.h" | 15 #include "remoting/protocol/network_settings.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
| 19 namespace protocol { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 class ChromiumPortAllocatorSession | 23 class ChromiumPortAllocatorSession |
23 : public cricket::HttpPortAllocatorSessionBase, | 24 : public cricket::HttpPortAllocatorSessionBase, |
24 public net::URLFetcherDelegate { | 25 public net::URLFetcherDelegate { |
25 public: | 26 public: |
26 ChromiumPortAllocatorSession( | 27 ChromiumPortAllocatorSession( |
27 cricket::HttpPortAllocatorBase* allocator, | 28 cricket::HttpPortAllocatorBase* allocator, |
28 const std::string& content_name, | 29 const std::string& content_name, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 } // namespace | 130 } // namespace |
130 | 131 |
131 // static | 132 // static |
132 scoped_ptr<ChromiumPortAllocator> ChromiumPortAllocator::Create( | 133 scoped_ptr<ChromiumPortAllocator> ChromiumPortAllocator::Create( |
133 const scoped_refptr<net::URLRequestContextGetter>& url_context, | 134 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
134 const NetworkSettings& network_settings) { | 135 const NetworkSettings& network_settings) { |
135 scoped_ptr<talk_base::NetworkManager> network_manager( | 136 scoped_ptr<talk_base::NetworkManager> network_manager( |
136 new talk_base::BasicNetworkManager()); | 137 new talk_base::BasicNetworkManager()); |
137 scoped_ptr<talk_base::PacketSocketFactory> socket_factory( | 138 scoped_ptr<talk_base::PacketSocketFactory> socket_factory( |
138 new remoting::ChromiumPacketSocketFactory()); | 139 new ChromiumPacketSocketFactory()); |
139 scoped_ptr<ChromiumPortAllocator> result( | 140 scoped_ptr<ChromiumPortAllocator> result( |
140 new ChromiumPortAllocator(url_context, network_manager.Pass(), | 141 new ChromiumPortAllocator(url_context, network_manager.Pass(), |
141 socket_factory.Pass())); | 142 socket_factory.Pass())); |
142 | 143 |
143 // We always use PseudoTcp to provide a reliable channel. It provides poor | 144 // We always use PseudoTcp to provide a reliable channel. It provides poor |
144 // performance when combined with TCP-based transport, so we have to disable | 145 // performance when combined with TCP-based transport, so we have to disable |
145 // TCP ports. ENABLE_SHARED_UFRAG flag is specified so that the same username | 146 // TCP ports. ENABLE_SHARED_UFRAG flag is specified so that the same username |
146 // fragment is shared between all candidates for this channel. | 147 // fragment is shared between all candidates for this channel. |
147 int flags = cricket::PORTALLOCATOR_DISABLE_TCP | | 148 int flags = cricket::PORTALLOCATOR_DISABLE_TCP | |
148 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG | | 149 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG | |
(...skipping 29 matching lines...) Expand all Loading... |
178 cricket::PortAllocatorSession* ChromiumPortAllocator::CreateSessionInternal( | 179 cricket::PortAllocatorSession* ChromiumPortAllocator::CreateSessionInternal( |
179 const std::string& content_name, | 180 const std::string& content_name, |
180 int component, | 181 int component, |
181 const std::string& ice_username_fragment, | 182 const std::string& ice_username_fragment, |
182 const std::string& ice_password) { | 183 const std::string& ice_password) { |
183 return new ChromiumPortAllocatorSession( | 184 return new ChromiumPortAllocatorSession( |
184 this, content_name, component, ice_username_fragment, ice_password, | 185 this, content_name, component, ice_username_fragment, ice_password, |
185 stun_hosts(), relay_hosts(), relay_token(), url_context_); | 186 stun_hosts(), relay_hosts(), relay_token(), url_context_); |
186 } | 187 } |
187 | 188 |
| 189 } // namespace protocol |
188 } // namespace remoting | 190 } // namespace remoting |
OLD | NEW |