| 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 <strong>PPB_URLLoader</strong> interface for loading | 7 * This file defines the <strong>PPB_URLLoader</strong> interface for loading |
| 8 * URLs. | 8 * URLs. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 label Chrome { | 11 label Chrome { |
| 12 M14 = 1.0 | 12 M14 = 1.0, |
| 13 M26 = 1.1 |
| 13 }; | 14 }; |
| 14 | 15 |
| 15 /** | 16 /** |
| 16 * The <strong>PPB_URLLoader</strong> interface contains pointers to functions | 17 * The <strong>PPB_URLLoader</strong> interface contains pointers to functions |
| 17 * for loading URLs. The typical steps for loading a URL are: | 18 * for loading URLs. The typical steps for loading a URL are: |
| 18 * | 19 * |
| 19 * -# Call Create() to create a URLLoader object. | 20 * -# Call Create() to create a URLLoader object. |
| 20 * -# Create a <code>URLRequestInfo</code> object and set properties on it. | 21 * -# Create a <code>URLRequestInfo</code> object and set properties on it. |
| 21 * Refer to <code>PPB_URLRequestInfo</code> for further information. | 22 * Refer to <code>PPB_URLRequestInfo</code> for further information. |
| 22 * -# Call Open() with the <code>URLRequestInfo</code> as an argument. | 23 * -# Call Open() with the <code>URLRequestInfo</code> as an argument. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 * resource or if Open() has not been called. | 157 * resource or if Open() has not been called. |
| 157 */ | 158 */ |
| 158 PP_Resource GetResponseInfo( | 159 PP_Resource GetResponseInfo( |
| 159 [in] PP_Resource loader); | 160 [in] PP_Resource loader); |
| 160 | 161 |
| 161 /** | 162 /** |
| 162 * ReadResponseBody() is used to read the response body. The size of the | 163 * ReadResponseBody() is used to read the response body. The size of the |
| 163 * buffer must be large enough to hold the specified number of bytes to read. | 164 * buffer must be large enough to hold the specified number of bytes to read. |
| 164 * This function might perform a partial read. | 165 * This function might perform a partial read. |
| 165 * | 166 * |
| 167 * ReadResponseBodyToArray() is preferred to ReadResponseBody() when doing |
| 168 * asynchronous operations. |
| 169 * |
| 166 * @param[in] loader A <code>PP_Resource</code> corresponding to a | 170 * @param[in] loader A <code>PP_Resource</code> corresponding to a |
| 167 * <code>URLLoader</code>. | 171 * <code>URLLoader</code>. |
| 168 * @param[in,out] buffer A pointer to the buffer for the response body. | 172 * @param[in,out] buffer A pointer to the buffer for the response body. |
| 169 * @param[in] bytes_to_read The number of bytes to read. | 173 * @param[in] bytes_to_read The number of bytes to read. |
| 170 * @param[in] callback A <code>PP_CompletionCallback</code> to run on | 174 * @param[in] callback A <code>PP_CompletionCallback</code> to run on |
| 171 * asynchronous completion. The callback will run if the bytes (full or | 175 * asynchronous completion. The callback will run if the bytes (full or |
| 172 * partial) are read or an error occurs asynchronously. This callback will | 176 * partial) are read or an error occurs asynchronously. This callback will |
| 173 * run only if this function returns <code>PP_OK_COMPLETIONPENDING</code>. | 177 * run only if this function returns <code>PP_OK_COMPLETIONPENDING</code>. |
| 174 * | 178 * |
| 175 * @return An int32_t containing the number of bytes read or an error code | 179 * @return An int32_t containing the number of bytes read or an error code |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 * | 214 * |
| 211 * <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed | 215 * <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed |
| 212 * while it is still open, then it will be implicitly closed so you are not | 216 * while it is still open, then it will be implicitly closed so you are not |
| 213 * required to call Close(). | 217 * required to call Close(). |
| 214 * | 218 * |
| 215 * @param[in] loader A <code>PP_Resource</code> corresponding to a | 219 * @param[in] loader A <code>PP_Resource</code> corresponding to a |
| 216 * <code>URLLoader</code>. | 220 * <code>URLLoader</code>. |
| 217 */ | 221 */ |
| 218 void Close( | 222 void Close( |
| 219 [in] PP_Resource loader); | 223 [in] PP_Resource loader); |
| 224 |
| 225 /** |
| 226 * ReadResponseBody() is used to read the response body. The size of the |
| 227 * buffer must be large enough to hold the specified number of bytes to read. |
| 228 * This function might perform a partial read. |
| 229 * |
| 230 * @param[in] loader A <code>PP_Resource</code> corresponding to a |
| 231 * <code>URLLoader</code>. |
| 232 * @param[in,out] output A <code>PP_ArrayOutput</code> to hold the output. |
| 233 * @param[in] max_read_length The number of bytes to read. |
| 234 * @param[in] callback A <code>PP_CompletionCallback</code> to run on |
| 235 * asynchronous completion. The callback will run if the bytes (full or |
| 236 * partial) are read or an error occurs asynchronously. This callback will |
| 237 * run only if this function returns <code>PP_OK_COMPLETIONPENDING</code>. |
| 238 * |
| 239 * @return An int32_t containing the number of bytes read or an error code |
| 240 * from <code>pp_errors.h</code>. |
| 241 */ |
| 242 [version = 1.1] |
| 243 int32_t ReadResponseBodyToArray( |
| 244 [in] PP_Resource loader, |
| 245 [in] int32_t max_read_length, |
| 246 [inout] PP_ArrayOutput output, |
| 247 [in] PP_CompletionCallback callback); |
| 220 }; | 248 }; |
| 221 | 249 |
| OLD | NEW |