Index: chrome/common/extensions/api/experimental_socket.idl |
diff --git a/chrome/common/extensions/api/experimental_socket.idl b/chrome/common/extensions/api/experimental_socket.idl |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7165cd932c25b80da0d0e243c0b38479ae18bc88 |
--- /dev/null |
+++ b/chrome/common/extensions/api/experimental_socket.idl |
@@ -0,0 +1,40 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+namespace experimental.socket { |
miket_OOO
2012/09/24 18:14:21
Please take a look at "[extensions-team] Mixing st
justinlin
2012/09/26 08:59:59
Done.
|
+ |
+ dictionary AcceptInfo { |
+ // The id of the accepted socket. |
+ long socketId; |
+ long resultCode; |
+ }; |
+ |
+ callback ListenCallback = void (long result); |
+ |
+ callback AcceptCallback = void (AcceptInfo acceptInfo); |
+ |
+ interface Functions { |
+ // 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. |
+ // |address| : The address of the local machine. |
+ // |port| : The port of the local machine. |
+ // |backlog| : Length of the socket's accept queue. |
+ static void listen(long socketId, |
+ DOMString address, |
+ long port, |
+ 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); |
+ }; |
+ |
+}; |