| 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 "content/browser/renderer_host/p2p/socket_host_tcp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 | 177 |
| 178 void P2PSocketHostTcpBase::StartTls() { | 178 void P2PSocketHostTcpBase::StartTls() { |
| 179 DCHECK_EQ(state_, STATE_TLS_CONNECTING); | 179 DCHECK_EQ(state_, STATE_TLS_CONNECTING); |
| 180 DCHECK(socket_.get()); | 180 DCHECK(socket_.get()); |
| 181 | 181 |
| 182 std::unique_ptr<net::ClientSocketHandle> socket_handle( | 182 std::unique_ptr<net::ClientSocketHandle> socket_handle( |
| 183 new net::ClientSocketHandle()); | 183 new net::ClientSocketHandle()); |
| 184 socket_handle->SetSocket(std::move(socket_)); | 184 socket_handle->SetSocket(std::move(socket_)); |
| 185 | 185 |
| 186 net::SSLClientSocketContext context; | 186 const net::URLRequestContext* url_request_context = |
| 187 context.cert_verifier = url_context_->GetURLRequestContext()->cert_verifier(); | 187 url_context_->GetURLRequestContext(); |
| 188 context.transport_security_state = | 188 net::SSLClientSocketContext context( |
| 189 url_context_->GetURLRequestContext()->transport_security_state(); | 189 url_request_context->cert_verifier(), |
| 190 DCHECK(context.transport_security_state); | 190 nullptr, /* TODO(rkn): ChannelIDService is not thread safe. */ |
| 191 url_request_context->transport_security_state(), |
| 192 url_request_context->cert_transparency_verifier(), |
| 193 url_request_context->ct_policy_enforcer(), |
| 194 std::string() /* TODO(rsleevi): Ensure a proper unique shard. */); |
| 191 | 195 |
| 192 // Default ssl config. | 196 // Default ssl config. |
| 193 const net::SSLConfig ssl_config; | 197 const net::SSLConfig ssl_config; |
| 194 net::HostPortPair dest_host_port_pair; | 198 net::HostPortPair dest_host_port_pair; |
| 195 | 199 |
| 196 // Calling net::HostPortPair::FromIPEndPoint will crash if the IP address is | 200 // Calling net::HostPortPair::FromIPEndPoint will crash if the IP address is |
| 197 // empty. | 201 // empty. |
| 198 if (!remote_address_.ip_address.address().empty()) { | 202 if (!remote_address_.ip_address.address().empty()) { |
| 199 net::HostPortPair::FromIPEndPoint(remote_address_.ip_address); | 203 net::HostPortPair::FromIPEndPoint(remote_address_.ip_address); |
| 200 } else { | 204 } else { |
| 201 dest_host_port_pair.set_port(remote_address_.ip_address.port()); | 205 dest_host_port_pair.set_port(remote_address_.ip_address.port()); |
| 202 } | 206 } |
| 203 if (!remote_address_.hostname.empty()) | 207 if (!remote_address_.hostname.empty()) |
| 204 dest_host_port_pair.set_host(remote_address_.hostname); | 208 dest_host_port_pair.set_host(remote_address_.hostname); |
| 205 | 209 |
| 206 net::ClientSocketFactory* socket_factory = | 210 net::ClientSocketFactory* socket_factory = |
| 207 net::ClientSocketFactory::GetDefaultFactory(); | 211 net::ClientSocketFactory::GetDefaultFactory(); |
| 208 DCHECK(socket_factory); | 212 DCHECK(socket_factory); |
| 209 | 213 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } else { | 638 } else { |
| 635 packet_size += kTurnChannelDataHeaderSize; | 639 packet_size += kTurnChannelDataHeaderSize; |
| 636 // Calculate any padding if present. | 640 // Calculate any padding if present. |
| 637 if (packet_size % 4) | 641 if (packet_size % 4) |
| 638 *pad_bytes = 4 - packet_size % 4; | 642 *pad_bytes = 4 - packet_size % 4; |
| 639 } | 643 } |
| 640 return packet_size; | 644 return packet_size; |
| 641 } | 645 } |
| 642 | 646 |
| 643 } // namespace content | 647 } // namespace content |
| OLD | NEW |