OLD | NEW |
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 | 5 |
6 /** | 6 /** |
7 * This file defines the <code>PPB_WebSocket_Dev</code> interface. | 7 * This file defines the <code>PPB_WebSocket_Dev</code> interface. |
8 */ | 8 */ |
9 label Chrome { | 9 label Chrome { |
10 M17 = 0.1 | 10 M17 = 0.1, |
| 11 M18 = 0.9 |
11 }; | 12 }; |
12 | 13 |
13 | 14 |
14 /** | 15 /** |
15 * This enumeration contains the types representing the WebSocket ready state | 16 * This enumeration contains the types representing the WebSocket ready state |
16 * and these states are based on the JavaScript WebSocket API specification. | 17 * and these states are based on the JavaScript WebSocket API specification. |
17 * GetReadyState() returns one of these states. | 18 * GetReadyState() returns one of these states. |
18 */ | 19 */ |
19 [assert_size(4)] | 20 [assert_size(4)] |
20 enum PP_WebSocketReadyState_Dev { | 21 enum PP_WebSocketReadyState_Dev { |
(...skipping 17 matching lines...) Expand all Loading... |
38 */ | 39 */ |
39 PP_WEBSOCKETREADYSTATE_CLOSING_DEV = 2, | 40 PP_WEBSOCKETREADYSTATE_CLOSING_DEV = 2, |
40 | 41 |
41 /** | 42 /** |
42 * Ready state that the connection has been closed or could not be opened. | 43 * Ready state that the connection has been closed or could not be opened. |
43 */ | 44 */ |
44 PP_WEBSOCKETREADYSTATE_CLOSED_DEV = 3 | 45 PP_WEBSOCKETREADYSTATE_CLOSED_DEV = 3 |
45 }; | 46 }; |
46 | 47 |
47 /** | 48 /** |
48 * This enumeration contains the types representing the WebSocket message type | 49 * This enumeration contains the types representing the WebSocket binary type |
49 * and these types are based on the JavaScript WebSocket API specification. | 50 * to receive frames. These types are based on the JavaScript WebSocket API |
50 * ReceiveMessage() and SendMessage() use them as a parameter to represent | 51 * specification. |
51 * handling message types. | |
52 */ | 52 */ |
53 [assert_size(4)] | 53 [assert_size(4)] |
54 enum PP_WebSocketMessageType_Dev { | 54 enum PP_WebSocketBinaryType_Dev { |
55 /** | 55 /** |
56 * Message type that represents a text message type. | 56 * Binary type is queried on an invalid resource. |
57 */ | 57 */ |
58 PP_WEBSOCKET_MESSAGE_TYPE_TEXT_DEV = 0, | 58 PP_WEBSOCKETBINARYTYPE_INVALID = -1, |
59 | 59 |
60 /** | 60 /** |
61 * Message type that represents a binary message type. | 61 * Binary type that represents Blob objects. |
62 */ | 62 */ |
63 PP_WEBSOCKET_MESSAGE_TYPE_BINARY_DEV = 1 | 63 PP_WEBSOCKETBINARYTYPE_BLOB_DEV = 0, |
| 64 |
| 65 /** |
| 66 * Binary type that represents ArrayBuffer objects. |
| 67 */ |
| 68 PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV = 1 |
64 }; | 69 }; |
65 | 70 |
66 [version=0.1, macro="PPB_WEBSOCKET_DEV_INTERFACE"] | |
67 interface PPB_WebSocket_Dev { | 71 interface PPB_WebSocket_Dev { |
68 /** | 72 /** |
69 * Create() creates a WebSocket instance. | 73 * Create() creates a WebSocket instance. |
70 * | 74 * |
71 * @param[in] instance A <code>PP_Instance</code> identifying the instance | 75 * @param[in] instance A <code>PP_Instance</code> identifying the instance |
72 * with the WebSocket. | 76 * with the WebSocket. |
73 * | 77 * |
74 * @return A <code>PP_Resource</code> corresponding to a WebSocket if | 78 * @return A <code>PP_Resource</code> corresponding to a WebSocket if |
75 * successful. | 79 * successful. |
76 */ | 80 */ |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 * GetURL() returns the URL associated with specified WebSocket connection. | 312 * GetURL() returns the URL associated with specified WebSocket connection. |
309 * | 313 * |
310 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 314 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
311 * WebSocket. | 315 * WebSocket. |
312 * | 316 * |
313 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the | 317 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
314 * connection is established, it contains the empty string. Return a | 318 * connection is established, it contains the empty string. Return a |
315 * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. | 319 * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
316 */ | 320 */ |
317 PP_Var GetURL([in] PP_Resource web_socket); | 321 PP_Var GetURL([in] PP_Resource web_socket); |
| 322 |
| 323 /** |
| 324 * SetBinaryType() specifies the binary object type for receiving binary |
| 325 * frames representation. Receiving text frames are always mapped to |
| 326 * <PP_VARTYPE_STRING</code> var regardless of this attribute. |
| 327 * This function should be called before Connect() to ensure receiving all |
| 328 * incoming binary frames as the specified binary object type. |
| 329 * Default type is <code>PP_WEBSOCKETBINARYTYPE_BLOB_DEV</code>. |
| 330 * |
| 331 * Currently, Blob bindings is not supported in Pepper, so receiving binary |
| 332 * type is always ArrayBuffer. To ensure backward compatibility, you must |
| 333 * call this function with |
| 334 * <code>PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV</code> to use binary frames. |
| 335 * |
| 336 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 337 * WebSocket. |
| 338 * |
| 339 * @param[in] binary_type Binary object type for receibing binary frames |
| 340 * representation. |
| 341 * |
| 342 * @return Returns <code>PP_FALSE</code> if the specified type is not |
| 343 * supported. Otherwise, returns <code>PP_TRUE</code>. |
| 344 */ |
| 345 [version=0.9] |
| 346 PP_Bool SetBinaryType([in] PP_Resource web_socket, |
| 347 [in] PP_WebSocketBinaryType_Dev binary_type); |
| 348 |
| 349 /** |
| 350 * GetBinaryType() returns currently specified binary object type for |
| 351 * receiving binary frames representation. |
| 352 * |
| 353 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 354 * WebSocket. |
| 355 * |
| 356 * @return Returns <code>PP_WebSocketBinaryType_Dev</code> represents |
| 357 * current binary object type. |
| 358 */ |
| 359 [version=0.9] |
| 360 PP_WebSocketBinaryType_Dev GetBinaryType([in] PP_Resource web_socket); |
318 }; | 361 }; |
OLD | NEW |