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

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

Issue 9959033: Move NextProto enum to a new file net/socket/next_proto.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address wtc's comments Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | net/socket/ssl_client_socket_pool.cc » ('j') | 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/string_util.h" 7 #include "base/string_util.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 SSLClientSocket::SSLClientSocket() 11 SSLClientSocket::SSLClientSocket()
12 : was_npn_negotiated_(false), 12 : was_npn_negotiated_(false),
13 was_spdy_negotiated_(false), 13 was_spdy_negotiated_(false),
14 protocol_negotiated_(kProtoUnknown), 14 protocol_negotiated_(kProtoUnknown),
15 domain_bound_cert_type_(CLIENT_CERT_INVALID_TYPE) { 15 domain_bound_cert_type_(CLIENT_CERT_INVALID_TYPE) {
16 } 16 }
17 17
18 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( 18 NextProto SSLClientSocket::NextProtoFromString(
19 const std::string& proto_string) { 19 const std::string& proto_string) {
20 if (proto_string == "http1.1" || proto_string == "http/1.1") { 20 if (proto_string == "http1.1" || proto_string == "http/1.1") {
21 return kProtoHTTP11; 21 return kProtoHTTP11;
22 } else if (proto_string == "spdy/1") { 22 } else if (proto_string == "spdy/1") {
23 return kProtoSPDY1; 23 return kProtoSPDY1;
24 } else if (proto_string == "spdy/2") { 24 } else if (proto_string == "spdy/2") {
25 return kProtoSPDY2; 25 return kProtoSPDY2;
26 } else if (proto_string == "spdy/2.1") { 26 } else if (proto_string == "spdy/2.1") {
27 return kProtoSPDY21; 27 return kProtoSPDY21;
28 } else if (proto_string == "spdy/3") { 28 } else if (proto_string == "spdy/3") {
29 return kProtoSPDY3; 29 return kProtoSPDY3;
30 } else { 30 } else {
31 return kProtoUnknown; 31 return kProtoUnknown;
32 } 32 }
33 } 33 }
34 34
35 const char* SSLClientSocket::NextProtoToString( 35 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) {
36 SSLClientSocket::NextProto next_proto) {
37 switch (next_proto) { 36 switch (next_proto) {
38 case kProtoHTTP11: 37 case kProtoHTTP11:
39 return "http/1.1"; 38 return "http/1.1";
40 case kProtoSPDY1: 39 case kProtoSPDY1:
41 return "spdy/1"; 40 return "spdy/1";
42 case kProtoSPDY2: 41 case kProtoSPDY2:
43 return "spdy/2"; 42 return "spdy/2";
44 case kProtoSPDY21: 43 case kProtoSPDY21:
45 return "spdy/2.1"; 44 return "spdy/2.1";
46 case kProtoSPDY3: 45 case kProtoSPDY3:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 107 }
109 108
110 bool SSLClientSocket::was_spdy_negotiated() const { 109 bool SSLClientSocket::was_spdy_negotiated() const {
111 return was_spdy_negotiated_; 110 return was_spdy_negotiated_;
112 } 111 }
113 112
114 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { 113 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) {
115 return was_spdy_negotiated_ = negotiated; 114 return was_spdy_negotiated_ = negotiated;
116 } 115 }
117 116
118 SSLClientSocket::NextProto SSLClientSocket::protocol_negotiated() const { 117 NextProto SSLClientSocket::protocol_negotiated() const {
119 return protocol_negotiated_; 118 return protocol_negotiated_;
120 } 119 }
121 120
122 void SSLClientSocket::set_protocol_negotiated( 121 void SSLClientSocket::set_protocol_negotiated(NextProto protocol_negotiated) {
123 SSLClientSocket::NextProto protocol_negotiated) {
124 protocol_negotiated_ = protocol_negotiated; 122 protocol_negotiated_ = protocol_negotiated;
125 } 123 }
126 124
127 bool SSLClientSocket::WasDomainBoundCertSent() const { 125 bool SSLClientSocket::WasDomainBoundCertSent() const {
128 return domain_bound_cert_type_ != CLIENT_CERT_INVALID_TYPE; 126 return domain_bound_cert_type_ != CLIENT_CERT_INVALID_TYPE;
129 } 127 }
130 128
131 SSLClientCertType SSLClientSocket::domain_bound_cert_type() const { 129 SSLClientCertType SSLClientSocket::domain_bound_cert_type() const {
132 return domain_bound_cert_type_; 130 return domain_bound_cert_type_;
133 } 131 }
134 132
135 SSLClientCertType SSLClientSocket::set_domain_bound_cert_type( 133 SSLClientCertType SSLClientSocket::set_domain_bound_cert_type(
136 SSLClientCertType type) { 134 SSLClientCertType type) {
137 return domain_bound_cert_type_ = type; 135 return domain_bound_cert_type_ = type;
138 } 136 }
139 137
140 } // namespace net 138 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | net/socket/ssl_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698