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

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

Issue 10790137: Adds socket.getInfo to the socket API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Better comments, nit fix Created 8 years, 5 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
index e405b48f28990623e0db120b711509439d4e3f74..55e3354427dcf32a27f4e168ad8d9547daa2d4bf 100644
--- a/chrome/common/extensions/api/experimental_socket.idl
+++ b/chrome/common/extensions/api/experimental_socket.idl
@@ -56,6 +56,35 @@ namespace experimental.socket {
long port;
};
+ dictionary SocketInfo {
+ // The type of the passed socket. This will be <code>tcp</code> or
+ // <code>udp</code>.
+ SocketType socketType;
+
+ // Whether or not the underlying socket is connected.
+ //
+ // For <code>tcp</code> sockets, this will remain true even if the remote
+ // peer has disconnected. Reading or writing to the socket may then result
+ // in an error, hinting that this socket should be disconnected via
+ // <code>disconnect()</code>.
miket_OOO 2012/07/30 16:53:10 We should say something here about what "connected
thorogood 2012/07/31 01:21:09 I've added a section for UDP, as well as updating
+ boolean connected;
+
+ // If the underlying socket is connected, contains the IPv4/6 address of
+ // the peer.
+ DOMString? peerAddress;
+
+ // If the underlying socket is connected, contains the port of the
+ // connected peer.
+ long? peerPort;
+
+ // If the underlying socket is bound or connected, contains its local
+ /// IPv4/6 address.
miket_OOO 2012/07/30 16:53:10 Remove extra slash.
thorogood 2012/07/31 01:21:09 Done.
+ DOMString? localAddress;
+
+ // If the underlying socket is bound or connected, contains its local port.
+ long? localPort;
+ };
+
callback RecvFromCallback = void (RecvFromInfo recvFromInfo);
callback SendToCallback = void (WriteInfo writeInfo);
@@ -64,6 +93,8 @@ namespace experimental.socket {
callback SetNoDelayCallback = void (boolean result);
+ callback GetInfoCallback = void (SocketInfo result);
+
interface Functions {
// Creates a socket of the specified type that will connect to the specified
// remote machine.
@@ -162,6 +193,12 @@ namespace experimental.socket {
static void setNoDelay(long socketId,
boolean noDelay,
SetNoDelayCallback callback);
+
+ // Retrieve the state of the given socket.
miket_OOO 2012/07/30 16:53:10 "Retrieves" to match the voice of earlier docs. (W
thorogood 2012/07/31 01:21:09 Done. I've also updated the setNoDelay comment jus
+ // |socketId| : The socketId.
+ // |callback| : Called when the state is available.
+ static void getInfo(long socketId,
+ GetInfoCallback callback);
};
};

Powered by Google App Engine
This is Rietveld 408576698