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

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

Issue 10827390: Implement chrome.socket.bind/listen/accept for TCP server socket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 8 years, 3 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 | « chrome/browser/extensions/api/socket/socket.cc ('k') | chrome/browser/extensions/api/socket/socket_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3b5e835c2b490ff015f9597595702fd41cf91471..bad541737424ef243161c7994f27156c1a6e03e8 100644
--- a/chrome/browser/extensions/api/socket/socket_api.h
+++ b/chrome/browser/extensions/api/socket/socket_api.h
@@ -12,6 +12,7 @@
#include "chrome/common/extensions/api/socket.h"
#include "net/base/address_list.h"
#include "net/base/host_resolver.h"
+#include "net/socket/tcp_client_socket.h"
#include <string>
@@ -164,6 +165,41 @@ class SocketBindFunction : public SocketAsyncApiFunction {
int port_;
};
+class SocketListenFunction : public SocketAsyncApiFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("socket.listen");
+
+ SocketListenFunction();
+
+ protected:
+ virtual ~SocketListenFunction();
+
+ // AsyncApiFunction:
+ virtual bool Prepare() OVERRIDE;
+ virtual void Work() OVERRIDE;
+
+ private:
+ scoped_ptr<api::socket::Listen::Params> params_;
+};
+
+class SocketAcceptFunction : public SocketAsyncApiFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("socket.accept");
+
+ SocketAcceptFunction();
+
+ protected:
+ virtual ~SocketAcceptFunction();
+
+ // AsyncApiFunction:
+ virtual bool Prepare() OVERRIDE;
+ virtual void AsyncWorkStart() OVERRIDE;
+
+ private:
+ void OnAccept(int result_code, net::TCPClientSocket *socket);
+ scoped_ptr<api::socket::Accept::Params> params_;
+};
+
class SocketReadFunction : public SocketAsyncApiFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("socket.read")
« no previous file with comments | « chrome/browser/extensions/api/socket/socket.cc ('k') | chrome/browser/extensions/api/socket/socket_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698