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