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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 // Returns the SSL protocol version (as a uint16_t) represented by a string. | 25 // Returns the SSL protocol version (as a uint16_t) represented by a string. |
26 // Returns 0 if the string is invalid. | 26 // Returns 0 if the string is invalid. |
27 uint16_t SSLProtocolVersionFromString(const std::string& version_str) { | 27 uint16_t SSLProtocolVersionFromString(const std::string& version_str) { |
28 uint16_t version = 0; // Invalid. | 28 uint16_t version = 0; // Invalid. |
29 if (version_str == "tls1") { | 29 if (version_str == "tls1") { |
30 version = net::SSL_PROTOCOL_VERSION_TLS1; | 30 version = net::SSL_PROTOCOL_VERSION_TLS1; |
31 } else if (version_str == "tls1.1") { | 31 } else if (version_str == "tls1.1") { |
32 version = net::SSL_PROTOCOL_VERSION_TLS1_1; | 32 version = net::SSL_PROTOCOL_VERSION_TLS1_1; |
33 } else if (version_str == "tls1.2") { | 33 } else if (version_str == "tls1.2") { |
34 version = net::SSL_PROTOCOL_VERSION_TLS1_2; | 34 version = net::SSL_PROTOCOL_VERSION_TLS1_2; |
35 } else if (version_str == "tls1.3") { | |
36 version = net::SSL_PROTOCOL_VERSION_TLS1_3; | |
davidben
2016/07/18 09:46:40
We probably should not expose this until it's work
svaldez
2016/07/18 10:04:01
Done.
| |
35 } | 37 } |
36 return version; | 38 return version; |
37 } | 39 } |
38 | 40 |
39 void TlsConnectDone(std::unique_ptr<net::SSLClientSocket> ssl_socket, | 41 void TlsConnectDone(std::unique_ptr<net::SSLClientSocket> ssl_socket, |
40 const std::string& extension_id, | 42 const std::string& extension_id, |
41 const extensions::TLSSocket::SecureCallback& callback, | 43 const extensions::TLSSocket::SecureCallback& callback, |
42 int result) { | 44 int result) { |
43 DVLOG(1) << "Got back result " << result << " " << net::ErrorToString(result); | 45 DVLOG(1) << "Got back result " << result << " " << net::ErrorToString(result); |
44 | 46 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 // fail with an error above. | 304 // fail with an error above. |
303 if (status != net::OK) { | 305 if (status != net::OK) { |
304 DVLOG(1) << "Status is not OK or IO-pending: " | 306 DVLOG(1) << "Status is not OK or IO-pending: " |
305 << net::ErrorToString(status); | 307 << net::ErrorToString(status); |
306 } | 308 } |
307 connect_cb.Run(status); | 309 connect_cb.Run(status); |
308 } | 310 } |
309 } | 311 } |
310 | 312 |
311 } // namespace extensions | 313 } // namespace extensions |
312 | |
OLD | NEW |