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

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

Issue 2253233004: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 months 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
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/protocol/ssl_hmac_channel_authenticator.h" 5 #include "remoting/protocol/ssl_hmac_channel_authenticator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 265 }
266 266
267 net::SSLServerConfig ssl_config; 267 net::SSLServerConfig ssl_config;
268 ssl_config.require_ecdhe = true; 268 ssl_config.require_ecdhe = true;
269 269
270 server_context_ = net::CreateSSLServerContext( 270 server_context_ = net::CreateSSLServerContext(
271 cert.get(), *local_key_pair_->private_key(), ssl_config); 271 cert.get(), *local_key_pair_->private_key(), ssl_config);
272 272
273 std::unique_ptr<net::SSLServerSocket> server_socket = 273 std::unique_ptr<net::SSLServerSocket> server_socket =
274 server_context_->CreateSSLServerSocket( 274 server_context_->CreateSSLServerSocket(
275 base::WrapUnique(new NetStreamSocketAdapter(std::move(socket)))); 275 base::MakeUnique<NetStreamSocketAdapter>(std::move(socket)));
276 net::SSLServerSocket* raw_server_socket = server_socket.get(); 276 net::SSLServerSocket* raw_server_socket = server_socket.get();
277 socket_ = std::move(server_socket); 277 socket_ = std::move(server_socket);
278 result = raw_server_socket->Handshake( 278 result = raw_server_socket->Handshake(
279 base::Bind(&SslHmacChannelAuthenticator::OnConnected, 279 base::Bind(&SslHmacChannelAuthenticator::OnConnected,
280 base::Unretained(this))); 280 base::Unretained(this)));
281 #endif 281 #endif
282 } else { 282 } else {
283 transport_security_state_.reset(new net::TransportSecurityState); 283 transport_security_state_.reset(new net::TransportSecurityState);
284 cert_verifier_.reset(new FailingCertVerifier); 284 cert_verifier_.reset(new FailingCertVerifier);
285 ct_verifier_.reset(new IgnoresCTVerifier); 285 ct_verifier_.reset(new IgnoresCTVerifier);
(...skipping 15 matching lines...) Expand all
301 301
302 net::HostPortPair host_and_port(kSslFakeHostName, 0); 302 net::HostPortPair host_and_port(kSslFakeHostName, 0);
303 net::SSLClientSocketContext context; 303 net::SSLClientSocketContext context;
304 context.transport_security_state = transport_security_state_.get(); 304 context.transport_security_state = transport_security_state_.get();
305 context.cert_verifier = cert_verifier_.get(); 305 context.cert_verifier = cert_verifier_.get();
306 context.cert_transparency_verifier = ct_verifier_.get(); 306 context.cert_transparency_verifier = ct_verifier_.get();
307 context.ct_policy_enforcer = ct_policy_enforcer_.get(); 307 context.ct_policy_enforcer = ct_policy_enforcer_.get();
308 std::unique_ptr<net::ClientSocketHandle> socket_handle( 308 std::unique_ptr<net::ClientSocketHandle> socket_handle(
309 new net::ClientSocketHandle); 309 new net::ClientSocketHandle);
310 socket_handle->SetSocket( 310 socket_handle->SetSocket(
311 base::WrapUnique(new NetStreamSocketAdapter(std::move(socket)))); 311 base::MakeUnique<NetStreamSocketAdapter>(std::move(socket)));
312 312
313 #if defined(OS_NACL) 313 #if defined(OS_NACL)
314 // net_nacl doesn't include ClientSocketFactory. 314 // net_nacl doesn't include ClientSocketFactory.
315 socket_.reset(new net::SSLClientSocketImpl( 315 socket_.reset(new net::SSLClientSocketImpl(
316 std::move(socket_handle), host_and_port, ssl_config, context)); 316 std::move(socket_handle), host_and_port, ssl_config, context));
317 #else 317 #else
318 socket_ = 318 socket_ =
319 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( 319 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket(
320 std::move(socket_handle), host_and_port, ssl_config, context); 320 std::move(socket_handle), host_and_port, ssl_config, context);
321 #endif 321 #endif
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 &(auth_bytes[0]), kAuthDigestLength); 469 &(auth_bytes[0]), kAuthDigestLength);
470 } 470 }
471 471
472 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { 472 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) {
473 if (auth_write_buf_.get() == nullptr && auth_read_buf_.get() == nullptr) { 473 if (auth_write_buf_.get() == nullptr && auth_read_buf_.get() == nullptr) {
474 DCHECK(socket_.get() != nullptr); 474 DCHECK(socket_.get() != nullptr);
475 if (callback_called) 475 if (callback_called)
476 *callback_called = true; 476 *callback_called = true;
477 477
478 base::ResetAndReturn(&done_callback_) 478 base::ResetAndReturn(&done_callback_)
479 .Run(net::OK, base::WrapUnique(new P2PStreamSocketAdapter( 479 .Run(net::OK, base::MakeUnique<P2PStreamSocketAdapter>(
480 std::move(socket_), std::move(server_context_)))); 480 std::move(socket_), std::move(server_context_)));
481 } 481 }
482 } 482 }
483 483
484 void SslHmacChannelAuthenticator::NotifyError(int error) { 484 void SslHmacChannelAuthenticator::NotifyError(int error) {
485 base::ResetAndReturn(&done_callback_).Run(error, nullptr); 485 base::ResetAndReturn(&done_callback_).Run(error, nullptr);
486 } 486 }
487 487
488 } // namespace protocol 488 } // namespace protocol
489 } // namespace remoting 489 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/pairing_registry_unittest.cc ('k') | remoting/protocol/stream_message_pipe_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698