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/socket/tls_socket.h" | 5 #include "extensions/browser/api/socket/tls_socket.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "extensions/browser/api/api_resource.h" | 9 #include "extensions/browser/api/api_resource.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
11 #include "net/base/ip_endpoint.h" | 11 #include "net/base/ip_endpoint.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/base/rand_callback.h" | 13 #include "net/base/rand_callback.h" |
14 #include "net/socket/client_socket_factory.h" | 14 #include "net/socket/client_socket_factory.h" |
15 #include "net/socket/client_socket_handle.h" | 15 #include "net/socket/client_socket_handle.h" |
16 #include "net/socket/ssl_client_socket.h" | 16 #include "net/socket/ssl_client_socket.h" |
17 #include "net/socket/tcp_client_socket.h" | 17 #include "net/socket/tcp_client_socket.h" |
18 #include "url/url_canon.h" | 18 #include "url/url_canon.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Returns the SSL protocol version (as a uint16) represented by a string. | 22 // Returns the SSL protocol version (as a uint16) represented by a string. |
23 // Returns 0 if the string is invalid. | 23 // Returns 0 if the string is invalid. |
24 uint16 SSLProtocolVersionFromString(const std::string& version_str) { | 24 uint16 SSLProtocolVersionFromString(const std::string& version_str) { |
25 uint16 version = 0; // Invalid. | 25 uint16 version = 0; // Invalid. |
26 if (version_str == "ssl3") { | 26 if (version_str == "tls1") { |
davidben
2015/05/13 20:46:18
NOTE: Unlike the rest of this CL, this part is not
| |
27 version = net::SSL_PROTOCOL_VERSION_SSL3; | |
28 } else if (version_str == "tls1") { | |
29 version = net::SSL_PROTOCOL_VERSION_TLS1; | 27 version = net::SSL_PROTOCOL_VERSION_TLS1; |
30 } else if (version_str == "tls1.1") { | 28 } else if (version_str == "tls1.1") { |
31 version = net::SSL_PROTOCOL_VERSION_TLS1_1; | 29 version = net::SSL_PROTOCOL_VERSION_TLS1_1; |
32 } else if (version_str == "tls1.2") { | 30 } else if (version_str == "tls1.2") { |
33 version = net::SSL_PROTOCOL_VERSION_TLS1_2; | 31 version = net::SSL_PROTOCOL_VERSION_TLS1_2; |
34 } | 32 } |
35 return version; | 33 return version; |
36 } | 34 } |
37 | 35 |
38 void TlsConnectDone(scoped_ptr<net::SSLClientSocket> ssl_socket, | 36 void TlsConnectDone(scoped_ptr<net::SSLClientSocket> ssl_socket, |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 if (status != net::OK) { | 298 if (status != net::OK) { |
301 DVLOG(1) << "Status is not OK or IO-pending: " | 299 DVLOG(1) << "Status is not OK or IO-pending: " |
302 << net::ErrorToString(status); | 300 << net::ErrorToString(status); |
303 } | 301 } |
304 connect_cb.Run(status); | 302 connect_cb.Run(status); |
305 } | 303 } |
306 } | 304 } |
307 | 305 |
308 } // namespace extensions | 306 } // namespace extensions |
309 | 307 |
OLD | NEW |