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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // File-level comment to appease parser. Eventually this will not be necessary. 5 // File-level comment to appease parser. Eventually this will not be necessary.
6 6
7 namespace experimental.socket { 7 namespace experimental.socket {
8 enum SocketType { 8 enum SocketType {
9 tcp, 9 tcp,
10 udp 10 udp
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 dictionary RecvFromInfo { 47 dictionary RecvFromInfo {
48 // The resultCode returned from the underlying read() call. 48 // The resultCode returned from the underlying read() call.
49 long resultCode; 49 long resultCode;
50 50
51 ArrayBuffer data; 51 ArrayBuffer data;
52 DOMString address; 52 DOMString address;
53 long port; 53 long port;
54 }; 54 };
55 55
56 dictionary SocketInfo {
57 // The type of the passed socket.
58 SocketType socketType;
59
60 // Whether this socket is currently connected.
61 boolean connected;
62
63 // Optionally represents the connected peer on this socket. This will be
64 // 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.
65 DOMString? peer;
66
67 // If bound, this is the local address of this socket. This will be in the
68 // form <code>ip:port</code>, e.g., <code>[::0]:80</code>.
69 DOMString? local;
70 };
71
56 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); 72 callback RecvFromCallback = void (RecvFromInfo recvFromInfo);
57 73
58 callback SendToCallback = void (WriteInfo writeInfo); 74 callback SendToCallback = void (WriteInfo writeInfo);
59 75
60 callback SetKeepAliveCallback = void (boolean result); 76 callback SetKeepAliveCallback = void (boolean result);
61 77
62 callback SetNoDelayCallback = void (boolean result); 78 callback SetNoDelayCallback = void (boolean result);
63 79
80 callback GetInfoCallback = void (SocketInfo result);
81
64 interface Functions { 82 interface Functions {
65 // Creates a socket of the specified type that will connect to the specified 83 // Creates a socket of the specified type that will connect to the specified
66 // remote machine. 84 // remote machine.
67 // |type| : The type of socket to create. Must be <code>tcp</code> or 85 // |type| : The type of socket to create. Must be <code>tcp</code> or
68 // <code>udp</code>. 86 // <code>udp</code>.
69 // |options| : The socket options. 87 // |options| : The socket options.
70 // |callback| : Called when the socket has been created. 88 // |callback| : Called when the socket has been created.
71 static void create(SocketType type, 89 static void create(SocketType type,
72 optional CreateOptions options, 90 optional CreateOptions options,
73 CreateCallback callback); 91 CreateCallback callback);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 optional long delay, 175 optional long delay,
158 SetKeepAliveCallback callback); 176 SetKeepAliveCallback callback);
159 177
160 // Enable/disable Nagle algorithm. 178 // Enable/disable Nagle algorithm.
161 // |socketId| : The socketId. 179 // |socketId| : The socketId.
162 // |noDelay| : If true, disable Nagle algorithm. 180 // |noDelay| : If true, disable Nagle algorithm.
163 // |callback| : Called when the setNoDelay attempt is complete. 181 // |callback| : Called when the setNoDelay attempt is complete.
164 static void setNoDelay(long socketId, 182 static void setNoDelay(long socketId,
165 boolean noDelay, 183 boolean noDelay,
166 SetNoDelayCallback callback); 184 SetNoDelayCallback callback);
185
186 // Retrieve the state of the given socket.
187 // |socketId| : The socketId.
188 // |callback| : Called when the state is available.
189 static void getInfo(long socketId,
190 GetInfoCallback callback);
benwells 2012/07/24 08:05:33 nit: indentation
thorogood 2012/07/26 01:49:59 Done.
167 }; 191 };
168 192
169 }; 193 };
OLDNEW
« 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