| 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> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // chrome.sockets.tcp.secure(). The inheritance here is for interface API | 29 // chrome.sockets.tcp.secure(). The inheritance here is for interface API |
| 30 // compatibility, not for the implementation that comes with it. TLSSocket | 30 // compatibility, not for the implementation that comes with it. TLSSocket |
| 31 // does not use its superclass's socket state, so all methods are overridden | 31 // does not use its superclass's socket state, so all methods are overridden |
| 32 // here to prevent any access of ResumableTCPSocket's socket state. Except | 32 // here to prevent any access of ResumableTCPSocket's socket state. Except |
| 33 // for the implementation of a write queue in Socket::Write() (a super-super | 33 // for the implementation of a write queue in Socket::Write() (a super-super |
| 34 // class of ResumableTCPSocket). That implementation only queues and | 34 // class of ResumableTCPSocket). That implementation only queues and |
| 35 // serializes invocations to WriteImpl(), implemented here, and does not | 35 // serializes invocations to WriteImpl(), implemented here, and does not |
| 36 // touch any socket state. | 36 // touch any socket state. |
| 37 class TLSSocket : public ResumableTCPSocket { | 37 class TLSSocket : public ResumableTCPSocket { |
| 38 public: | 38 public: |
| 39 typedef base::Callback<void(scoped_ptr<TLSSocket>, int)> SecureCallback; | 39 typedef base::Callback<void(std::unique_ptr<TLSSocket>, int)> SecureCallback; |
| 40 | 40 |
| 41 TLSSocket(scoped_ptr<net::StreamSocket> tls_socket, | 41 TLSSocket(std::unique_ptr<net::StreamSocket> tls_socket, |
| 42 const std::string& owner_extension_id); | 42 const std::string& owner_extension_id); |
| 43 | 43 |
| 44 ~TLSSocket() override; | 44 ~TLSSocket() override; |
| 45 | 45 |
| 46 // Most of these methods either fail or forward the method call on to the | 46 // Most of these methods either fail or forward the method call on to the |
| 47 // inner net::StreamSocket. The remaining few do actual TLS work. | 47 // inner net::StreamSocket. The remaining few do actual TLS work. |
| 48 | 48 |
| 49 // Fails. | 49 // Fails. |
| 50 void Connect(const net::AddressList& address, | 50 void Connect(const net::AddressList& address, |
| 51 const CompletionCallback& callback) override; | 51 const CompletionCallback& callback) override; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const SecureCallback& callback); | 103 const SecureCallback& callback); |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 int WriteImpl(net::IOBuffer* io_buffer, | 106 int WriteImpl(net::IOBuffer* io_buffer, |
| 107 int io_buffer_size, | 107 int io_buffer_size, |
| 108 const net::CompletionCallback& callback) override; | 108 const net::CompletionCallback& callback) override; |
| 109 | 109 |
| 110 void OnReadComplete(const scoped_refptr<net::IOBuffer>& io_buffer, | 110 void OnReadComplete(const scoped_refptr<net::IOBuffer>& io_buffer, |
| 111 int result); | 111 int result); |
| 112 | 112 |
| 113 scoped_ptr<net::StreamSocket> tls_socket_; | 113 std::unique_ptr<net::StreamSocket> tls_socket_; |
| 114 ReadCompletionCallback read_callback_; | 114 ReadCompletionCallback read_callback_; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace extensions | 117 } // namespace extensions |
| 118 | 118 |
| 119 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ | 119 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ |
| 120 | 120 |
| OLD | NEW |