Index: chrome/common/extensions/api/socket.idl |
diff --git a/chrome/common/extensions/api/socket.idl b/chrome/common/extensions/api/socket.idl |
index d417d9b227053fb5842ee4f622280976b5de8552..2bc944e0e39ed8e65d61a1f33f26ede4b4af1a43 100644 |
--- a/chrome/common/extensions/api/socket.idl |
+++ b/chrome/common/extensions/api/socket.idl |
@@ -17,12 +17,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; |
@@ -132,8 +142,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. |
@@ -143,6 +152,23 @@ namespace socket { |
long port, |
BindCallback callback); |
+ // This method applies to TCP sockets only. |
+ // Listens for connections on the specified port that this socket was bound |
+ // to. This effectively makes this a server socket and client socket |
+ // functions (connect, read, write) can no longer be used on this socket. |
+ // |socketId| : The socketId. |
+ // |backlog| : Length of the socket's accept queue. |
+ static void listen(long socketId, |
+ long backlog, |
+ ListenCallback callback); |
+ |
+ // This method applies to TCP sockets only. |
+ // Starts waiting for connections on the listening server socket. |
+ // |socketId| : The socketId. |
+ // |callback| : The callback is invoked when a new socket is accepted. |
+ 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. |