Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: extensions/browser/api/socket/socket.h

Issue 76403004: An implementation of chrome.socket.secure(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Morning LKGR Rebase. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/api/api_resource_manager.h ('k') | extensions/browser/api/socket/socket_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/socket/socket.h
diff --git a/extensions/browser/api/socket/socket.h b/extensions/browser/api/socket/socket.h
index 9ae45e7ac1dcff4754b601e87fd4bf50a152de41..255ee181c4b19fc643fcc3e0e42590439532e5fb 100644
--- a/extensions/browser/api/socket/socket.h
+++ b/extensions/browser/api/socket/socket.h
@@ -39,9 +39,24 @@ typedef base::Callback<void(int, net::TCPClientSocket*)>
// 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();
+
+ // The hostname of the remote host that this socket is connected to. This
+ // may be the empty string if the client does not intend to ever upgrade the
+ // socket to TLS, and thusly has not invoked set_hostname().
+ const std::string& hostname() const { return hostname_; }
+
+ // Set the hostname of the remote host that this socket is connected to.
+ // Note: This may be an IP literal. In the case of IDNs, this should be a
+ // series of U-LABELs (UTF-8), not A-LABELs. IP literals for IPv6 will be
+ // unbracketed.
+ 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;
@@ -100,7 +115,7 @@ class Socket : public ApiResource {
const net::CompletionCallback& callback) = 0;
virtual void OnWriteComplete(int result);
- const std::string address_;
+ std::string hostname_;
bool is_connected_;
private:
« no previous file with comments | « extensions/browser/api/api_resource_manager.h ('k') | extensions/browser/api/socket/socket_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698