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 14f31375c1e20942e66645ed626efb07a68323db..e6fa010969c1382e3c693f0883411682270bb779 100644 |
| --- a/chrome/browser/extensions/api/socket/socket_api.h |
| +++ b/chrome/browser/extensions/api/socket/socket_api.h |
| @@ -11,6 +11,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> |
| @@ -160,6 +161,41 @@ class SocketBindFunction : public SocketAsyncApiFunction { |
| int port_; |
| }; |
| +class SocketListenFunction : public SocketAsyncApiFunction { |
| + public: |
| + DECLARE_EXTENSION_FUNCTION_NAME("socket.listen"); |
|
Peng
2012/09/11 14:01:18
maybe experimental first?
justinlin
2012/09/12 07:29:42
Sure, but it doesn't seem to work when I just add
Peng
2012/09/12 19:49:49
I think you need create another idl file which jus
justinlin
2012/09/13 08:21:12
Done. Thanks!
|
| + |
| + 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") |