OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/protocol/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" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } // namespace | 129 } // namespace |
130 | 130 |
131 // static | 131 // static |
132 scoped_ptr<ChromiumPortAllocator> ChromiumPortAllocator::Create( | 132 scoped_ptr<ChromiumPortAllocator> ChromiumPortAllocator::Create( |
133 const scoped_refptr<net::URLRequestContextGetter>& url_context) { | 133 const scoped_refptr<net::URLRequestContextGetter>& url_context) { |
134 scoped_ptr<rtc::NetworkManager> network_manager( | 134 scoped_ptr<rtc::NetworkManager> network_manager( |
135 new rtc::BasicNetworkManager()); | 135 new rtc::BasicNetworkManager()); |
136 scoped_ptr<rtc::PacketSocketFactory> socket_factory( | 136 scoped_ptr<rtc::PacketSocketFactory> socket_factory( |
137 new ChromiumPacketSocketFactory()); | 137 new ChromiumPacketSocketFactory()); |
138 return make_scoped_ptr(new ChromiumPortAllocator( | 138 return make_scoped_ptr(new ChromiumPortAllocator( |
139 url_context, network_manager.Pass(), socket_factory.Pass())); | 139 url_context, std::move(network_manager), std::move(socket_factory))); |
140 } | 140 } |
141 | 141 |
142 ChromiumPortAllocator::ChromiumPortAllocator( | 142 ChromiumPortAllocator::ChromiumPortAllocator( |
143 const scoped_refptr<net::URLRequestContextGetter>& url_context, | 143 const scoped_refptr<net::URLRequestContextGetter>& url_context, |
144 scoped_ptr<rtc::NetworkManager> network_manager, | 144 scoped_ptr<rtc::NetworkManager> network_manager, |
145 scoped_ptr<rtc::PacketSocketFactory> socket_factory) | 145 scoped_ptr<rtc::PacketSocketFactory> socket_factory) |
146 : HttpPortAllocatorBase(network_manager.get(), | 146 : HttpPortAllocatorBase(network_manager.get(), |
147 socket_factory.get(), | 147 socket_factory.get(), |
148 std::string()), | 148 std::string()), |
149 url_context_(url_context), | 149 url_context_(url_context), |
150 network_manager_(network_manager.Pass()), | 150 network_manager_(std::move(network_manager)), |
151 socket_factory_(socket_factory.Pass()) {} | 151 socket_factory_(std::move(socket_factory)) {} |
152 | 152 |
153 ChromiumPortAllocator::~ChromiumPortAllocator() {} | 153 ChromiumPortAllocator::~ChromiumPortAllocator() {} |
154 | 154 |
155 cricket::PortAllocatorSession* ChromiumPortAllocator::CreateSessionInternal( | 155 cricket::PortAllocatorSession* ChromiumPortAllocator::CreateSessionInternal( |
156 const std::string& content_name, | 156 const std::string& content_name, |
157 int component, | 157 int component, |
158 const std::string& ice_username_fragment, | 158 const std::string& ice_username_fragment, |
159 const std::string& ice_password) { | 159 const std::string& ice_password) { |
160 return new ChromiumPortAllocatorSession( | 160 return new ChromiumPortAllocatorSession( |
161 this, content_name, component, ice_username_fragment, ice_password, | 161 this, content_name, component, ice_username_fragment, ice_password, |
162 stun_hosts(), relay_hosts(), relay_token(), url_context_); | 162 stun_hosts(), relay_hosts(), relay_token(), url_context_); |
163 } | 163 } |
164 | 164 |
165 ChromiumPortAllocatorFactory::ChromiumPortAllocatorFactory( | 165 ChromiumPortAllocatorFactory::ChromiumPortAllocatorFactory( |
166 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) | 166 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) |
167 : url_request_context_getter_(url_request_context_getter) {} | 167 : url_request_context_getter_(url_request_context_getter) {} |
168 | 168 |
169 ChromiumPortAllocatorFactory::~ChromiumPortAllocatorFactory() {} | 169 ChromiumPortAllocatorFactory::~ChromiumPortAllocatorFactory() {} |
170 | 170 |
171 scoped_ptr<cricket::HttpPortAllocatorBase> | 171 scoped_ptr<cricket::HttpPortAllocatorBase> |
172 ChromiumPortAllocatorFactory::CreatePortAllocator() { | 172 ChromiumPortAllocatorFactory::CreatePortAllocator() { |
173 return ChromiumPortAllocator::Create(url_request_context_getter_); | 173 return ChromiumPortAllocator::Create(url_request_context_getter_); |
174 } | 174 } |
175 | 175 |
176 } // namespace protocol | 176 } // namespace protocol |
177 } // namespace remoting | 177 } // namespace remoting |
OLD | NEW |