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 <string> | 8 #include <string> |
9 | 9 |
10 #include "extensions/browser/api/socket/socket.h" | 10 #include "extensions/browser/api/socket/socket.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 TLSSocket(scoped_ptr<net::StreamSocket> tls_socket, | 39 TLSSocket(scoped_ptr<net::StreamSocket> tls_socket, |
40 const std::string& owner_extension_id); | 40 const std::string& owner_extension_id); |
41 | 41 |
42 ~TLSSocket() override; | 42 ~TLSSocket() override; |
43 | 43 |
44 // Most of these methods either fail or forward the method call on to the | 44 // Most of these methods either fail or forward the method call on to the |
45 // inner net::StreamSocket. The remaining few do actual TLS work. | 45 // inner net::StreamSocket. The remaining few do actual TLS work. |
46 | 46 |
47 // Fails. | 47 // Fails. |
48 void Connect(const std::string& address, | 48 void Connect(const std::string& address, |
49 int port, | 49 uint16 port, |
50 const CompletionCallback& callback) override; | 50 const CompletionCallback& callback) override; |
51 // Forwards. | 51 // Forwards. |
52 void Disconnect() override; | 52 void Disconnect() override; |
53 | 53 |
54 // Attempts to read |count| bytes of decrypted data from the TLS socket, | 54 // Attempts to read |count| bytes of decrypted data from the TLS socket, |
55 // invoking |callback| with the actual number of bytes read, or a network | 55 // invoking |callback| with the actual number of bytes read, or a network |
56 // error code if an error occurred. | 56 // error code if an error occurred. |
57 void Read(int count, const ReadCompletionCallback& callback) override; | 57 void Read(int count, const ReadCompletionCallback& callback) override; |
58 | 58 |
59 // Fails. This should have been called on the TCP socket before secure() was | 59 // Fails. This should have been called on the TCP socket before secure() was |
60 // invoked. | 60 // invoked. |
61 bool SetKeepAlive(bool enable, int delay) override; | 61 bool SetKeepAlive(bool enable, int delay) override; |
62 | 62 |
63 // Fails. This should have been called on the TCP socket before secure() was | 63 // Fails. This should have been called on the TCP socket before secure() was |
64 // invoked. | 64 // invoked. |
65 bool SetNoDelay(bool no_delay) override; | 65 bool SetNoDelay(bool no_delay) override; |
66 | 66 |
67 // Fails. TLSSocket is only a client. | 67 // Fails. TLSSocket is only a client. |
68 int Listen(const std::string& address, | 68 int Listen(const std::string& address, |
69 int port, | 69 uint16 port, |
70 int backlog, | 70 int backlog, |
71 std::string* error_msg) override; | 71 std::string* error_msg) override; |
72 | 72 |
73 // Fails. TLSSocket is only a client. | 73 // Fails. TLSSocket is only a client. |
74 void Accept(const AcceptCompletionCallback& callback) override; | 74 void Accept(const AcceptCompletionCallback& callback) override; |
75 | 75 |
76 // Forwards. | 76 // Forwards. |
77 bool IsConnected() override; | 77 bool IsConnected() override; |
78 | 78 |
79 // Forwards. | 79 // Forwards. |
(...skipping 30 matching lines...) Expand all Loading... |
110 int result); | 110 int result); |
111 | 111 |
112 scoped_ptr<net::StreamSocket> tls_socket_; | 112 scoped_ptr<net::StreamSocket> tls_socket_; |
113 ReadCompletionCallback read_callback_; | 113 ReadCompletionCallback read_callback_; |
114 }; | 114 }; |
115 | 115 |
116 } // namespace extensions | 116 } // namespace extensions |
117 | 117 |
118 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ | 118 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TLS_SOCKET_H_ |
119 | 119 |
OLD | NEW |