| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ | |
| 6 #define PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ | |
| 7 | |
| 8 #include "ppapi/c/pp_bool.h" | |
| 9 #include "ppapi/c/pp_module.h" | |
| 10 #include "ppapi/c/pp_resource.h" | |
| 11 #include "ppapi/c/pp_stdint.h" | |
| 12 #include "ppapi/c/pp_time.h" | |
| 13 | |
| 14 struct PP_Var; | |
| 15 | |
| 16 typedef enum { | |
| 17 PP_URLREQUESTPROPERTY_URL, // string | |
| 18 PP_URLREQUESTPROPERTY_METHOD, // string | |
| 19 PP_URLREQUESTPROPERTY_HEADERS, // string, \n-delim | |
| 20 PP_URLREQUESTPROPERTY_STREAMTOFILE, // PP_Bool (default=PP_FALSE) | |
| 21 PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS, // PP_Bool (default=PP_TRUE) | |
| 22 | |
| 23 // Set to true if you want to be able to poll the download progress via the | |
| 24 // URLLoader.GetDownloadProgress function. | |
| 25 // | |
| 26 // Boolean (default = PP_FALSE). | |
| 27 PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS, | |
| 28 | |
| 29 // Set to true if you want to be able to pull the upload progress via the | |
| 30 // URLLoader.GetUploadProgress function. | |
| 31 // | |
| 32 // Boolean (default = PP_FALSE). | |
| 33 PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS | |
| 34 | |
| 35 // TODO(darin): Add security/privacy options? | |
| 36 } PP_URLRequestProperty_Dev; | |
| 37 | |
| 38 #define PPB_URLREQUESTINFO_DEV_INTERFACE "PPB_URLRequestInfo(Dev);0.2" | |
| 39 | |
| 40 struct PPB_URLRequestInfo_Dev { | |
| 41 // Create a new URLRequestInfo object. Returns 0 if the module is invalid. | |
| 42 PP_Resource (*Create)(PP_Module module); | |
| 43 | |
| 44 // Returns PP_TRUE if the given resource is an URLRequestInfo. Returns | |
| 45 // PP_FALSE if the resource is invalid or some type other than an | |
| 46 // URLRequestInfo. | |
| 47 PP_Bool (*IsURLRequestInfo)(PP_Resource resource); | |
| 48 | |
| 49 // Sets a request property. Returns PP_FALSE if any of the parameters are | |
| 50 // invalid, PP_TRUE on success. The value property must be the correct type | |
| 51 // according to the property being set. | |
| 52 PP_Bool (*SetProperty)(PP_Resource request, | |
| 53 PP_URLRequestProperty_Dev property, | |
| 54 struct PP_Var value); | |
| 55 | |
| 56 // Append data to the request body. | |
| 57 // | |
| 58 // A Content-Length request header will be automatically generated. | |
| 59 // | |
| 60 // Returns PP_FALSE if any of the parameters are invalid, PP_TRUE on success. | |
| 61 PP_Bool (*AppendDataToBody)(PP_Resource request, | |
| 62 const char* data, | |
| 63 uint32_t len); | |
| 64 | |
| 65 // Append a file reference to be uploaded. | |
| 66 // | |
| 67 // A sub-range of the file starting from start_offset may be specified. If | |
| 68 // number_of_bytes is -1, then the sub-range to upload extends to the end of | |
| 69 // the file. | |
| 70 // | |
| 71 // An optional (non-zero) last modified time stamp may be provided, which | |
| 72 // will be used to validate that the file was not modified since the given | |
| 73 // time before it is uploaded. The upload will fail with an error code of | |
| 74 // PP_Error_FileChanged if the file has been modified since the given time. | |
| 75 // If expected_last_modified_time is 0, then no validation is performed. | |
| 76 // | |
| 77 // A Content-Length request header will be automatically generated. | |
| 78 // | |
| 79 // Returns PP_FALSE if any of the parameters are invalid, PP_TRUE on success. | |
| 80 PP_Bool (*AppendFileToBody)(PP_Resource request, | |
| 81 PP_Resource file_ref, | |
| 82 int64_t start_offset, | |
| 83 int64_t number_of_bytes, | |
| 84 PP_Time expected_last_modified_time); | |
| 85 }; | |
| 86 | |
| 87 #endif // PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ | |
| OLD | NEW |