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

Unified Diff: chrome/common/extensions/api/experimental_socket.idl

Issue 10827390: Implement chrome.socket.bind/listen/accept for TCP server socket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert net::socket change, check permissions for listen. 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
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..3944e775203654b0150a9f01587706fe55ef6bd3
--- /dev/null
+++ b/chrome/common/extensions/api/experimental_socket.idl
@@ -0,0 +1,36 @@
+// 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 {
+
+ 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.
+ // |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);
+ };
+
+};

Powered by Google App Engine
This is Rietveld 408576698