Chromium Code Reviews| Index: chrome/browser/extensions/api/socket/socket.h |
| diff --git a/chrome/browser/extensions/api/socket/socket.h b/chrome/browser/extensions/api/socket/socket.h |
| index 2e73cb0d1fee27a496af8b9d77ca2f0a4391b8e5..4ac2fc92c17416c211b10f0bf7a71aa1c344c784 100644 |
| --- a/chrome/browser/extensions/api/socket/socket.h |
| +++ b/chrome/browser/extensions/api/socket/socket.h |
| @@ -39,12 +39,17 @@ typedef base::Callback< |
| // we need to manage it in the context of an extension. |
| class Socket : public ApiResource { |
| public: |
| - enum SocketType { |
| - TYPE_TCP, |
| - TYPE_UDP, |
| - }; |
| + enum SocketType { TYPE_TCP, TYPE_UDP, TYPE_TLS }; |
| virtual ~Socket(); |
| + |
| + const std::string& hostname() const { return hostname_; } |
| + |
| + void set_hostname(const std::string& hostname) { hostname_ = hostname; } |
| + |
| + // Note: |address| contains the resolved IP address, not the hostname of |
| + // the remote endpoint. In order to upgrade this socket to TLS, callers |
| + // must also supply the hostname of the endpoint via |set_hostname()|. |
| virtual void Connect(const std::string& address, |
| int port, |
| const CompletionCallback& callback) = 0; |
| @@ -102,7 +107,11 @@ class Socket : public ApiResource { |
| const net::CompletionCallback& callback) = 0; |
| virtual void OnWriteComplete(int result); |
| - const std::string address_; |
| + // The hostname of the remote host that this socket is connected to. Note: |
| + // This may contain an IP literal. In the case of IDNs, this will contain |
|
Ryan Sleevi
2014/03/12 23:35:27
nit
lally
2014/03/17 01:58:06
Done.
|
| + // a series of U-LABELs (UTF-8), not A-LABELs. IP literals for IPv6 will |
|
Ryan Sleevi
2014/03/12 23:35:27
nit
lally
2014/03/17 01:58:06
Done.
|
| + // be unbracketed. |
| + std::string hostname_; |
| bool is_connected_; |
| private: |