Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(800)

Side by Side Diff: ppapi/c/ppb_url_request_info.h

Issue 7399016: More trivial cleanupi of ppapi/c headers (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/c/ppb_url_loader.h ('k') | ppapi/c/ppb_url_response_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2011 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
6 /* From ppb_url_request_info.idl modified Sat Jul 16 16:50:26 2011. */
7
5 #ifndef PPAPI_C_PPB_URL_REQUEST_INFO_H_ 8 #ifndef PPAPI_C_PPB_URL_REQUEST_INFO_H_
6 #define PPAPI_C_PPB_URL_REQUEST_INFO_H_ 9 #define PPAPI_C_PPB_URL_REQUEST_INFO_H_
7 10
8 #include "ppapi/c/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_instance.h" 12 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_macros.h" 13 #include "ppapi/c/pp_macros.h"
11 #include "ppapi/c/pp_resource.h" 14 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_stdint.h" 15 #include "ppapi/c/pp_stdint.h"
13 #include "ppapi/c/pp_time.h" 16 #include "ppapi/c/pp_time.h"
14 #include "ppapi/c/pp_var.h" 17 #include "ppapi/c/pp_var.h"
15 18
16 /** 19 /**
17 * @file 20 * @file
18 * This file defines the <code>PPB_URLRequestInfo</code> API for creating and 21 * This file defines the <code>PPB_URLRequestInfo</code> API for creating and
19 * manipulating URL requests. 22 * manipulating URL requests.
20 */ 23 */
21 24
25
22 /** 26 /**
23 * @addtogroup Enums 27 * @addtogroup Enums
24 * @{ 28 * @{
25 */ 29 */
26
27 /** 30 /**
28 * This enumeration contains properties that can be set on a URL request. 31 * This enumeration contains properties that can be set on a URL request.
29 */ 32 */
30 typedef enum { 33 typedef enum {
31 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 34 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */
32 PP_URLREQUESTPROPERTY_URL, 35 PP_URLREQUESTPROPERTY_URL,
33
34 /** 36 /**
35 * This corresponds to a string (<code>PP_VARTYPE_STRING</code>); either 37 * This corresponds to a string (<code>PP_VARTYPE_STRING</code>); either
36 * POST or GET. Refer to the 38 * POST or GET. Refer to the
37 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html">HTTP 39 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html">HTTP
38 * Methods</a> documentation for further information. 40 * Methods</a> documentation for further information.
39 * 41 *
40 */ 42 */
41 PP_URLREQUESTPROPERTY_METHOD, 43 PP_URLREQUESTPROPERTY_METHOD,
42
43 /** 44 /**
44 * This corresponds to a string (<code>PP_VARTYPE_STRING</code>); \n 45 * This corresponds to a string (<code>PP_VARTYPE_STRING</code>); \n
45 * delimited. Refer to the 46 * delimited. Refer to the
46 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"Header 47 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"Header
47 * Field Definitions</a> documentaiton for further information. 48 * Field Definitions</a> documentaiton for further information.
48 */ 49 */
49 PP_URLREQUESTPROPERTY_HEADERS, 50 PP_URLREQUESTPROPERTY_HEADERS,
50
51 /** 51 /**
52 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; 52 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
53 * default=<code>PP_FALSE</code>). 53 * default=<code>PP_FALSE</code>).
54 * Set this value to <code>PP_TRUE</code> if you want to download the data 54 * Set this value to <code>PP_TRUE</code> if you want to download the data
55 * to a file. Use PPB_URLLoader.FinishStreamingToFile() to complete the 55 * to a file. Use PPB_URLLoader.FinishStreamingToFile() to complete the
56 * download. 56 * download.
57 */ 57 */
58 PP_URLREQUESTPROPERTY_STREAMTOFILE, 58 PP_URLREQUESTPROPERTY_STREAMTOFILE,
59
60 /** 59 /**
61 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; 60 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
62 * default=<code>PP_TRUE</code>). 61 * default=<code>PP_TRUE</code>).
63 * Set this value to <code>PP_FALSE</code> if you want to use 62 * Set this value to <code>PP_FALSE</code> if you want to use
64 * PPB_URLLoader.FollowRedirects() to follow the redirects only after 63 * PPB_URLLoader.FollowRedirects() to follow the redirects only after
65 * examining redirect headers. 64 * examining redirect headers.
66 */ 65 */
67 PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS, 66 PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS,
68
69 /** 67 /**
70 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; 68 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
71 * default=<code>PP_FALSE</code>). 69 * default=<code>PP_FALSE</code>).
72 * Set this value to <code>PP_TRUE</code> if you want to be able to poll the 70 * Set this value to <code>PP_TRUE</code> if you want to be able to poll the
73 * download progress using PPB_URLLoader.GetDownloadProgress(). 71 * download progress using PPB_URLLoader.GetDownloadProgress().
74 */ 72 */
75 PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS, 73 PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS,
76
77 /** 74 /**
78 * This corresponds to a <code>PP_Bool (default=<code>PP_FALSE</code>). 75 * This corresponds to a <code>PP_Bool (default=<code>PP_FALSE</code>).
79 * Set this value to <code>PP_TRUE</code> if you want to be able to poll the 76 * Set this value to <code>PP_TRUE</code> if you want to be able to poll the
80 * upload progress using PPB_URLLoader.GetUplaodProgress(). 77 * upload progress using PPB_URLLoader.GetUplaodProgress().
81 */ 78 */
82 PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS, 79 PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS,
83
84 /** 80 /**
85 * This corresponds to a string (<code>PP_VARTYPE_STRING)</code> or may be 81 * This corresponds to a string (<code>PP_VARTYPE_STRING)</code> or may be
86 * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default). 82 * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default).
87 * Set it to a string to set a custom referrer (if empty, the referrer header 83 * Set it to a string to set a custom referrer (if empty, the referrer header
88 * will be omitted), or to undefined to use the default referrer. Only loaders 84 * will be omitted), or to undefined to use the default referrer. Only loaders
89 * with universal access (only available on trusted implementations) will 85 * with universal access (only available on trusted implementations) will
90 * accept <code>URLRequestInfo</code> objects that try to set a custom 86 * accept <code>URLRequestInfo</code> objects that try to set a custom
91 * referrer; if given to a loader without universal access, 87 * referrer; if given to a loader without universal access,
92 * <code>PP_ERROR_BADARGUMENT</code> will result. 88 * <code>PP_ERROR_BADARGUMENT</code> will result.
93 */ 89 */
94 PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL, 90 PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL,
95
96 /** 91 /**
97 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; 92 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
98 * default=<code>PP_FALSE</code>). Whether cross-origin requests are allowed. 93 * default=<code>PP_FALSE</code>). Whether cross-origin requests are allowed.
99 * Cross-origin requests are made using the CORS (Cross-Origin Resource 94 * Cross-origin requests are made using the CORS (Cross-Origin Resource
100 * Sharing) algorithm to check whether the request should be allowed. For the 95 * Sharing) algorithm to check whether the request should be allowed. For the
101 * complete CORS algorithm, refer to 96 * complete CORS algorithm, refer to
102 * the <a href="http://www.w3.org/TR/access-control">Cross-Origin Resource 97 * the <a href="http://www.w3.org/TR/access-control">Cross-Origin Resource
103 * Sharing</a> documentation. 98 * Sharing</a> documentation.
104 */ 99 */
105 PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS, 100 PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS,
106
107 /** 101 /**
108 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; 102 * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
109 * default=<code>PP_FALSE</code>). 103 * default=<code>PP_FALSE</code>).
110 * Whether HTTP credentials are sent with cross-origin requests. If false, 104 * Whether HTTP credentials are sent with cross-origin requests. If false,
111 * no credentials are sent with the request and cookies are ignored in the 105 * no credentials are sent with the request and cookies are ignored in the
112 * response. If the request is not cross-origin, this property is ignored. 106 * response. If the request is not cross-origin, this property is ignored.
113 */ 107 */
114 PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS, 108 PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS,
115
116 /** 109 /**
117 * This corresponds to a string (<code>PP_VARTYPE_STRING</code>) or may be 110 * This corresponds to a string (<code>PP_VARTYPE_STRING</code>) or may be
118 * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default). 111 * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default).
119 * Set it to a string to set a custom content-transfer-encoding header (if 112 * Set it to a string to set a custom content-transfer-encoding header (if
120 * empty, that header will be omitted), or to undefined to use the default 113 * empty, that header will be omitted), or to undefined to use the default
121 * (if any). Only loaders with universal access (only available on trusted 114 * (if any). Only loaders with universal access (only available on trusted
122 * implementations) will accept <code>URLRequestInfo</code> objects that try 115 * implementations) will accept <code>URLRequestInfo</code> objects that try
123 * to set a custom content transfer encoding; if given to a loader without 116 * to set a custom content transfer encoding; if given to a loader without
124 * universal access, <code>PP_ERROR_BADARGUMENT</code> will result. 117 * universal access, <code>PP_ERROR_BADARGUMENT</code> will result.
125 */ 118 */
126 PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING, 119 PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING,
127
128 /** 120 /**
129 * This corresponds to an integer (<code>PP_VARTYPE_INT32</code>); default 121 * This corresponds to an integer (<code>PP_VARTYPE_INT32</code>); default
130 * is not defined and is set by the browser, possibly depending on system 122 * is not defined and is set by the browser, possibly depending on system
131 * capabilities. Set it to an integer to set an upper threshold for the 123 * capabilities. Set it to an integer to set an upper threshold for the
132 * prefetched buffer of an asynchronous load. When exceeded, the browser will 124 * prefetched buffer of an asynchronous load. When exceeded, the browser will
133 * defer loading until 125 * defer loading until
134 * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> is hit, 126 * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> is hit,
135 * at which time it will begin prefetching again. When setting this property, 127 * at which time it will begin prefetching again. When setting this property,
136 * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> must also 128 * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> must also
137 * be set. Behavior is undefined if the former is <= the latter. 129 * be set. Behavior is undefined if the former is <= the latter.
138 */ 130 */
139 PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD, 131 PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD,
140
141 /** 132 /**
142 * This corresponds to an integer (<code>PP_VARTYPE_INT32</code>); default is 133 * This corresponds to an integer (<code>PP_VARTYPE_INT32</code>); default is
143 * not defined and is set by the browser to a value appropriate for the 134 * not defined and is set by the browser to a value appropriate for the
144 * default <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code>. 135 * default <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code>.
145 * Set it to an integer to set a lower threshold for the prefetched buffer 136 * Set it to an integer to set a lower threshold for the prefetched buffer
146 * of an asynchronous load. When reached, the browser will resume loading if 137 * of an asynchronous load. When reached, the browser will resume loading if
147 * If <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> had 138 * If <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> had
148 * previously been reached. 139 * previously been reached.
149 * When setting this property, 140 * When setting this property,
150 * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code> must also 141 * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code> must also
151 * be set. Behavior is undefined if the former is >= the latter. 142 * be set. Behavior is undefined if the former is >= the latter.
152 */ 143 */
153 PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD 144 PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD
154 } PP_URLRequestProperty; 145 } PP_URLRequestProperty;
155 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLRequestProperty, 4); 146 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLRequestProperty, 4);
156 /** 147 /**
157 * @} 148 * @}
158 */ 149 */
159 150
160 #define PPB_URLREQUESTINFO_INTERFACE_0_2 "PPB_URLRequestInfo;0.2"
161 #define PPB_URLREQUESTINFO_INTERFACE_1_0 "PPB_URLRequestInfo;1.0"
162 #define PPB_URLREQUESTINFO_INTERFACE PPB_URLREQUESTINFO_INTERFACE_1_0
163
164 /** 151 /**
165 *
166 * @addtogroup Interfaces 152 * @addtogroup Interfaces
167 * @{ 153 * @{
168 */ 154 */
169
170 /** 155 /**
171 * The <code>PPB_URLRequestInfo</code> interface is used to create 156 * The <code>PPB_URLRequestInfo</code> interface is used to create
172 * and handle URL requests. This API is used in conjunction with 157 * and handle URL requests. This API is used in conjunction with
173 * <code>PPB_URLLoader</code>. Refer to <code>PPB_URLLoader for further 158 * <code>PPB_URLLoader</code>. Refer to <code>PPB_URLLoader for further
174 * information. 159 * information.
175 */ 160 */
161 #define PPB_URLREQUESTINFO_INTERFACE_0_2 "PPB_URLRequestInfo;0.2"
162 #define PPB_URLREQUESTINFO_INTERFACE_1_0 "PPB_URLRequestInfo;1.0"
163 #define PPB_URLREQUESTINFO_INTERFACE PPB_URLREQUESTINFO_INTERFACE_1_0
164
176 struct PPB_URLRequestInfo { 165 struct PPB_URLRequestInfo {
177 /** 166 /**
178 * Create() creates a new <code>URLRequestInfo</code> object. 167 * Create() creates a new <code>URLRequestInfo</code> object.
179 * 168 *
180 * @param[in] instance A <code>PP_Instance</code> indentifying one instance 169 * @param[in] instance A <code>PP_Instance</code> indentifying one instance
181 * of a module. 170 * of a module.
182 * 171 *
183 * @return A <code>PP_Resource</code> identifying the 172 * @return A <code>PP_Resource</code> identifying the
184 * <code>URLRequestInfo</code> if successful, 0 if the instance is invalid. 173 * <code>URLRequestInfo</code> if successful, 0 if the instance is invalid.
185 */ 174 */
186 PP_Resource (*Create)(PP_Instance instance); 175 PP_Resource (*Create)(PP_Instance instance);
187
188 /** 176 /**
189 * IsURLRequestInfo() determines if a resource is a 177 * IsURLRequestInfo() determines if a resource is a
190 * <code>URLRequestInfo</code>. 178 * <code>URLRequestInfo</code>.
191 * 179 *
192 * @param[in] resource A <code>PP_Resource</code> corresponding to a 180 * @param[in] resource A <code>PP_Resource</code> corresponding to a
193 * <code>URLRequestInfo</code>. 181 * <code>URLRequestInfo</code>.
194 * 182 *
195 * @return <code>PP_TRUE</code> if the resource is a 183 * @return <code>PP_TRUE</code> if the resource is a
196 * <code>URLRequestInfo</code>, <code>PP_FALSE</code> if the resource is 184 * <code>URLRequestInfo</code>, <code>PP_FALSE</code> if the resource is
197 * invalid or some type other than <code>URLRequestInfo</code>. 185 * invalid or some type other than <code>URLRequestInfo</code>.
198 */ 186 */
199 PP_Bool (*IsURLRequestInfo)(PP_Resource resource); 187 PP_Bool (*IsURLRequestInfo)(PP_Resource resource);
200
201 /** 188 /**
202 * SetProperty() sets a request property. The value of the property must be 189 * SetProperty() sets a request property. The value of the property must be
203 * the correct type according to the property being set. 190 * the correct type according to the property being set.
204 * 191 *
205 * @param[in] request A <code>PP_Resource</code> corresponding to a 192 * @param[in] request A <code>PP_Resource</code> corresponding to a
206 * <code>URLRequestInfo</code>. 193 * <code>URLRequestInfo</code>.
207 * @param[in] property A <code>PP_URLRequestProperty</code> identifying the 194 * @param[in] property A <code>PP_URLRequestProperty</code> identifying the
208 * property to set. 195 * property to set.
209 * @param[in] value A <code>PP_Var</code> containing the property value. 196 * @param[in] value A <code>PP_Var</code> containing the property value.
210 * 197 *
211 * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any 198 * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any
212 * of the parameters are invalid. 199 * of the parameters are invalid.
213 */ 200 */
214 PP_Bool (*SetProperty)(PP_Resource request, 201 PP_Bool (*SetProperty)(PP_Resource request,
215 PP_URLRequestProperty property, 202 PP_URLRequestProperty property,
216 struct PP_Var value); 203 struct PP_Var value);
217
218 /** 204 /**
219 * AppendDataToBody() appends data to the request body. A Content-Length 205 * AppendDataToBody() appends data to the request body. A Content-Length
220 * request header will be automatically generated. 206 * request header will be automatically generated.
221 * 207 *
222 * @param[in] request A <code>PP_Resource</code> corresponding to a 208 * @param[in] request A <code>PP_Resource</code> corresponding to a
223 * <code>URLRequestInfo</code>. 209 * <code>URLRequestInfo</code>.
224 * @param[in] data A pointer to a buffer holding the data. 210 * @param[in] data A pointer to a buffer holding the data.
225 * @param[in] len The length, in bytes, of the data. 211 * @param[in] len The length, in bytes, of the data.
226 * 212 *
227 * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any 213 * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any
228 * of the parameters are invalid. 214 * of the parameters are invalid.
229 * 215 *
230 * 216 *
231 */ 217 */
232 PP_Bool (*AppendDataToBody)(PP_Resource request, 218 PP_Bool (*AppendDataToBody)(PP_Resource request,
233 const void* data, 219 const void* data,
234 uint32_t len); 220 uint32_t len);
235
236 /** 221 /**
237 * AppendFileToBody() appends a file, to be uploaded, to the request body. 222 * AppendFileToBody() appends a file, to be uploaded, to the request body.
238 * A content-length request header will be automatically generated. 223 * A content-length request header will be automatically generated.
239 * 224 *
240 * @param[in] request A <code>PP_Resource</code> corresponding to a 225 * @param[in] request A <code>PP_Resource</code> corresponding to a
241 * <code>URLRequestInfo</code>. 226 * <code>URLRequestInfo</code>.
242 * @param[in] file_ref A <code>PP_Resource</code> containing the file 227 * @param[in] file_ref A <code>PP_Resource</code> containing the file
243 * reference. 228 * reference.
244 * @param[in] start_offset An optional starting point offset within the 229 * @param[in] start_offset An optional starting point offset within the
245 * file. 230 * file.
(...skipping 15 matching lines...) Expand all
261 int64_t start_offset, 246 int64_t start_offset,
262 int64_t number_of_bytes, 247 int64_t number_of_bytes,
263 PP_Time expected_last_modified_time); 248 PP_Time expected_last_modified_time);
264 }; 249 };
265 /** 250 /**
266 * @} 251 * @}
267 */ 252 */
268 253
269 #endif /* PPAPI_C_PPB_URL_REQUEST_INFO_H_ */ 254 #endif /* PPAPI_C_PPB_URL_REQUEST_INFO_H_ */
270 255
OLDNEW
« no previous file with comments | « ppapi/c/ppb_url_loader.h ('k') | ppapi/c/ppb_url_response_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698