OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 #include "remoting/host/cast_port_allocator_factory.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "remoting/jingle_glue/network_settings.h" | |
9 | |
10 namespace remoting { | |
11 | |
12 CastPortAllocatorFactory::CastPortAllocatorFactory( | |
13 const NetworkSettings& network_settings, | |
14 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) | |
15 : network_settings_(network_settings), | |
16 url_request_context_getter_(url_request_context_getter) { | |
17 } | |
18 | |
19 CastPortAllocatorFactory::~CastPortAllocatorFactory() { | |
20 } | |
Sergey Ulanov
2014/07/17 18:54:40
} can be moved on the previous line.
aiguha
2014/07/17 19:39:59
Done.
| |
21 | |
22 talk_base::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | |
23 CastPortAllocatorFactory::Create( | |
24 const NetworkSettings& network_settings, | |
25 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) { | |
26 talk_base::RefCountedObject<CastPortAllocatorFactory>* allocator_factory = | |
27 new talk_base::RefCountedObject<CastPortAllocatorFactory>( | |
28 network_settings, url_request_context_getter); | |
29 return allocator_factory; | |
30 } | |
31 | |
32 cricket::PortAllocator* CastPortAllocatorFactory::CreatePortAllocator( | |
33 const std::vector<StunConfiguration>& stun_servers, | |
34 const std::vector<TurnConfiguration>& turn_configurations) { | |
35 scoped_ptr<ChromiumPortAllocator> port_allocator( | |
36 ChromiumPortAllocator::Create(url_request_context_getter_, | |
37 network_settings_)); | |
38 | |
39 std::vector<talk_base::SocketAddress> stun_hosts; | |
40 typedef std::vector<StunConfiguration>::const_iterator StunIt; | |
41 for (StunIt stun_it = stun_servers.begin(); stun_it != stun_servers.end(); | |
42 ++stun_it) { | |
43 stun_hosts.push_back(stun_it->server); | |
44 } | |
45 port_allocator->SetStunHosts(stun_hosts); | |
46 // TODO(aiguha): Figure out how to translate |turn_configurations| into | |
47 // turn hosts so we can set |port_allocator|'s relay hosts. | |
48 | |
aiguha
2014/07/17 03:11:36
Until we properly set relay hosts, we won't be abl
| |
49 return port_allocator.release(); | |
50 } | |
51 | |
52 } // namespace remoting | |
OLD | NEW |