OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Use the <code>chrome.sockets.tcp</code> API to send and receive data over the | 5 // Use the <code>chrome.sockets.tcp</code> API to send and receive data over the |
6 // network using TCP connections. This API supersedes the TCP functionality | 6 // network using TCP connections. This API supersedes the TCP functionality |
7 // previously found in the <code>chrome.socket</code> API. Note that the socket | 7 // previously found in the <code>chrome.socket</code> API. Note that the socket |
8 // ids created from this namespace are not compatible with ids created in other | 8 // ids created from this namespace are not compatible with ids created in other |
9 // namespaces. | 9 // namespaces. |
10 namespace sockets.tcp { | 10 namespace sockets.tcp { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 // Callback from the <code>setKeepAliveCallback<code> method. | 73 // Callback from the <code>setKeepAliveCallback<code> method. |
74 // |result| : The result code returned from the underlying network call. | 74 // |result| : The result code returned from the underlying network call. |
75 // A negative value indicates an error. | 75 // A negative value indicates an error. |
76 callback SetKeepAliveCallback = void (long result); | 76 callback SetKeepAliveCallback = void (long result); |
77 | 77 |
78 // Callback from the <code>setNodeDelay<code> method. | 78 // Callback from the <code>setNodeDelay<code> method. |
79 // |result| : The result code returned from the underlying network call. | 79 // |result| : The result code returned from the underlying network call. |
80 // A negative value indicates an error. | 80 // A negative value indicates an error. |
81 callback SetNoDelayCallback = void (long result); | 81 callback SetNoDelayCallback = void (long result); |
82 | 82 |
83 dictionary TLSVersionConstraints { | |
84 DOMString? min; | |
85 DOMString? max; | |
86 }; | |
87 | |
88 dictionary SecureOptions { | |
89 TLSVersionConstraints? tlsVersion; | |
90 }; | |
91 | |
92 callback SecureCallback = void (long result); | |
93 | |
83 // Result of the <code>getInfo</code> method. | 94 // Result of the <code>getInfo</code> method. |
84 dictionary SocketInfo { | 95 dictionary SocketInfo { |
85 // The socket identifier. | 96 // The socket identifier. |
86 long socketId; | 97 long socketId; |
87 | 98 |
88 // Flag indicating whether the socket is left open when the application is | 99 // Flag indicating whether the socket is left open when the application is |
89 // suspended (see <code>SocketProperties.persistent</code>). | 100 // suspended (see <code>SocketProperties.persistent</code>). |
90 boolean persistent; | 101 boolean persistent; |
91 | 102 |
92 // Application-defined string associated with the socket. | 103 // Application-defined string associated with the socket. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 | 239 |
229 // Retrieves the state of the given socket. | 240 // Retrieves the state of the given socket. |
230 // |socketId| : The socket identifier. | 241 // |socketId| : The socket identifier. |
231 // |callback| : Called when the socket state is available. | 242 // |callback| : Called when the socket state is available. |
232 static void getInfo(long socketId, | 243 static void getInfo(long socketId, |
233 GetInfoCallback callback); | 244 GetInfoCallback callback); |
234 | 245 |
235 // Retrieves the list of currently opened sockets owned by the application. | 246 // Retrieves the list of currently opened sockets owned by the application. |
236 // |callback| : Called when the list of sockets is available. | 247 // |callback| : Called when the list of sockets is available. |
237 static void getSockets(GetSocketsCallback callback); | 248 static void getSockets(GetSocketsCallback callback); |
249 | |
250 // Start a TLS client connection over the socket. | |
251 // |socketId| : The existing, connected socket to use. | |
252 // |options| : Constraints and parameters for the TLS connection. | |
253 // |callback| : Called when the connection attempt is complete. | |
254 static void secure(long socketId, | |
255 optional SecureOptions options, | |
256 SecureCallback callback); | |
rpaquay
2013/12/16 20:18:46
nit: can you move this method between "disconnect"
lally
2013/12/16 22:20:07
Done.
| |
238 }; | 257 }; |
239 | 258 |
240 interface Events { | 259 interface Events { |
241 // Event raised when data has been received for a given socket. | 260 // Event raised when data has been received for a given socket. |
242 // |info| : The event data. | 261 // |info| : The event data. |
243 static void onReceive(ReceiveInfo info); | 262 static void onReceive(ReceiveInfo info); |
244 | 263 |
245 // Event raised when a network error occured while the runtime was waiting | 264 // Event raised when a network error occured while the runtime was waiting |
246 // for data on the socket address and port. Once this event is raised, the | 265 // for data on the socket address and port. Once this event is raised, the |
247 // socket is set to <code>paused</code> and no more <code>onReceive</code> | 266 // socket is set to <code>paused</code> and no more <code>onReceive</code> |
248 // events are raised for this socket. | 267 // events are raised for this socket. |
249 // |info| : The event data. | 268 // |info| : The event data. |
250 static void onReceiveError(ReceiveErrorInfo info); | 269 static void onReceiveError(ReceiveErrorInfo info); |
251 }; | 270 }; |
252 }; | 271 }; |
OLD | NEW |