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

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: Better comments, nit fix Created 8 years, 4 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 long resultCode; 49 long resultCode;
50 50
51 ArrayBuffer data; 51 ArrayBuffer data;
52 52
53 // The address of the remote machine. 53 // The address of the remote machine.
54 DOMString address; 54 DOMString address;
55 55
56 long port; 56 long port;
57 }; 57 };
58 58
59 dictionary SocketInfo {
60 // The type of the passed socket. This will be <code>tcp</code> or
61 // <code>udp</code>.
62 SocketType socketType;
63
64 // Whether or not the underlying socket is connected.
65 //
66 // For <code>tcp</code> sockets, this will remain true even if the remote
67 // peer has disconnected. Reading or writing to the socket may then result
68 // in an error, hinting that this socket should be disconnected via
69 // <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
70 boolean connected;
71
72 // If the underlying socket is connected, contains the IPv4/6 address of
73 // the peer.
74 DOMString? peerAddress;
75
76 // If the underlying socket is connected, contains the port of the
77 // connected peer.
78 long? peerPort;
79
80 // If the underlying socket is bound or connected, contains its local
81 /// IPv4/6 address.
miket_OOO 2012/07/30 16:53:10 Remove extra slash.
thorogood 2012/07/31 01:21:09 Done.
82 DOMString? localAddress;
83
84 // If the underlying socket is bound or connected, contains its local port.
85 long? localPort;
86 };
87
59 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); 88 callback RecvFromCallback = void (RecvFromInfo recvFromInfo);
60 89
61 callback SendToCallback = void (WriteInfo writeInfo); 90 callback SendToCallback = void (WriteInfo writeInfo);
62 91
63 callback SetKeepAliveCallback = void (boolean result); 92 callback SetKeepAliveCallback = void (boolean result);
64 93
65 callback SetNoDelayCallback = void (boolean result); 94 callback SetNoDelayCallback = void (boolean result);
66 95
96 callback GetInfoCallback = void (SocketInfo result);
97
67 interface Functions { 98 interface Functions {
68 // Creates a socket of the specified type that will connect to the specified 99 // Creates a socket of the specified type that will connect to the specified
69 // remote machine. 100 // remote machine.
70 // |type| : The type of socket to create. Must be <code>tcp</code> or 101 // |type| : The type of socket to create. Must be <code>tcp</code> or
71 // <code>udp</code>. 102 // <code>udp</code>.
72 // |options| : The socket options. 103 // |options| : The socket options.
73 // |callback| : Called when the socket has been created. 104 // |callback| : Called when the socket has been created.
74 static void create(SocketType type, 105 static void create(SocketType type,
75 optional CreateOptions options, 106 optional CreateOptions options,
76 CreateCallback callback); 107 CreateCallback callback);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 optional long delay, 186 optional long delay,
156 SetKeepAliveCallback callback); 187 SetKeepAliveCallback callback);
157 188
158 // Enable/disable Nagle algorithm. 189 // Enable/disable Nagle algorithm.
159 // |socketId| : The socketId. 190 // |socketId| : The socketId.
160 // |noDelay| : If true, disable Nagle algorithm. 191 // |noDelay| : If true, disable Nagle algorithm.
161 // |callback| : Called when the setNoDelay attempt is complete. 192 // |callback| : Called when the setNoDelay attempt is complete.
162 static void setNoDelay(long socketId, 193 static void setNoDelay(long socketId,
163 boolean noDelay, 194 boolean noDelay,
164 SetNoDelayCallback callback); 195 SetNoDelayCallback callback);
196
197 // 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
198 // |socketId| : The socketId.
199 // |callback| : Called when the state is available.
200 static void getInfo(long socketId,
201 GetInfoCallback callback);
165 }; 202 };
166 203
167 }; 204 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698