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 EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_ |
6 #define EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 23 matching lines...) Expand all Loading... |
34 RecvFromCompletionCallback; | 34 RecvFromCompletionCallback; |
35 typedef base::Callback<void(int, net::TCPClientSocket*)> | 35 typedef base::Callback<void(int, net::TCPClientSocket*)> |
36 AcceptCompletionCallback; | 36 AcceptCompletionCallback; |
37 | 37 |
38 // A Socket wraps a low-level socket and includes housekeeping information that | 38 // A Socket wraps a low-level socket and includes housekeeping information that |
39 // we need to manage it in the context of an extension. | 39 // we need to manage it in the context of an extension. |
40 class Socket : public ApiResource { | 40 class Socket : public ApiResource { |
41 public: | 41 public: |
42 enum SocketType { TYPE_TCP, TYPE_UDP, TYPE_TLS }; | 42 enum SocketType { TYPE_TCP, TYPE_UDP, TYPE_TLS }; |
43 | 43 |
44 virtual ~Socket(); | 44 ~Socket() override; |
45 | 45 |
46 // The hostname of the remote host that this socket is connected to. This | 46 // The hostname of the remote host that this socket is connected to. This |
47 // may be the empty string if the client does not intend to ever upgrade the | 47 // may be the empty string if the client does not intend to ever upgrade the |
48 // socket to TLS, and thusly has not invoked set_hostname(). | 48 // socket to TLS, and thusly has not invoked set_hostname(). |
49 const std::string& hostname() const { return hostname_; } | 49 const std::string& hostname() const { return hostname_; } |
50 | 50 |
51 // Set the hostname of the remote host that this socket is connected to. | 51 // Set the hostname of the remote host that this socket is connected to. |
52 // Note: This may be an IP literal. In the case of IDNs, this should be a | 52 // Note: This may be an IP literal. In the case of IDNs, this should be a |
53 // series of U-LABELs (UTF-8), not A-LABELs. IP literals for IPv6 will be | 53 // series of U-LABELs (UTF-8), not A-LABELs. IP literals for IPv6 will be |
54 // unbracketed. | 54 // unbracketed. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 CompletionCallback callback; | 132 CompletionCallback callback; |
133 int bytes_written; | 133 int bytes_written; |
134 }; | 134 }; |
135 std::queue<WriteRequest> write_queue_; | 135 std::queue<WriteRequest> write_queue_; |
136 scoped_refptr<net::IOBuffer> io_buffer_write_; | 136 scoped_refptr<net::IOBuffer> io_buffer_write_; |
137 }; | 137 }; |
138 | 138 |
139 } // namespace extensions | 139 } // namespace extensions |
140 | 140 |
141 #endif // EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_ | 141 #endif // EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_ |
OLD | NEW |