| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "extensions/browser/api/socket/socket.h" | 12 #include "extensions/browser/api/socket/socket.h" |
| 13 #include "extensions/browser/api/socket/socket_api.h" | 13 #include "extensions/browser/api/socket/socket_api.h" |
| 14 #include "extensions/browser/api/socket/tcp_socket.h" | 14 #include "extensions/browser/api/socket/tcp_socket.h" |
| 15 #include "net/ssl/ssl_config_service.h" | 15 #include "net/ssl/ssl_config_service.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class Socket; | 18 class Socket; |
| 19 class CertVerifier; | 19 class CertVerifier; |
| 20 class CTPolicyEnforcer; |
| 21 class CTVerifier; |
| 20 class TransportSecurityState; | 22 class TransportSecurityState; |
| 21 } | 23 } |
| 22 | 24 |
| 23 namespace extensions { | 25 namespace extensions { |
| 24 | 26 |
| 25 class TLSSocket; | 27 class TLSSocket; |
| 26 | 28 |
| 27 // TLS Sockets from the chrome.socket and chrome.sockets.tcp APIs. A regular | 29 // TLS Sockets from the chrome.socket and chrome.sockets.tcp APIs. A regular |
| 28 // TCPSocket is converted to a TLSSocket via chrome.socket.secure() or | 30 // TCPSocket is converted to a TLSSocket via chrome.socket.secure() or |
| 29 // chrome.sockets.tcp.secure(). The inheritance here is for interface API | 31 // chrome.sockets.tcp.secure(). The inheritance here is for interface API |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // may be NULL. | 93 // may be NULL. |
| 92 // Note: |callback| may be synchronously invoked before | 94 // Note: |callback| may be synchronously invoked before |
| 93 // UpgradeSocketToTLS() returns. Currently using the older chrome.socket | 95 // UpgradeSocketToTLS() returns. Currently using the older chrome.socket |
| 94 // version of SecureOptions, to avoid having the older API implementation | 96 // version of SecureOptions, to avoid having the older API implementation |
| 95 // depend on the newer one. | 97 // depend on the newer one. |
| 96 static void UpgradeSocketToTLS( | 98 static void UpgradeSocketToTLS( |
| 97 Socket* socket, | 99 Socket* socket, |
| 98 scoped_refptr<net::SSLConfigService> config_service, | 100 scoped_refptr<net::SSLConfigService> config_service, |
| 99 net::CertVerifier* cert_verifier, | 101 net::CertVerifier* cert_verifier, |
| 100 net::TransportSecurityState* transport_security_state, | 102 net::TransportSecurityState* transport_security_state, |
| 103 net::CTVerifier* ct_verifier, |
| 104 net::CTPolicyEnforcer* ct_policy_enforcer, |
| 101 const std::string& extension_id, | 105 const std::string& extension_id, |
| 102 api::socket::SecureOptions* options, | 106 api::socket::SecureOptions* options, |
| 103 const SecureCallback& callback); | 107 const SecureCallback& callback); |
| 104 | 108 |
| 105 private: | 109 private: |
| 106 int WriteImpl(net::IOBuffer* io_buffer, | 110 int WriteImpl(net::IOBuffer* io_buffer, |
| 107 int io_buffer_size, | 111 int io_buffer_size, |
| 108 const net::CompletionCallback& callback) override; | 112 const net::CompletionCallback& callback) override; |
| 109 | 113 |
| 110 void OnReadComplete(const scoped_refptr<net::IOBuffer>& io_buffer, | 114 void OnReadComplete(const scoped_refptr<net::IOBuffer>& io_buffer, |
| 111 int result); | 115 int result); |
| 112 | 116 |
| 113 std::unique_ptr<net::StreamSocket> tls_socket_; | 117 std::unique_ptr<net::StreamSocket> tls_socket_; |
| 114 ReadCompletionCallback read_callback_; | 118 ReadCompletionCallback read_callback_; |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 } // namespace extensions | 121 } // namespace extensions |
| 118 | 122 |
| 119 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ | 123 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ |
| 120 | 124 |
| OLD | NEW |