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

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: Adds tests 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 bb17d763ca27f4ffc83d182dadbbe306a2d3c973..e308314e9645c3b688a82eb52d6e9a55c7f6d5d1 100644
--- a/chrome/common/extensions/api/experimental_socket.idl
+++ b/chrome/common/extensions/api/experimental_socket.idl
@@ -53,6 +53,22 @@ namespace experimental.socket {
long port;
};
+ dictionary SocketInfo {
+ // The type of the passed socket.
+ SocketType socketType;
+
+ // Whether this socket is currently connected.
+ boolean connected;
+
+ // Optionally represents the connected peer on this socket. This will be
+ // in the form <code>ip:port</code>, e.g., <code>10.0.0.1:1234</code>.
benwells 2012/07/24 08:05:33 Does it make more sense to have the port available
thorogood 2012/07/26 01:49:59 Yes, probably. I've broken it out.
+ DOMString? peer;
+
+ // If bound, this is the local address of this socket. This will be in the
+ // form <code>ip:port</code>, e.g., <code>[::0]:80</code>.
+ DOMString? local;
+ };
+
callback RecvFromCallback = void (RecvFromInfo recvFromInfo);
callback SendToCallback = void (WriteInfo writeInfo);
@@ -61,6 +77,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.
@@ -164,6 +182,12 @@ namespace experimental.socket {
static void setNoDelay(long socketId,
boolean noDelay,
SetNoDelayCallback callback);
+
+ // Retrieve the state of the given socket.
+ // |socketId| : The socketId.
+ // |callback| : Called when the state is available.
+ static void getInfo(long socketId,
+ GetInfoCallback callback);
benwells 2012/07/24 08:05:33 nit: indentation
thorogood 2012/07/26 01:49:59 Done.
};
};
« no previous file with comments | « chrome/browser/extensions/api/socket/udp_socket.cc ('k') | chrome/test/data/extensions/api_test/socket/api/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698