1 {{+bindTo:partials.standard_nacl_api}} 2 <h1>PPB_URLLoader Struct Reference</h1> 3 <div id="doxygen-ref"> 4 {{- dummy div to appease doxygen -}} 5 <div> 6 <!-- Generated by Doxygen 1.7.6.1 --> 7 8 9 </div> 10 <!--header--> 11 <div class="contents"> 12 <!-- doxytag: class="PPB_URLLoader" --><h2> 13 Data Fields</h2><table class="memberdecls"> 14 15 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#ab0ab892fe290ba6449d467db53fd4987">Create</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td></tr> 16 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a70db3876aed119140479e952cb7b1057">IsURLLoader</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr> 17 <tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14">Open</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> request_info, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr> 18 <tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a1932cf9779391f4d3efb4582ff49b0a6">FollowRedirect</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr> 19 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#abb04744dfe5fce11e46c0e7e36c30b65">GetUploadProgress</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, int64_t *bytes_sent, int64_t *total_bytes_to_be_sent)</td></tr> 20 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a3673506c6e0e23287b7d10e1163a0bbe">GetDownloadProgress</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, int64_t *bytes_received, int64_t *total_bytes_to_be_received)</td></tr> 21 <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a4901dcc43cfdc026e582555974d4d853">GetResponseInfo</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader)</td></tr> 22 <tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a92d0f2dc44bc4d087ad0ddca6557fb05">ReadResponseBody</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, void *buffer, int32_t bytes_to_read, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr> 23 <tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a187774b3255231fa00ad1fe1364677ff">FinishStreamingToFile</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr> 24 <tr><td class="memItemLeft" align="right" valign="top">void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#af96116176988be90bdee2619deff6e42">Close</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader)</td></tr> 25 </table> 26 <hr /><a name="details" id="details"></a><h2>Detailed Description</h2> 27 <div class="textblock"><p>The <b>PPB_URLLoader</b> interface contains pointers to functions for loading URLs. </p> 28 <p>The typical steps for loading a URL are:</p> 29 <ol type="1"> 30 <li>Call <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#ab0ab892fe290ba6449d467db53fd4987" title="Create() creates a new URLLoader object.">Create()</a> to create a URLLoader object.</li> 31 <li>Create a <code>URLRequestInfo</code> object and set properties on it. Refer to <code>PPB_URLRequestInfo</code> for further information.</li> 32 <li>Call <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> with the <code>URLRequestInfo</code> as an argument.</li> 33 <li>When <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> completes, call <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a4901dcc43cfdc026e582555974d4d853" title="GetResponseInfo() returns the current URLResponseInfo object.">GetResponseInfo()</a> to examine the response headers. Refer to <code>PPB_URLResponseInfo</code> for further information.</li> 34 <li>Call <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a92d0f2dc44bc4d087ad0ddca6557fb05" title="ReadResponseBody() is used to read the response body.">ReadResponseBody()</a> to stream the data for the response.</li> 35 </ol> 36 <p>Alternatively, if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the <code>URLRequestInfo</code> in step #2:</p> 37 <ul> 38 <li>Call <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a187774b3255231fa00ad1fe1364677ff" title="FinishStreamingToFile() is used to wait for the response body to be completely downloaded to the file...">FinishStreamingToFile()</a>, after examining the response headers (step #4), to wait for the downloaded file to be complete.</li> 39 <li>Then, access the downloaded file using the GetBodyAsFileRef() function of the <code>URLResponseInfo</code> returned in step #4. </li> 40 </ul> 41 </div><hr /><h2>Field Documentation</h2> 42 <a class="anchor" id="af96116176988be90bdee2619deff6e42"></a><!-- doxytag: member="PPB_URLLoader::Close" ref="af96116176988be90bdee2619deff6e42" args=")(PP_Resource loader)" --> 43 <div class="memitem"> 44 <div class="memproto"> 45 <table class="memname"> 46 <tr> 47 <td class="memname">void(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#af96116176988be90bdee2619deff6e42">PPB_URLLoader::Close</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader)</td> 48 </tr> 49 </table> 50 </div> 51 <div class="memdoc"> 52 <p>Close is a pointer to a function used to cancel any pending IO and close the <code>URLLoader</code> object. </p> 53 <p>Any pending callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> if pending IO was interrupted. It is NOT valid to call <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> again after a call to this function.</p> 54 <p><b>Note:</b> If the <code>URLLoader</code> object is destroyed while it is still open, then it will be implicitly closed so you are not required to call <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#af96116176988be90bdee2619deff6e42" title="Close is a pointer to a function used to cancel any pending IO and close the URLLoader object...">Close()</a>.</p> 55 <dl class="params"><dt><b>Parameters:</b></dt><dd> 56 <table class="params"> 57 <tr><td class="paramdir">[in]</td><td class="paramname">loader</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>. </td></tr> 58 </table> 59 </dd> 60 </dl> 61 </div> 62 </div> 63 <a class="anchor" id="ab0ab892fe290ba6449d467db53fd4987"></a><!-- doxytag: member="PPB_URLLoader::Create" ref="ab0ab892fe290ba6449d467db53fd4987" args=")(PP_Instance instance)" --> 64 <div class="memitem"> 65 <div class="memproto"> 66 <table class="memname"> 67 <tr> 68 <td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#ab0ab892fe290ba6449d467db53fd4987">PPB_URLLoader::Create</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td> 69 </tr> 70 </table> 71 </div> 72 <div class="memdoc"> 73 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#ab0ab892fe290ba6449d467db53fd4987" title="Create() creates a new URLLoader object.">Create()</a> creates a new <code>URLLoader</code> object. </p> 74 <p>The <code>URLLoader</code> is associated with a particular instance, so that any UI dialogs that need to be shown to the user can be positioned relative to the window containing the instance.</p> 75 <dl class="params"><dt><b>Parameters:</b></dt><dd> 76 <table class="params"> 77 <tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>A <code>PP_Instance</code> identifying one instance of a module.</td></tr> 78 </table> 79 </dd> 80 </dl> 81 <dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> corresponding to a URLLoader if successful, 0 if the instance is invalid. </dd></dl> 82 </div> 83 </div> 84 <a class="anchor" id="a187774b3255231fa00ad1fe1364677ff"></a><!-- doxytag: member="PPB_URLLoader::FinishStreamingToFile" ref="a187774b3255231fa00ad1fe1364677ff" args=")(PP_Resource loader, struct PP_CompletionCallback callback)" --> 85 <div class="memitem"> 86 <div class="memproto"> 87 <table class="memname"> 88 <tr> 89 <td class="memname">int32_t(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a187774b3255231fa00ad1fe1364677ff">PPB_URLLoader::FinishStreamingToFile</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td> 90 </tr> 91 </table> 92 </div> 93 <div class="memdoc"> 94 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a187774b3255231fa00ad1fe1364677ff" title="FinishStreamingToFile() is used to wait for the response body to be completely downloaded to the file...">FinishStreamingToFile()</a> is used to wait for the response body to be completely downloaded to the file provided by the GetBodyAsFileRef() in the current <code>URLResponseInfo</code>. </p> 95 <p>This function is only used if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the <code>URLRequestInfo</code> passed to <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a>.</p> 96 <dl class="params"><dt><b>Parameters:</b></dt><dd> 97 <table class="params"> 98 <tr><td class="paramdir">[in]</td><td class="paramname">loader</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>. </td></tr> 99 <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to run on asynchronous completion. This callback will run when body is downloaded or an error occurs after <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a187774b3255231fa00ad1fe1364677ff" title="FinishStreamingToFile() is used to wait for the response body to be completely downloaded to the file...">FinishStreamingToFile()</a> returns <code>PP_OK_COMPLETIONPENDING</code>.</td></tr> 100 </table> 101 </dd> 102 </dl> 103 <dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing the number of bytes read or an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl> 104 </div> 105 </div> 106 <a class="anchor" id="a1932cf9779391f4d3efb4582ff49b0a6"></a><!-- doxytag: member="PPB_URLLoader::FollowRedirect" ref="a1932cf9779391f4d3efb4582ff49b0a6" args=")(PP_Resource loader, struct PP_CompletionCallback callback)" --> 107 <div class="memitem"> 108 <div class="memproto"> 109 <table class="memname"> 110 <tr> 111 <td class="memname">int32_t(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a1932cf9779391f4d3efb4582ff49b0a6">PPB_URLLoader::FollowRedirect</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td> 112 </tr> 113 </table> 114 </div> 115 <div class="memdoc"> 116 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a1932cf9779391f4d3efb4582ff49b0a6" title="FollowRedirect() can be invoked to follow a redirect after Open() completed on receiving redirect hea...">FollowRedirect()</a> can be invoked to follow a redirect after <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> completed on receiving redirect headers. </p> 117 <dl class="params"><dt><b>Parameters:</b></dt><dd> 118 <table class="params"> 119 <tr><td class="paramdir">[in]</td><td class="paramname">loader</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>. </td></tr> 120 <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to run on asynchronous completion of <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a1932cf9779391f4d3efb4582ff49b0a6" title="FollowRedirect() can be invoked to follow a redirect after Open() completed on receiving redirect hea...">FollowRedirect()</a>. This callback will run when response headers for the redirect url are received or error occurred. This callback will only run if <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a1932cf9779391f4d3efb4582ff49b0a6" title="FollowRedirect() can be invoked to follow a redirect after Open() completed on receiving redirect hea...">FollowRedirect()</a> returns <code>PP_OK_COMPLETIONPENDING</code>.</td></tr> 121 </table> 122 </dd> 123 </dl> 124 <dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl> 125 </div> 126 </div> 127 <a class="anchor" id="a3673506c6e0e23287b7d10e1163a0bbe"></a><!-- doxytag: member="PPB_URLLoader::GetDownloadProgress" ref="a3673506c6e0e23287b7d10e1163a0bbe" args=")(PP_Resource loader, int64_t *bytes_received, int64_t *total_bytes_to_be_received)" --> 128 <div class="memitem"> 129 <div class="memproto"> 130 <table class="memname"> 131 <tr> 132 <td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a3673506c6e0e23287b7d10e1163a0bbe">PPB_URLLoader::GetDownloadProgress</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, int64_t *bytes_received, int64_t *total_bytes_to_be_received)</td> 133 </tr> 134 </table> 135 </div> 136 <div class="memdoc"> 137 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a3673506c6e0e23287b7d10e1163a0bbe" title="GetDownloadProgress() returns the current download progress, which is meaningful after Open() has bee...">GetDownloadProgress()</a> returns the current download progress, which is meaningful after <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> has been called. </p> 138 <p>Progress only refers to the response body and does not include the headers.</p> 139 <p>This data is only available if the <code>URLRequestInfo</code> passed to <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> had the <code>PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS</code> property set to <code>PP_TRUE</code>.</p> 140 <dl class="params"><dt><b>Parameters:</b></dt><dd> 141 <table class="params"> 142 <tr><td class="paramdir">[in]</td><td class="paramname">loader</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>. </td></tr> 143 <tr><td class="paramdir">[in]</td><td class="paramname">bytes_received</td><td>The number of bytes received thus far. </td></tr> 144 <tr><td class="paramdir">[in]</td><td class="paramname">total_bytes_to_be_received</td><td>The total number of bytes to be received. The total bytes to be received may be unknown, in which case <code>total_bytes_to_be_received</code> will be set to -1.</td></tr> 145 </table> 146 </dd> 147 </dl> 148 <dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the download progress is available, <code>PP_FALSE</code> if it is not available. </dd></dl> 149 </div> 150 </div> 151 <a class="anchor" id="a4901dcc43cfdc026e582555974d4d853"></a><!-- doxytag: member="PPB_URLLoader::GetResponseInfo" ref="a4901dcc43cfdc026e582555974d4d853" args=")(PP_Resource loader)" --> 152 <div class="memitem"> 153 <div class="memproto"> 154 <table class="memname"> 155 <tr> 156 <td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a4901dcc43cfdc026e582555974d4d853">PPB_URLLoader::GetResponseInfo</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader)</td> 157 </tr> 158 </table> 159 </div> 160 <div class="memdoc"> 161 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a4901dcc43cfdc026e582555974d4d853" title="GetResponseInfo() returns the current URLResponseInfo object.">GetResponseInfo()</a> returns the current <code>URLResponseInfo</code> object. </p> 162 <dl class="params"><dt><b>Parameters:</b></dt><dd> 163 <table class="params"> 164 <tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>.</td></tr> 165 </table> 166 </dd> 167 </dl> 168 <dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> corresponding to the <code>URLResponseInfo</code> if successful, 0 if the loader is not a valid resource or if <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> has not been called. </dd></dl> 169 </div> 170 </div> 171 <a class="anchor" id="abb04744dfe5fce11e46c0e7e36c30b65"></a><!-- doxytag: member="PPB_URLLoader::GetUploadProgress" ref="abb04744dfe5fce11e46c0e7e36c30b65" args=")(PP_Resource loader, int64_t *bytes_sent, int64_t *total_bytes_to_be_sent)" --> 172 <div class="memitem"> 173 <div class="memproto"> 174 <table class="memname"> 175 <tr> 176 <td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#abb04744dfe5fce11e46c0e7e36c30b65">PPB_URLLoader::GetUploadProgress</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, int64_t *bytes_sent, int64_t *total_bytes_to_be_sent)</td> 177 </tr> 178 </table> 179 </div> 180 <div class="memdoc"> 181 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#abb04744dfe5fce11e46c0e7e36c30b65" title="GetUploadProgress() returns the current upload progress (which is meaningful after Open() has been ca...">GetUploadProgress()</a> returns the current upload progress (which is meaningful after <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> has been called). </p> 182 <p>Progress only refers to the request body and does not include the headers.</p> 183 <p>This data is only available if the <code>URLRequestInfo</code> passed to <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> had the <code>PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS</code> property set to PP_TRUE.</p> 184 <dl class="params"><dt><b>Parameters:</b></dt><dd> 185 <table class="params"> 186 <tr><td class="paramdir">[in]</td><td class="paramname">loader</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>. </td></tr> 187 <tr><td class="paramdir">[in]</td><td class="paramname">bytes_sent</td><td>The number of bytes sent thus far. </td></tr> 188 <tr><td class="paramdir">[in]</td><td class="paramname">total_bytes_to_be_sent</td><td>The total number of bytes to be sent.</td></tr> 189 </table> 190 </dd> 191 </dl> 192 <dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the upload progress is available, <code>PP_FALSE</code> if it is not available. </dd></dl> 193 </div> 194 </div> 195 <a class="anchor" id="a70db3876aed119140479e952cb7b1057"></a><!-- doxytag: member="PPB_URLLoader::IsURLLoader" ref="a70db3876aed119140479e952cb7b1057" args=")(PP_Resource resource)" --> 196 <div class="memitem"> 197 <div class="memproto"> 198 <table class="memname"> 199 <tr> 200 <td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a70db3876aed119140479e952cb7b1057">PPB_URLLoader::IsURLLoader</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td> 201 </tr> 202 </table> 203 </div> 204 <div class="memdoc"> 205 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a70db3876aed119140479e952cb7b1057" title="IsURLLoader() determines if a resource is an URLLoader.">IsURLLoader()</a> determines if a resource is an <code>URLLoader</code>. </p> 206 <dl class="params"><dt><b>Parameters:</b></dt><dd> 207 <table class="params"> 208 <tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>.</td></tr> 209 </table> 210 </dd> 211 </dl> 212 <dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the resource is a <code>URLLoader</code>, <code>PP_FALSE</code> if the resource is invalid or some type other than <code>URLLoader</code>. </dd></dl> 213 </div> 214 </div> 215 <a class="anchor" id="a5e7fca398c1042e2c81211da80d20e14"></a><!-- doxytag: member="PPB_URLLoader::Open" ref="a5e7fca398c1042e2c81211da80d20e14" args=")(PP_Resource loader, PP_Resource request_info, struct PP_CompletionCallback callback)" --> 216 <div class="memitem"> 217 <div class="memproto"> 218 <table class="memname"> 219 <tr> 220 <td class="memname">int32_t(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14">PPB_URLLoader::Open</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> request_info, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td> 221 </tr> 222 </table> 223 </div> 224 <div class="memdoc"> 225 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> begins loading the <code>URLRequestInfo</code>. </p> 226 <p>The operation completes when response headers are received or when an error occurs. Use <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a4901dcc43cfdc026e582555974d4d853" title="GetResponseInfo() returns the current URLResponseInfo object.">GetResponseInfo()</a> to access the response headers.</p> 227 <dl class="params"><dt><b>Parameters:</b></dt><dd> 228 <table class="params"> 229 <tr><td class="paramdir">[in]</td><td class="paramname">loader</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>. </td></tr> 230 <tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>URLRequestInfo</code>. </td></tr> 231 <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to run on asynchronous completion of <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a>. This callback will run when response headers for the url are received or error occurred. This callback will only run if <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a5e7fca398c1042e2c81211da80d20e14" title="Open() begins loading the URLRequestInfo.">Open()</a> returns <code>PP_OK_COMPLETIONPENDING</code>.</td></tr> 232 </table> 233 </dd> 234 </dl> 235 <dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl> 236 </div> 237 </div> 238 <a class="anchor" id="a92d0f2dc44bc4d087ad0ddca6557fb05"></a><!-- doxytag: member="PPB_URLLoader::ReadResponseBody" ref="a92d0f2dc44bc4d087ad0ddca6557fb05" args=")(PP_Resource loader, void *buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback)" --> 239 <div class="memitem"> 240 <div class="memproto"> 241 <table class="memname"> 242 <tr> 243 <td class="memname">int32_t(* <a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a92d0f2dc44bc4d087ad0ddca6557fb05">PPB_URLLoader::ReadResponseBody</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> loader, void *buffer, int32_t bytes_to_read, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td> 244 </tr> 245 </table> 246 </div> 247 <div class="memdoc"> 248 <p><a class="el" href="struct_p_p_b___u_r_l_loader__1__0.html#a92d0f2dc44bc4d087ad0ddca6557fb05" title="ReadResponseBody() is used to read the response body.">ReadResponseBody()</a> is used to read the response body. </p> 249 <p>The size of the buffer must be large enough to hold the specified number of bytes to read. This function might perform a partial read.</p> 250 <dl class="params"><dt><b>Parameters:</b></dt><dd> 251 <table class="params"> 252 <tr><td class="paramdir">[in]</td><td class="paramname">loader</td><td>A <code>PP_Resource</code> corresponding to a <code>URLLoader</code>. </td></tr> 253 <tr><td class="paramdir">[in,out]</td><td class="paramname">buffer</td><td>A pointer to the buffer for the response body. </td></tr> 254 <tr><td class="paramdir">[in]</td><td class="paramname">bytes_to_read</td><td>The number of bytes to read. </td></tr> 255 <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to run on asynchronous completion. The callback will run if the bytes (full or partial) are read or an error occurs asynchronously. This callback will run only if this function returns <code>PP_OK_COMPLETIONPENDING</code>.</td></tr> 256 </table> 257 </dd> 258 </dl> 259 <dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing the number of bytes read or an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl> 260 </div> 261 </div> 262 <hr />The documentation for this struct was generated from the following file:<ul> 263 <li><a class="el" href="ppb__url__loader_8h.html">ppb_url_loader.h</a></li> 264 </ul> 265 </div><!-- contents --> 266 </div> 267 {{/partials.standard_nacl_api}} 268