Chromium Code Reviews| Index: chrome/browser/extensions/api/socket/socket_api.h |
| diff --git a/chrome/browser/extensions/api/socket/socket_api.h b/chrome/browser/extensions/api/socket/socket_api.h |
| index c52bf6dd5ce64ca386efad81e0396d4e05ac32cc..21c1938d58296cd15d40d451b7e45f222ee48b85 100644 |
| --- a/chrome/browser/extensions/api/socket/socket_api.h |
| +++ b/chrome/browser/extensions/api/socket/socket_api.h |
| @@ -21,6 +21,8 @@ class IOThread; |
| namespace net { |
| class IOBuffer; |
| +class URLRequestContextGetter; |
| +class SSLClientSocket; |
| } |
| namespace extensions { |
| @@ -41,6 +43,8 @@ class SocketResourceManagerInterface { |
| int api_resource_id) = 0; |
| virtual void Remove(const std::string& extension_id, |
| int api_resource_id) = 0; |
| + virtual void Set(const std::string& extension_id, int api_resource_id, |
| + Socket *socket) = 0; |
| virtual base::hash_set<int>* GetResourceIds( |
| const std::string& extension_id) = 0; |
| }; |
| @@ -73,6 +77,11 @@ class SocketResourceManager : public SocketResourceManagerInterface { |
| return manager_->Get(extension_id, api_resource_id); |
| } |
| + virtual void Set(const std::string& extension_id, int api_resource_id, |
| + Socket *socket) OVERRIDE { |
| + manager_->Set(extension_id, api_resource_id, static_cast<T*>(socket)); |
| + } |
| + |
| virtual void Remove(const std::string& extension_id, |
| int api_resource_id) OVERRIDE { |
| manager_->Remove(extension_id, api_resource_id); |
| @@ -103,6 +112,7 @@ class SocketAsyncApiFunction : public AsyncApiFunction { |
| int AddSocket(Socket* socket); |
| Socket* GetSocket(int api_resource_id); |
| + void SetSocket(int api_resource_id, Socket* socket); |
| void RemoveSocket(int api_resource_id); |
| base::hash_set<int>* GetSocketIds(); |
| @@ -504,6 +514,31 @@ class SocketGetJoinedGroupsFunction : public SocketAsyncApiFunction { |
| private: |
| scoped_ptr<api::socket::GetJoinedGroups::Params> params_; |
| }; |
| + |
| +class SocketSecureFunction : public SocketAsyncApiFunction { |
| + public: |
| + DECLARE_EXTENSION_FUNCTION("socket.secure", SOCKET_SECURE); |
| + SocketSecureFunction(); |
| + |
| + protected: |
| + virtual ~SocketSecureFunction(); |
| + |
| + // AsyncApiFunction |
| + virtual bool Prepare() OVERRIDE; |
| + virtual void Work() OVERRIDE; |
| + virtual void AsyncWorkStart() OVERRIDE; |
| + |
| + private: |
| + void TlsConnectDone(int result); // Invoked from SSLClientSocket::SetupTLS. |
| + |
| + scoped_ptr<api::socket::Secure::Params> params_; |
| + net::URLRequestContextGetter* url_request_getter_; |
| + // The new SSL stream we're running over the existing TCP socket. |
|
Ryan Sleevi
2013/11/25 17:30:13
"we" / Pronouns in comments considered harmful.
h
Lally Singh
2013/12/05 17:07:12
Done.
|
| + scoped_ptr<net::SSLClientSocket> ssl_socket_; |
| + // The socket we're securing. |
|
Ryan Sleevi
2013/11/25 17:30:13
same nit
Lally Singh
2013/12/05 17:07:12
Done.
|
| + net::TCPClientSocket* underlying_socket_; |
| +}; |
| + |
| } // namespace extensions |
| #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |