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

Side by Side Diff: ppapi/c/ppb_url_loader.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_messaging.h ('k') | ppapi/c/ppb_url_request_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_loader.idl modified Sat Jul 16 16:50:26 2011. */
7
5 #ifndef PPAPI_C_PPB_URL_LOADER_H_ 8 #ifndef PPAPI_C_PPB_URL_LOADER_H_
6 #define PPAPI_C_PPB_URL_LOADER_H_ 9 #define PPAPI_C_PPB_URL_LOADER_H_
7 10
8 #include "ppapi/c/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h"
11 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_stdint.h" 16 #include "ppapi/c/pp_stdint.h"
13 17
14 #define PPB_URLLOADER_INTERFACE_0_2 "PPB_URLLoader;0.2"
15 #define PPB_URLLOADER_INTERFACE_1_0 "PPB_URLLoader;1.0"
16 #define PPB_URLLOADER_INTERFACE PPB_URLLOADER_INTERFACE_1_0
17
18 /** 18 /**
19 * @file 19 * @file
20 * This file defines the <strong>PPB_URLLoader</strong> interface for loading 20 * This file defines the <strong>PPB_URLLoader</strong> interface for loading
21 * URLs. 21 * URLs.
22 */ 22 */
23 23
24
24 /** 25 /**
25 * @addtogroup Interfaces 26 * @addtogroup Interfaces
26 * @{ 27 * @{
27 */ 28 */
28
29 /** 29 /**
30 * The <strong>PPB_URLLoader</strong> interface contains pointers to functions 30 * The <strong>PPB_URLLoader</strong> interface contains pointers to functions
31 * for loading URLs. The typical steps for loading a URL are: 31 * for loading URLs. The typical steps for loading a URL are:
32 * 32 *
33 * -# Call Create() to create a URLLoader object. 33 * -# Call Create() to create a URLLoader object.
34 * -# Create a <code>URLRequestInfo</code> object and set properties on it. 34 * -# Create a <code>URLRequestInfo</code> object and set properties on it.
35 * Refer to <code>PPB_URLRequestInfo</code> for further information. 35 * Refer to <code>PPB_URLRequestInfo</code> for further information.
36 * -# Call Open() with the <code>URLRequestInfo</code> as an argument. 36 * -# Call Open() with the <code>URLRequestInfo</code> as an argument.
37 * -# When Open() completes, call GetResponseInfo() to examine the response 37 * -# When Open() completes, call GetResponseInfo() to examine the response
38 * headers. Refer to <code>PPB_URLResponseInfo</code> for further information. 38 * headers. Refer to <code>PPB_URLResponseInfo</code> for further information.
39 * -# Call ReadResponseBody() to stream the data for the response. 39 * -# Call ReadResponseBody() to stream the data for the response.
40 * 40 *
41 * Alternatively, if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on 41 * Alternatively, if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on
42 * the <code>URLRequestInfo</code> in step #2: 42 * the <code>URLRequestInfo</code> in step #2:
43 * - Call FinishStreamingToFile(), after examining the response headers 43 * - Call FinishStreamingToFile(), after examining the response headers
44 * (step #4), to wait for the downloaded file to be complete. 44 * (step #4), to wait for the downloaded file to be complete.
45 * - Then, access the downloaded file using the GetBodyAsFileRef() function of 45 * - Then, access the downloaded file using the GetBodyAsFileRef() function of
46 * the <code>URLResponseInfo</code> returned in step #4. 46 * the <code>URLResponseInfo</code> returned in step #4.
47 */ 47 */
48 #define PPB_URLLOADER_INTERFACE_0_2 "PPB_URLLoader;0.2"
49 #define PPB_URLLOADER_INTERFACE_1_0 "PPB_URLLoader;1.0"
50 #define PPB_URLLOADER_INTERFACE PPB_URLLOADER_INTERFACE_1_0
51
48 struct PPB_URLLoader { 52 struct PPB_URLLoader {
49 /** 53 /**
50 * Create() creates a new <code>URLLoader</code> object. The 54 * Create() creates a new <code>URLLoader</code> object. The
51 * <code>URLLoader</code> is associated with a particular instance, so that 55 * <code>URLLoader</code> is associated with a particular instance, so that
52 * any UI dialogs that need to be shown to the user can be positioned 56 * any UI dialogs that need to be shown to the user can be positioned
53 * relative to the window containing the instance. 57 * relative to the window containing the instance.
54 * 58 *
55 * @param[in] instance A <code>PP_Instance</code> indentifying one instance 59 * @param[in] instance A <code>PP_Instance</code> indentifying one instance
56 * of a module. 60 * of a module.
57 * 61 *
58 * @return A <code>PP_Resource</code> corresponding to a URLLoader if 62 * @return A <code>PP_Resource</code> corresponding to a URLLoader if
59 * successful, 0 if the instance is invalid. 63 * successful, 0 if the instance is invalid.
60 */ 64 */
61 PP_Resource (*Create)(PP_Instance instance); 65 PP_Resource (*Create)(PP_Instance instance);
62
63 /** 66 /**
64 * IsURLLoader() determines if a resource is an <code>URLLoader</code>. 67 * IsURLLoader() determines if a resource is an <code>URLLoader</code>.
65 * 68 *
66 * @param[in] resource A <code>PP_Resource</code> corresponding to a 69 * @param[in] resource A <code>PP_Resource</code> corresponding to a
67 * <code>URLLoader</code>. 70 * <code>URLLoader</code>.
68 * 71 *
69 * @return <code>PP_TRUE</code> if the resource is a <code>URLLoader</code>, 72 * @return <code>PP_TRUE</code> if the resource is a <code>URLLoader</code>,
70 * <code>PP_FALSE</code> if the resource is invalid or some type other 73 * <code>PP_FALSE</code> if the resource is invalid or some type other
71 * than <code>URLLoader</code>. 74 * than <code>URLLoader</code>.
72 */ 75 */
73 PP_Bool (*IsURLLoader)(PP_Resource resource); 76 PP_Bool (*IsURLLoader)(PP_Resource resource);
74
75 /** 77 /**
76 * Open() begins loading the <code>URLRequestInfo</code>. The operation 78 * Open() begins loading the <code>URLRequestInfo</code>. The operation
77 * completes when response headers are received or when an error occurs. Use 79 * completes when response headers are received or when an error occurs. Use
78 * GetResponseInfo() to access the response headers. 80 * GetResponseInfo() to access the response headers.
79 * 81 *
80 * @param[in] loader A <code>PP_Resource</code> corresponding to a 82 * @param[in] loader A <code>PP_Resource</code> corresponding to a
81 * <code>URLLoader</code>. 83 * <code>URLLoader</code>.
82 * @param[in] resource A <code>PP_Resource</code> corresponding to a 84 * @param[in] resource A <code>PP_Resource</code> corresponding to a
83 * <code>URLRequestInfo</code>. 85 * <code>URLRequestInfo</code>.
84 * @param[in] callback A <code>PP_CompletionCallback</code> to run on 86 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
85 * asynchronous completion of Open(). This callback will run when response 87 * asynchronous completion of Open(). This callback will run when response
86 * headers for the url are received or error occured. This callback 88 * headers for the url are received or error occured. This callback
87 * will only run if Open() returns <code>PP_OK_COMPLETIONPENDING</code>. 89 * will only run if Open() returns <code>PP_OK_COMPLETIONPENDING</code>.
88 * 90 *
89 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 91 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
90 */ 92 */
91 int32_t (*Open)(PP_Resource loader, 93 int32_t (*Open)(PP_Resource loader,
92 PP_Resource request_info, 94 PP_Resource request_info,
93 struct PP_CompletionCallback callback); 95 struct PP_CompletionCallback callback);
94
95 /** 96 /**
96 * FollowRedirect()can be invoked to follow a redirect after Open() completed 97 * FollowRedirect()can be invoked to follow a redirect after Open() completed
97 * on receiving redirect headers. 98 * on receiving redirect headers.
98 * 99 *
99 * @param[in] loader A <code>PP_Resource</code> corresponding to a 100 * @param[in] loader A <code>PP_Resource</code> corresponding to a
100 * <code>URLLoader</code>. 101 * <code>URLLoader</code>.
101 * @param[in] callback A <code>PP_CompletionCallback</code> to run on 102 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
102 * asynchronous completion of FollowRedirect(). This callback will run when 103 * asynchronous completion of FollowRedirect(). This callback will run when
103 * response headers for the redirect url are received or error occured. This 104 * response headers for the redirect url are received or error occured. This
104 * callback will only run if FollowRedirect() returns 105 * callback will only run if FollowRedirect() returns
105 * <code>PP_OK_COMPLETIONPENDING</code>. 106 * <code>PP_OK_COMPLETIONPENDING</code>.
106 * 107 *
107 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 108 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
108 */ 109 */
109 int32_t (*FollowRedirect)(PP_Resource loader, 110 int32_t (*FollowRedirect)(PP_Resource loader,
110 struct PP_CompletionCallback callback); 111 struct PP_CompletionCallback callback);
111
112 /** 112 /**
113 * GetUploadProgress() returns the current upload progress (which is 113 * GetUploadProgress() returns the current upload progress (which is
114 * meaningful after Open() has been called). Progress only refers to the 114 * meaningful after Open() has been called). Progress only refers to the
115 * request body and does not include the headers. 115 * request body and does not include the headers.
116 * 116 *
117 * This data is only available if the <code>URLRequestInfo</code> passed 117 * This data is only available if the <code>URLRequestInfo</code> passed
118 * to Open() had the <code>PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS</code> 118 * to Open() had the <code>PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS</code>
119 * property set to PP_TRUE. 119 * property set to PP_TRUE.
120 * 120 *
121 * @param[in] loader A <code>PP_Resource</code> corresponding to a 121 * @param[in] loader A <code>PP_Resource</code> corresponding to a
122 * <code>URLLoader</code>. 122 * <code>URLLoader</code>.
123 * @param[in] bytes_sent The number of bytes sent thus far. 123 * @param[in] bytes_sent The number of bytes sent thus far.
124 * @param[in] total_bytes_to_be_sent The total number of bytes to be sent. 124 * @param[in] total_bytes_to_be_sent The total number of bytes to be sent.
125 * 125 *
126 * @return <code>PP_TRUE</code> if the upload progress is available, 126 * @return <code>PP_TRUE</code> if the upload progress is available,
127 * <code>PP_FALSE</code> if it is not available. 127 * <code>PP_FALSE</code> if it is not available.
128 */ 128 */
129 PP_Bool (*GetUploadProgress)(PP_Resource loader, 129 PP_Bool (*GetUploadProgress)(PP_Resource loader,
130 int64_t* bytes_sent, 130 int64_t* bytes_sent,
131 int64_t* total_bytes_to_be_sent); 131 int64_t* total_bytes_to_be_sent);
132
133 /** 132 /**
134 * GetDownloadProgress() returns the current download progress, which is 133 * GetDownloadProgress() returns the current download progress, which is
135 * meaningful after Open() has been called. Progress only refers to the 134 * meaningful after Open() has been called. Progress only refers to the
136 * response body and does not include the headers. 135 * response body and does not include the headers.
137 * 136 *
138 * This data is only available if the <code>URLRequestInfo</code> passed to 137 * This data is only available if the <code>URLRequestInfo</code> passed to
139 * Open() had the <code>PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS</code> 138 * Open() had the <code>PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS</code>
140 * property set to <code>PP_TRUE</code>. 139 * property set to <code>PP_TRUE</code>.
141 * 140 *
142 * @param[in] loader A <code>PP_Resource</code> corresponding to a 141 * @param[in] loader A <code>PP_Resource</code> corresponding to a
143 * <code>URLLoader</code>. 142 * <code>URLLoader</code>.
144 * @param[in] bytes_received The number of bytes received thus far. 143 * @param[in] bytes_received The number of bytes received thus far.
145 * @param[in] total_bytes_to_be_received The total number of bytes to be 144 * @param[in] total_bytes_to_be_received The total number of bytes to be
146 * received. The total bytes to be received may be unknown, in which case 145 * received. The total bytes to be received may be unknown, in which case
147 * <code>total_bytes_to_be_received</code> will be set to -1. 146 * <code>total_bytes_to_be_received</code> will be set to -1.
148 * 147 *
149 * @return <code>PP_TRUE</code> if the download progress is available, 148 * @return <code>PP_TRUE</code> if the download progress is available,
150 * <code>PP_FALSE</code> if it is not available. 149 * <code>PP_FALSE</code> if it is not available.
151 */ 150 */
152 PP_Bool (*GetDownloadProgress)(PP_Resource loader, 151 PP_Bool (*GetDownloadProgress)(PP_Resource loader,
153 int64_t* bytes_received, 152 int64_t* bytes_received,
154 int64_t* total_bytes_to_be_received); 153 int64_t* total_bytes_to_be_received);
155
156 /** 154 /**
157 * GetResponseInfo() returns the current <code>URLResponseInfo</code> object. 155 * GetResponseInfo() returns the current <code>URLResponseInfo</code> object.
158 * 156 *
159 * @param[in] instance A <code>PP_Resource</code> corresponding to a 157 * @param[in] instance A <code>PP_Resource</code> corresponding to a
160 * <code>URLLoader</code>. 158 * <code>URLLoader</code>.
161 * 159 *
162 * @return A <code>PP_Resource</code> corresponding to the 160 * @return A <code>PP_Resource</code> corresponding to the
163 * <code>URLResponseInfo</code> if successful, 0 if the loader is not a valid 161 * <code>URLResponseInfo</code> if successful, 0 if the loader is not a valid
164 * resource or if Open() has not been called. 162 * resource or if Open() has not been called.
165 */ 163 */
166 PP_Resource (*GetResponseInfo)(PP_Resource loader); 164 PP_Resource (*GetResponseInfo)(PP_Resource loader);
167
168 /** 165 /**
169 * ReadResponseBody() is used to read the response body. The size of the 166 * ReadResponseBody() is used to read the response body. The size of the
170 * buffer must be large enough to hold the specified number of bytes to read. 167 * buffer must be large enough to hold the specified number of bytes to read.
171 * This function might perform a partial read. 168 * This function might perform a partial read.
172 * 169 *
173 * @param[in] loader A <code>PP_Resource</code> corresponding to a 170 * @param[in] loader A <code>PP_Resource</code> corresponding to a
174 * <code>URLLoader</code>. 171 * <code>URLLoader</code>.
175 * @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.
176 * @param[in] bytes_to_read The number of bytes to read. 173 * @param[in] bytes_to_read The number of bytes to read.
177 * @param[in] callback A <code>PP_CompletionCallback</code> to run on 174 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
(...skipping 20 matching lines...) Expand all
198 * @param[in] callback A <code>PP_CompletionCallback</code> to run on 195 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
199 * asynchronous completion. This callback will run when body is downloaded 196 * asynchronous completion. This callback will run when body is downloaded
200 * or an error occurs after FinishStreamingToFile() returns 197 * or an error occurs after FinishStreamingToFile() returns
201 * <code>PP_OK_COMPLETIONPENDING</code>. 198 * <code>PP_OK_COMPLETIONPENDING</code>.
202 * 199 *
203 * @return An int32_t containing the number of bytes read or an error code 200 * @return An int32_t containing the number of bytes read or an error code
204 * from <code>pp_errors.h</code>. 201 * from <code>pp_errors.h</code>.
205 */ 202 */
206 int32_t (*FinishStreamingToFile)(PP_Resource loader, 203 int32_t (*FinishStreamingToFile)(PP_Resource loader,
207 struct PP_CompletionCallback callback); 204 struct PP_CompletionCallback callback);
208
209 /** 205 /**
210 * Close is a pointer to a function used to cancel any pending IO and close 206 * Close is a pointer to a function used to cancel any pending IO and close
211 * the <code>URLLoader</code> object. Any pending callbacks will still run, 207 * the <code>URLLoader</code> object. Any pending callbacks will still run,
212 * reporting <code>PP_ERROR_ABORTED</code> if pending IO was interrupted. 208 * reporting <code>PP_ERROR_ABORTED</code> if pending IO was interrupted.
213 * It is NOT valid to call Open() again after a call to this function. 209 * It is NOT valid to call Open() again after a call to this function.
214 * 210 *
215 * <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed 211 * <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed
216 * while it is still open, then it will be implicitly closed so you are not 212 * while it is still open, then it will be implicitly closed so you are not
217 * required to call Close(). 213 * required to call Close().
218 * 214 *
219 * @param[in] loader A <code>PP_Resource</code> corresponding to a 215 * @param[in] loader A <code>PP_Resource</code> corresponding to a
220 * <code>URLLoader</code>. 216 * <code>URLLoader</code>.
221 */ 217 */
222 void (*Close)(PP_Resource loader); 218 void (*Close)(PP_Resource loader);
223 }; 219 };
224 /** 220 /**
225 * @} 221 * @}
226 */ 222 */
227 223
228 #endif /* PPAPI_C_PPB_URL_LOADER_H_ */ 224 #endif /* PPAPI_C_PPB_URL_LOADER_H_ */
225
OLDNEW
« no previous file with comments | « ppapi/c/ppb_messaging.h ('k') | ppapi/c/ppb_url_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698