Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: net/socket/ssl_client_socket.cc

Issue 1111553002: Unvirtual and inline SSLClientSocket setters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed a field Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/ssl/channel_id_service.h" 13 #include "net/ssl/channel_id_service.h"
14 #include "net/ssl/ssl_cipher_suite_names.h" 14 #include "net/ssl/ssl_cipher_suite_names.h"
15 #include "net/ssl/ssl_config_service.h" 15 #include "net/ssl/ssl_config_service.h"
16 #include "net/ssl/ssl_connection_status_flags.h" 16 #include "net/ssl/ssl_connection_status_flags.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 SSLClientSocket::SSLClientSocket() 20 SSLClientSocket::SSLClientSocket()
21 : protocol_negotiated_(kProtoUnknown), 21 : signed_cert_timestamps_received_(false),
22 signed_cert_timestamps_received_(false),
23 stapled_ocsp_response_received_(false), 22 stapled_ocsp_response_received_(false),
24 negotiation_extension_(kExtensionUnknown) { 23 negotiation_extension_(kExtensionUnknown) {
25 } 24 }
26 25
27 // static 26 // static
28 NextProto SSLClientSocket::NextProtoFromString( 27 NextProto SSLClientSocket::NextProtoFromString(
29 const std::string& proto_string) { 28 const std::string& proto_string) {
30 if (proto_string == "http1.1" || proto_string == "http/1.1") { 29 if (proto_string == "http1.1" || proto_string == "http/1.1") {
31 return kProtoHTTP11; 30 return kProtoHTTP11;
32 } else if (proto_string == "spdy/2") { 31 } else if (proto_string == "spdy/2") {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return NextProtoFromString(proto); 98 return NextProtoFromString(proto);
100 } 99 }
101 100
102 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { 101 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) {
103 if (error == OK) 102 if (error == OK)
104 return true; 103 return true;
105 return (load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) && 104 return (load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) &&
106 IsCertificateError(error); 105 IsCertificateError(error);
107 } 106 }
108 107
109 void SSLClientSocket::set_negotiation_extension(
110 SSLNegotiationExtension negotiation_extension) {
111 negotiation_extension_ = negotiation_extension;
112 }
113
114 void SSLClientSocket::set_signed_cert_timestamps_received(
115 bool signed_cert_timestamps_received) {
116 signed_cert_timestamps_received_ = signed_cert_timestamps_received;
117 }
118
119 void SSLClientSocket::set_stapled_ocsp_response_received(
120 bool stapled_ocsp_response_received) {
121 stapled_ocsp_response_received_ = stapled_ocsp_response_received;
122 }
123
124 void SSLClientSocket::RecordNegotiationExtension() { 108 void SSLClientSocket::RecordNegotiationExtension() {
125 if (negotiation_extension_ == kExtensionUnknown) 109 if (negotiation_extension_ == kExtensionUnknown)
126 return; 110 return;
127 std::string proto; 111 std::string proto;
128 SSLClientSocket::NextProtoStatus status = GetNextProto(&proto); 112 SSLClientSocket::NextProtoStatus status = GetNextProto(&proto);
129 if (status == kNextProtoUnsupported) 113 if (status == kNextProtoUnsupported)
130 return; 114 return;
131 // Convert protocol into numerical value for histogram. 115 // Convert protocol into numerical value for histogram.
132 NextProto protocol_negotiated = SSLClientSocket::NextProtoFromString(proto); 116 NextProto protocol_negotiated = SSLClientSocket::NextProtoFromString(proto);
133 base::HistogramBase::Sample sample = 117 base::HistogramBase::Sample sample =
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 wire_protos.push_back(proto.size()); 223 wire_protos.push_back(proto.size());
240 for (const char ch : proto) { 224 for (const char ch : proto) {
241 wire_protos.push_back(static_cast<uint8_t>(ch)); 225 wire_protos.push_back(static_cast<uint8_t>(ch));
242 } 226 }
243 } 227 }
244 228
245 return wire_protos; 229 return wire_protos;
246 } 230 }
247 231
248 } // namespace net 232 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698