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/client/plugin/pepper_port_allocator.h" | 5 #include "remoting/client/plugin/pepper_port_allocator.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <utility> |
| 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
12 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
13 #include "ppapi/c/pp_errors.h" | 15 #include "ppapi/c/pp_errors.h" |
14 #include "ppapi/cpp/url_loader.h" | 16 #include "ppapi/cpp/url_loader.h" |
15 #include "ppapi/cpp/url_request_info.h" | 17 #include "ppapi/cpp/url_request_info.h" |
16 #include "ppapi/cpp/url_response_info.h" | 18 #include "ppapi/cpp/url_response_info.h" |
17 #include "ppapi/utility/completion_callback_factory.h" | 19 #include "ppapi/utility/completion_callback_factory.h" |
18 #include "remoting/client/plugin/pepper_network_manager.h" | 20 #include "remoting/client/plugin/pepper_network_manager.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 204 } |
203 | 205 |
204 ReadResponseBody(); | 206 ReadResponseBody(); |
205 } | 207 } |
206 | 208 |
207 } // namespace | 209 } // namespace |
208 | 210 |
209 // static | 211 // static |
210 scoped_ptr<PepperPortAllocator> PepperPortAllocator::Create( | 212 scoped_ptr<PepperPortAllocator> PepperPortAllocator::Create( |
211 const pp::InstanceHandle& instance) { | 213 const pp::InstanceHandle& instance) { |
212 scoped_ptr<rtc::NetworkManager> network_manager( | 214 return make_scoped_ptr(new PepperPortAllocator( |
213 new PepperNetworkManager(instance)); | 215 instance, make_scoped_ptr(new PepperNetworkManager(instance)), |
214 scoped_ptr<rtc::PacketSocketFactory> socket_factory( | 216 make_scoped_ptr(new PepperPacketSocketFactory(instance)))); |
215 new PepperPacketSocketFactory(instance)); | |
216 scoped_ptr<PepperPortAllocator> result(new PepperPortAllocator( | |
217 instance, network_manager.Pass(), socket_factory.Pass())); | |
218 return result.Pass(); | |
219 } | 217 } |
220 | 218 |
221 PepperPortAllocator::PepperPortAllocator( | 219 PepperPortAllocator::PepperPortAllocator( |
222 const pp::InstanceHandle& instance, | 220 const pp::InstanceHandle& instance, |
223 scoped_ptr<rtc::NetworkManager> network_manager, | 221 scoped_ptr<rtc::NetworkManager> network_manager, |
224 scoped_ptr<rtc::PacketSocketFactory> socket_factory) | 222 scoped_ptr<rtc::PacketSocketFactory> socket_factory) |
225 : HttpPortAllocatorBase(network_manager.get(), | 223 : HttpPortAllocatorBase(network_manager.get(), |
226 socket_factory.get(), | 224 socket_factory.get(), |
227 std::string()), | 225 std::string()), |
228 instance_(instance), | 226 instance_(instance), |
229 network_manager_(network_manager.Pass()), | 227 network_manager_(std::move(network_manager)), |
230 socket_factory_(socket_factory.Pass()) { | 228 socket_factory_(std::move(socket_factory)) {} |
231 } | |
232 | 229 |
233 PepperPortAllocator::~PepperPortAllocator() {} | 230 PepperPortAllocator::~PepperPortAllocator() {} |
234 | 231 |
235 cricket::PortAllocatorSession* PepperPortAllocator::CreateSessionInternal( | 232 cricket::PortAllocatorSession* PepperPortAllocator::CreateSessionInternal( |
236 const std::string& content_name, | 233 const std::string& content_name, |
237 int component, | 234 int component, |
238 const std::string& ice_username_fragment, | 235 const std::string& ice_username_fragment, |
239 const std::string& ice_password) { | 236 const std::string& ice_password) { |
240 return new PepperPortAllocatorSession( | 237 return new PepperPortAllocatorSession( |
241 this, content_name, component, ice_username_fragment, ice_password, | 238 this, content_name, component, ice_username_fragment, ice_password, |
242 stun_hosts(), relay_hosts(), relay_token(), instance_); | 239 stun_hosts(), relay_hosts(), relay_token(), instance_); |
243 } | 240 } |
244 | 241 |
245 PepperPortAllocatorFactory::PepperPortAllocatorFactory( | 242 PepperPortAllocatorFactory::PepperPortAllocatorFactory( |
246 const pp::InstanceHandle& instance) | 243 const pp::InstanceHandle& instance) |
247 : instance_(instance) {} | 244 : instance_(instance) {} |
248 | 245 |
249 PepperPortAllocatorFactory::~PepperPortAllocatorFactory() {} | 246 PepperPortAllocatorFactory::~PepperPortAllocatorFactory() {} |
250 | 247 |
251 scoped_ptr<cricket::HttpPortAllocatorBase> | 248 scoped_ptr<cricket::HttpPortAllocatorBase> |
252 PepperPortAllocatorFactory::CreatePortAllocator() { | 249 PepperPortAllocatorFactory::CreatePortAllocator() { |
253 return PepperPortAllocator::Create(instance_); | 250 return PepperPortAllocator::Create(instance_); |
254 } | 251 } |
255 | 252 |
256 } // namespace remoting | 253 } // namespace remoting |
OLD | NEW |