Index: chrome/common/extensions/api/socket.idl |
diff --git a/chrome/common/extensions/api/socket.idl b/chrome/common/extensions/api/socket.idl |
index 95bf7cbbf464dd5bd5481aba96014bbf12a89ef0..dbaea8e6055aa92d790e7eaa4f2dd3d67ba5bd32 100644 |
--- a/chrome/common/extensions/api/socket.idl |
+++ b/chrome/common/extensions/api/socket.idl |
@@ -19,12 +19,22 @@ namespace socket { |
long socketId; |
}; |
+ dictionary AcceptInfo { |
+ // The id of the accepted socket. |
+ long socketId; |
+ long resultCode; |
+ }; |
+ |
callback CreateCallback = void (CreateInfo createInfo); |
callback ConnectCallback = void (long result); |
callback BindCallback = void (long result); |
+ callback ListenCallback = void (long result); |
+ |
+ callback AcceptCallback = void (AcceptInfo acceptInfo); |
+ |
dictionary ReadInfo { |
// The resultCode returned from the underlying read() call. |
long resultCode; |
@@ -123,8 +133,7 @@ namespace socket { |
long port, |
ConnectCallback callback); |
- // Binds the local address for socket. Currently, it does not support |
- // TCP socket. |
+ // Binds the local address for socket. |
// |socketId| : The socketId. |
// |address| : The address of the local machine. |
// |port| : The port of the local machine. |
@@ -134,6 +143,25 @@ namespace socket { |
long port, |
BindCallback callback); |
+ // This method applies to TCP sockets only. |
+ // Listens on the specified port that this socket was bound to. |
+ // This effectively makes this a server socket and client socket functions |
+ // can no longer be used on this socket. |
+ // |socketId| : The socketId. |
+ // |backlog| : Length of the socket's listen queue. |
+ static void listen(long socketId, |
+ long backlog, |
+ ListenCallback callback); |
+ |
+ // This method applies to TCP sockets only. |
+ // Start waiting for connections on the server socket. The listen function |
+ // must be called first. |
+ // |socketId| : The socketId. |
+ // |callback| : The callback is invoked when a new socket is accepted. The |
+ // parameters contain information about the newly accepted socket. |
+ static void accept(long socketId, |
+ AcceptCallback callback); |
+ |
// Disconnects the socket. For UDP sockets, <code>disconnect</code> is a |
// non-operation but is safe to call. |
// |socketId| : The socketId. |