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/pepper/pepper_tcp_socket.h" | 5 #include "content/browser/renderer_host/pepper/pepper_tcp_socket.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 connection_state_ = SSL_HANDSHAKE_IN_PROGRESS; | 131 connection_state_ = SSL_HANDSHAKE_IN_PROGRESS; |
132 // TODO(raymes,rsleevi): Use trusted/untrusted certificates when connecting. | 132 // TODO(raymes,rsleevi): Use trusted/untrusted certificates when connecting. |
133 | 133 |
134 net::ClientSocketHandle* handle = new net::ClientSocketHandle(); | 134 net::ClientSocketHandle* handle = new net::ClientSocketHandle(); |
135 handle->set_socket(socket_.release()); | 135 handle->set_socket(socket_.release()); |
136 net::ClientSocketFactory* factory = | 136 net::ClientSocketFactory* factory = |
137 net::ClientSocketFactory::GetDefaultFactory(); | 137 net::ClientSocketFactory::GetDefaultFactory(); |
138 net::HostPortPair host_port_pair(server_name, server_port); | 138 net::HostPortPair host_port_pair(server_name, server_port); |
139 net::SSLClientSocketContext ssl_context; | 139 net::SSLClientSocketContext ssl_context; |
140 ssl_context.cert_verifier = manager_->GetCertVerifier(); | 140 ssl_context.cert_verifier = manager_->GetCertVerifier(); |
| 141 ssl_context.transport_security_state = manager_->GetTransportSecurityState(); |
141 socket_.reset(factory->CreateSSLClientSocket( | 142 socket_.reset(factory->CreateSSLClientSocket( |
142 handle, host_port_pair, manager_->ssl_config(), ssl_context)); | 143 handle, host_port_pair, manager_->ssl_config(), ssl_context)); |
143 if (!socket_) { | 144 if (!socket_) { |
144 LOG(WARNING) << "Failed to create an SSL client socket."; | 145 LOG(WARNING) << "Failed to create an SSL client socket."; |
145 OnSSLHandshakeCompleted(net::ERR_UNEXPECTED); | 146 OnSSLHandshakeCompleted(net::ERR_UNEXPECTED); |
146 return; | 147 return; |
147 } | 148 } |
148 | 149 |
149 int result = socket_->Connect( | 150 int result = socket_->Connect( |
150 base::Bind(&PepperTCPSocket::OnSSLHandshakeCompleted, | 151 base::Bind(&PepperTCPSocket::OnSSLHandshakeCompleted, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 448 |
448 int result = socket_->Write( | 449 int result = socket_->Write( |
449 write_buffer_.get(), | 450 write_buffer_.get(), |
450 write_buffer_->BytesRemaining(), | 451 write_buffer_->BytesRemaining(), |
451 base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this))); | 452 base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this))); |
452 if (result != net::ERR_IO_PENDING) | 453 if (result != net::ERR_IO_PENDING) |
453 OnWriteCompleted(result); | 454 OnWriteCompleted(result); |
454 } | 455 } |
455 | 456 |
456 } // namespace content | 457 } // namespace content |
OLD | NEW |