| 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 "net/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "crypto/ec_private_key.h" | 10 #include "crypto/ec_private_key.h" |
| 11 #include "net/base/connection_type_histograms.h" | 11 #include "net/base/connection_type_histograms.h" |
| 12 #include "net/base/host_port_pair.h" | 12 #include "net/base/host_port_pair.h" |
| 13 #include "net/base/net_errors.h" |
| 13 #include "net/ssl/channel_id_service.h" | 14 #include "net/ssl/channel_id_service.h" |
| 14 #include "net/ssl/ssl_cipher_suite_names.h" | 15 #include "net/ssl/ssl_cipher_suite_names.h" |
| 15 #include "net/ssl/ssl_config_service.h" | 16 #include "net/ssl/ssl_config_service.h" |
| 16 #include "net/ssl/ssl_connection_status_flags.h" | 17 #include "net/ssl/ssl_connection_status_flags.h" |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 | 20 |
| 20 SSLClientSocket::SSLClientSocket() | 21 SSLClientSocket::SSLClientSocket() |
| 21 : was_npn_negotiated_(false), | 22 : was_npn_negotiated_(false), |
| 22 was_spdy_negotiated_(false), | 23 was_spdy_negotiated_(false), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 95 |
| 95 bool SSLClientSocket::WasNpnNegotiated() const { | 96 bool SSLClientSocket::WasNpnNegotiated() const { |
| 96 return was_npn_negotiated_; | 97 return was_npn_negotiated_; |
| 97 } | 98 } |
| 98 | 99 |
| 99 NextProto SSLClientSocket::GetNegotiatedProtocol() const { | 100 NextProto SSLClientSocket::GetNegotiatedProtocol() const { |
| 100 return protocol_negotiated_; | 101 return protocol_negotiated_; |
| 101 } | 102 } |
| 102 | 103 |
| 103 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { | 104 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { |
| 104 return error == OK || (load_flags & LOAD_IGNORE_ALL_CERT_ERRORS); | 105 if (error == OK) |
| 106 return true; |
| 107 return (load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) && |
| 108 IsCertificateError(error); |
| 105 } | 109 } |
| 106 | 110 |
| 107 bool SSLClientSocket::set_was_npn_negotiated(bool negotiated) { | 111 bool SSLClientSocket::set_was_npn_negotiated(bool negotiated) { |
| 108 return was_npn_negotiated_ = negotiated; | 112 return was_npn_negotiated_ = negotiated; |
| 109 } | 113 } |
| 110 | 114 |
| 111 bool SSLClientSocket::was_spdy_negotiated() const { | 115 bool SSLClientSocket::was_spdy_negotiated() const { |
| 112 return was_spdy_negotiated_; | 116 return was_spdy_negotiated_; |
| 113 } | 117 } |
| 114 | 118 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } else { | 265 } else { |
| 262 sample += 500; | 266 sample += 500; |
| 263 } | 267 } |
| 264 } else { | 268 } else { |
| 265 DCHECK_EQ(kExtensionALPN, negotiation_extension_); | 269 DCHECK_EQ(kExtensionALPN, negotiation_extension_); |
| 266 } | 270 } |
| 267 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); | 271 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); |
| 268 } | 272 } |
| 269 | 273 |
| 270 } // namespace net | 274 } // namespace net |
| OLD | NEW |