| 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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "crypto/ec_private_key.h" | 9 #include "crypto/ec_private_key.h" |
| 10 #include "net/ssl/server_bound_cert_service.h" | 10 #include "net/ssl/server_bound_cert_service.h" |
| 11 #include "net/ssl/ssl_config_service.h" | 11 #include "net/ssl/ssl_config_service.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 SSLClientSocket::SSLClientSocket() | 15 SSLClientSocket::SSLClientSocket() |
| 16 : was_npn_negotiated_(false), | 16 : was_npn_negotiated_(false), |
| 17 was_spdy_negotiated_(false), | 17 was_spdy_negotiated_(false), |
| 18 protocol_negotiated_(kProtoUnknown), | 18 protocol_negotiated_(kProtoUnknown), |
| 19 channel_id_sent_(false) { | 19 channel_id_sent_(false), |
| 20 signed_cert_timestamps_received_(false) { |
| 20 } | 21 } |
| 21 | 22 |
| 22 // static | 23 // static |
| 23 NextProto SSLClientSocket::NextProtoFromString( | 24 NextProto SSLClientSocket::NextProtoFromString( |
| 24 const std::string& proto_string) { | 25 const std::string& proto_string) { |
| 25 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 26 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 26 return kProtoHTTP11; | 27 return kProtoHTTP11; |
| 27 } else if (proto_string == "spdy/2") { | 28 } else if (proto_string == "spdy/2") { |
| 28 return kProtoDeprecatedSPDY2; | 29 return kProtoDeprecatedSPDY2; |
| 29 } else if (proto_string == "spdy/3") { | 30 } else if (proto_string == "spdy/3") { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 138 } |
| 138 | 139 |
| 139 bool SSLClientSocket::WasChannelIDSent() const { | 140 bool SSLClientSocket::WasChannelIDSent() const { |
| 140 return channel_id_sent_; | 141 return channel_id_sent_; |
| 141 } | 142 } |
| 142 | 143 |
| 143 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { | 144 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { |
| 144 channel_id_sent_ = channel_id_sent; | 145 channel_id_sent_ = channel_id_sent; |
| 145 } | 146 } |
| 146 | 147 |
| 148 bool SSLClientSocket::WereSignedCertTimestampsReceived() const { |
| 149 return signed_cert_timestamps_received_; |
| 150 } |
| 151 |
| 152 void SSLClientSocket::set_signed_cert_timestamps_received( |
| 153 bool signed_cert_timestamps_received) { |
| 154 signed_cert_timestamps_received_ = signed_cert_timestamps_received; |
| 155 } |
| 156 |
| 147 // static | 157 // static |
| 148 void SSLClientSocket::RecordChannelIDSupport( | 158 void SSLClientSocket::RecordChannelIDSupport( |
| 149 ServerBoundCertService* server_bound_cert_service, | 159 ServerBoundCertService* server_bound_cert_service, |
| 150 bool negotiated_channel_id, | 160 bool negotiated_channel_id, |
| 151 bool channel_id_enabled, | 161 bool channel_id_enabled, |
| 152 bool supports_ecc) { | 162 bool supports_ecc) { |
| 153 // Since this enum is used for a histogram, do not change or re-use values. | 163 // Since this enum is used for a histogram, do not change or re-use values. |
| 154 enum { | 164 enum { |
| 155 DISABLED = 0, | 165 DISABLED = 0, |
| 156 CLIENT_ONLY = 1, | 166 CLIENT_ONLY = 1, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 202 } |
| 193 if (!server_bound_cert_service->IsSystemTimeValid()) { | 203 if (!server_bound_cert_service->IsSystemTimeValid()) { |
| 194 DVLOG(1) << "System time is not within the supported range for certificate " | 204 DVLOG(1) << "System time is not within the supported range for certificate " |
| 195 "generation, not enabling channel ID."; | 205 "generation, not enabling channel ID."; |
| 196 return false; | 206 return false; |
| 197 } | 207 } |
| 198 return true; | 208 return true; |
| 199 } | 209 } |
| 200 | 210 |
| 201 } // namespace net | 211 } // namespace net |
| OLD | NEW |