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 "extensions/browser/api/cast_channel/cast_socket.h" | 5 #include "extensions/browser/api/cast_channel/cast_socket.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // If a peer cert was extracted in a previous attempt to connect, then | 166 // If a peer cert was extracted in a previous attempt to connect, then |
167 // whitelist that cert. | 167 // whitelist that cert. |
168 if (!peer_cert_.empty()) { | 168 if (!peer_cert_.empty()) { |
169 net::SSLConfig::CertAndStatus cert_and_status; | 169 net::SSLConfig::CertAndStatus cert_and_status; |
170 cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID; | 170 cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID; |
171 cert_and_status.der_cert = peer_cert_; | 171 cert_and_status.der_cert = peer_cert_; |
172 ssl_config.allowed_bad_certs.push_back(cert_and_status); | 172 ssl_config.allowed_bad_certs.push_back(cert_and_status); |
173 logger_->LogSocketEvent(channel_id_, proto::SSL_CERT_WHITELISTED); | 173 logger_->LogSocketEvent(channel_id_, proto::SSL_CERT_WHITELISTED); |
174 } | 174 } |
175 | 175 |
176 cert_verifier_.reset(net::CertVerifier::CreateDefault()); | 176 cert_verifier_ = net::CertVerifier::CreateDefault(); |
177 transport_security_state_.reset(new net::TransportSecurityState); | 177 transport_security_state_.reset(new net::TransportSecurityState); |
178 net::SSLClientSocketContext context; | 178 net::SSLClientSocketContext context; |
179 // CertVerifier and TransportSecurityState are owned by us, not the | 179 // CertVerifier and TransportSecurityState are owned by us, not the |
180 // context object. | 180 // context object. |
181 context.cert_verifier = cert_verifier_.get(); | 181 context.cert_verifier = cert_verifier_.get(); |
182 context.transport_security_state = transport_security_state_.get(); | 182 context.transport_security_state = transport_security_state_.get(); |
183 | 183 |
184 scoped_ptr<net::ClientSocketHandle> connection(new net::ClientSocketHandle); | 184 scoped_ptr<net::ClientSocketHandle> connection(new net::ClientSocketHandle); |
185 connection->SetSocket(socket.Pass()); | 185 connection->SetSocket(socket.Pass()); |
186 net::HostPortPair host_and_port = net::HostPortPair::FromIPEndPoint( | 186 net::HostPortPair host_and_port = net::HostPortPair::FromIPEndPoint( |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 VLOG_WITH_CONNECTION(1) << "SetErrorState " << error_state; | 617 VLOG_WITH_CONNECTION(1) << "SetErrorState " << error_state; |
618 DCHECK_EQ(CHANNEL_ERROR_NONE, error_state_); | 618 DCHECK_EQ(CHANNEL_ERROR_NONE, error_state_); |
619 error_state_ = error_state; | 619 error_state_ = error_state; |
620 logger_->LogSocketErrorState(channel_id_, ErrorStateToProto(error_state_)); | 620 logger_->LogSocketErrorState(channel_id_, ErrorStateToProto(error_state_)); |
621 delegate_->OnError(error_state_); | 621 delegate_->OnError(error_state_); |
622 } | 622 } |
623 } // namespace cast_channel | 623 } // namespace cast_channel |
624 } // namespace api | 624 } // namespace api |
625 } // namespace extensions | 625 } // namespace extensions |
626 #undef VLOG_WITH_CONNECTION | 626 #undef VLOG_WITH_CONNECTION |
OLD | NEW |