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

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

Issue 76403004: An implementation of chrome.socket.secure(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Double. Spaces removed. Created 6 years, 10 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
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..542b39f702a9ef607cf8d5b902add20970a6d484 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; }
+
+ // |address| is a resolved IP address. Call set_hostname() to save the
+ // original DNS name of the host if this socket may later get upgraded to
+ // TLS (see TLSSocket::UpgradeSocketToTLS()).
Ryan Sleevi 2014/02/24 20:06:49 Comment wise, this wording seems a bit on the wish
lally 2014/02/27 17:05:59 Done.
virtual void Connect(const std::string& address,
int port,
const CompletionCallback& callback) = 0;
@@ -102,7 +107,9 @@ class Socket : public ApiResource {
const net::CompletionCallback& callback) = 0;
virtual void OnWriteComplete(int result);
- const std::string address_;
+ // The DNS name of the host that this socket is connected to, used when
+ // verifying a TLS certificate.
Ryan Sleevi 2014/02/24 20:06:49 // The hostname of the remote host that this socke
lally 2014/02/27 17:05:59 I had to investigate to find out what the upper-la
Ryan Sleevi 2014/03/12 23:35:27 At least the SSLSocket layer expects the canonical
+ std::string hostname_;
bool is_connected_;
private:

Powered by Google App Engine
This is Rietveld 408576698