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

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

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

Powered by Google App Engine
This is Rietveld 408576698