Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: remoting/protocol/chromium_port_allocator_factory.cc

Issue 1500663003: Removing references to webrtc::PortAllocatorFactoryInterface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing merge conflict, and removing some dead code. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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/protocol/chromium_port_allocator_factory.h"
6
7 #include "base/logging.h"
8 #include "net/url_request/url_request_context_getter.h"
9 #include "remoting/protocol/chromium_port_allocator.h"
10 #include "remoting/protocol/network_settings.h"
11
12 namespace remoting {
13 namespace protocol {
14
15 ChromiumPortAllocatorFactory::ChromiumPortAllocatorFactory(
16 const NetworkSettings& network_settings,
17 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter)
18 : network_settings_(network_settings),
19 url_request_context_getter_(url_request_context_getter) {}
20
21 ChromiumPortAllocatorFactory::~ChromiumPortAllocatorFactory() {}
22
23 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
24 ChromiumPortAllocatorFactory::Create(
25 const NetworkSettings& network_settings,
26 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) {
27 rtc::RefCountedObject<ChromiumPortAllocatorFactory>* allocator_factory =
28 new rtc::RefCountedObject<ChromiumPortAllocatorFactory>(
29 network_settings, url_request_context_getter);
30 return allocator_factory;
31 }
32
33 cricket::PortAllocator* ChromiumPortAllocatorFactory::CreatePortAllocator(
34 const std::vector<StunConfiguration>& stun_servers,
35 const std::vector<TurnConfiguration>& turn_configurations) {
36 scoped_ptr<ChromiumPortAllocator> port_allocator(
37 ChromiumPortAllocator::Create(url_request_context_getter_,
38 network_settings_));
39
40 std::vector<rtc::SocketAddress> stun_hosts;
41 for (auto 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
47 // TODO(aiguha): Figure out how to translate |turn_configurations| into
48 // turn hosts so we can set |port_allocator|'s relay hosts.
49
50 return port_allocator.release();
51 }
52
53 } // namespace protocol
54 } // namespace remoting
55
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698