blob: 4905efab87b8582ee7a82e1f5cdfbdc83091b4ef [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>pp::URLLoader Class Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="pp::URLLoader" --><!-- doxytag: inherits="pp::Resource" --><div class="dynheader">
Inheritance diagram for pp::URLLoader:</div>
<div class="dyncontent">
<div class="center"><img src="classpp_1_1_u_r_l_loader__inherit__graph.png" border="0" usemap="#pp_1_1_u_r_l_loader_inherit__map" alt="Inheritance graph" /></div>
<map name="pp_1_1_u_r_l_loader_inherit__map" id="pp_1_1_u_r_l_loader_inherit__map">
<area shape="rect" id="node2" href="classpp_1_1_resource.html" title="A reference counted module resource." alt="" coords="11,5,115,32"></area></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<p><a href="classpp_1_1_u_r_l_loader-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a22b752c975a9302efa2eceb20ecf92ed">URLLoader</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a187f5a2c8422c072c2a33bca4de9e39d">URLLoader</a> (PP_Resource resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a806606ad9e924708b69ae124b4c9d97d">URLLoader</a> (const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;instance)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#ac590ce0a1992376bcf154c4e3cce1ab2">URLLoader</a> (const <a class="el" href="classpp_1_1_u_r_l_loader.html">URLLoader</a> &amp;other)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8">Open</a> (const <a class="el" href="classpp_1_1_u_r_l_request_info.html">URLRequestInfo</a> &amp;request_info, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a411a79d6e9e5335ce31d187d137420af">FollowRedirect</a> (const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a5e3723f5c5d10394329899f75121faf1">GetUploadProgress</a> (int64_t *bytes_sent, int64_t *total_bytes_to_be_sent) const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#ada4a1757e7883912626e2ece85ec1c53">GetDownloadProgress</a> (int64_t *bytes_received, int64_t *total_bytes_to_be_received) const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_u_r_l_response_info.html">URLResponseInfo</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a92757c9e1261280cb4f8fd65e0c8df6f">GetResponseInfo</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a907697c3c268a68eb3b4ca341aea4812">ReadResponseBody</a> (void *buffer, int32_t bytes_to_read, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a2e40e91e7a9ffca3f697497abef843f4">FinishStreamingToFile</a> (const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_u_r_l_loader.html#a43858cb7d3c64dc37128434e18a2ea1c">Close</a> ()</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classpp_1_1_u_r_l_loader.html" title="URLLoader provides an API for loading URLs.">URLLoader</a> provides an API for loading URLs. </p>
<p>Refer to <code>ppapi/examples/url_loader/streaming.cc</code> for an example of how to use this class. </p>
</div><hr /><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a22b752c975a9302efa2eceb20ecf92ed"></a><!-- doxytag: member="pp::URLLoader::URLLoader" ref="a22b752c975a9302efa2eceb20ecf92ed" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_u_r_l_loader.html#a22b752c975a9302efa2eceb20ecf92ed">pp::URLLoader::URLLoader</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor for creating an <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a> <code><a class="el" href="classpp_1_1_u_r_l_loader.html" title="URLLoader provides an API for loading URLs.">URLLoader</a></code> object. </p>
</div>
</div>
<a class="anchor" id="a187f5a2c8422c072c2a33bca4de9e39d"></a><!-- doxytag: member="pp::URLLoader::URLLoader" ref="a187f5a2c8422c072c2a33bca4de9e39d" args="(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_u_r_l_loader.html#a22b752c975a9302efa2eceb20ecf92ed">pp::URLLoader::URLLoader</a> </td>
<td>(</td>
<td class="paramtype">PP_Resource&#160;</td>
<td class="paramname"><em>resource</em></td><td>)</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor used when a <code>PP_Resource</code> is provided as a return value whose reference count we need to increment. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code><a class="el" href="classpp_1_1_u_r_l_loader.html" title="URLLoader provides an API for loading URLs.">URLLoader</a></code> resource. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a806606ad9e924708b69ae124b4c9d97d"></a><!-- doxytag: member="pp::URLLoader::URLLoader" ref="a806606ad9e924708b69ae124b4c9d97d" args="(const InstanceHandle &amp;instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_u_r_l_loader.html#a22b752c975a9302efa2eceb20ecf92ed">pp::URLLoader::URLLoader</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;&#160;</td>
<td class="paramname"><em>instance</em></td><td>)</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor used to allocate a new <a class="el" href="classpp_1_1_u_r_l_loader.html" title="URLLoader provides an API for loading URLs.">URLLoader</a> in the browser. </p>
<p>The resulting object will be <code>is_null</code> if the allocation failed.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance with which this resource will be associated. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ac590ce0a1992376bcf154c4e3cce1ab2"></a><!-- doxytag: member="pp::URLLoader::URLLoader" ref="ac590ce0a1992376bcf154c4e3cce1ab2" args="(const URLLoader &amp;other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_u_r_l_loader.html#a22b752c975a9302efa2eceb20ecf92ed">pp::URLLoader::URLLoader</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_u_r_l_loader.html">URLLoader</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The copy constructor for <code><a class="el" href="classpp_1_1_u_r_l_loader.html" title="URLLoader provides an API for loading URLs.">URLLoader</a></code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">other</td><td>A <code><a class="el" href="classpp_1_1_u_r_l_loader.html" title="URLLoader provides an API for loading URLs.">URLLoader</a></code> to be copied. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="a43858cb7d3c64dc37128434e18a2ea1c"></a><!-- doxytag: member="pp::URLLoader::Close" ref="a43858cb7d3c64dc37128434e18a2ea1c" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_u_r_l_loader.html#a43858cb7d3c64dc37128434e18a2ea1c">pp::URLLoader::Close</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function is used to cancel any pending IO and close the <a class="el" href="classpp_1_1_u_r_l_loader.html" title="URLLoader provides an API for loading URLs.">URLLoader</a> object. </p>
<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="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a> again after a call to this function.</p>
<p><b>Note:</b> If the <code><a class="el" href="classpp_1_1_u_r_l_loader.html" title="URLLoader provides an API for loading URLs.">URLLoader</a></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="classpp_1_1_u_r_l_loader.html#a43858cb7d3c64dc37128434e18a2ea1c" title="This function is used to cancel any pending IO and close the URLLoader object.">Close()</a>. </p>
</div>
</div>
<a class="anchor" id="a2e40e91e7a9ffca3f697497abef843f4"></a><!-- doxytag: member="pp::URLLoader::FinishStreamingToFile" ref="a2e40e91e7a9ffca3f697497abef843f4" args="(const CompletionCallback &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_u_r_l_loader.html#a2e40e91e7a9ffca3f697497abef843f4">pp::URLLoader::FinishStreamingToFile</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
<td class="paramname"><em>cc</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function is used to wait for the response body to be completely downloaded to the file provided by the GetBodyAsFileRef() in the current <code><a class="el" href="classpp_1_1_u_r_l_response_info.html" title="URLResponseInfo provides an API for examining URL responses.">URLResponseInfo</a></code>. </p>
<p>This function is only used if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the <code><a class="el" href="classpp_1_1_u_r_l_request_info.html" title="URLRequestInfo provides an API for creating and manipulating URL requests.">URLRequestInfo</a></code> passed to <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">cc</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">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="classpp_1_1_u_r_l_loader.html#a2e40e91e7a9ffca3f697497abef843f4" title="This function is used to wait for the response body to be completely downloaded to the file provided ...">FinishStreamingToFile()</a> returns <code>PP_OK_COMPLETIONPENDING</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing the number of bytes read or an error code from <code>pp_errors.h</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a411a79d6e9e5335ce31d187d137420af"></a><!-- doxytag: member="pp::URLLoader::FollowRedirect" ref="a411a79d6e9e5335ce31d187d137420af" args="(const CompletionCallback &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_u_r_l_loader.html#a411a79d6e9e5335ce31d187d137420af">pp::URLLoader::FollowRedirect</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
<td class="paramname"><em>cc</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function can be invoked to follow a redirect after <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a> completed on receiving redirect headers. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">cc</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> to run on asynchronous completion of <a class="el" href="classpp_1_1_u_r_l_loader.html#a411a79d6e9e5335ce31d187d137420af" title="This function can be invoked to follow a redirect after Open() completed on receiving redirect header...">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="classpp_1_1_u_r_l_loader.html#a411a79d6e9e5335ce31d187d137420af" title="This function can be invoked to follow a redirect after Open() completed on receiving redirect header...">FollowRedirect()</a> returns <code>PP_OK_COMPLETIONPENDING</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="ada4a1757e7883912626e2ece85ec1c53"></a><!-- doxytag: member="pp::URLLoader::GetDownloadProgress" ref="ada4a1757e7883912626e2ece85ec1c53" args="(int64_t *bytes_received, int64_t *total_bytes_to_be_received) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classpp_1_1_u_r_l_loader.html#ada4a1757e7883912626e2ece85ec1c53">pp::URLLoader::GetDownloadProgress</a> </td>
<td>(</td>
<td class="paramtype">int64_t *&#160;</td>
<td class="paramname"><em>bytes_received</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64_t *&#160;</td>
<td class="paramname"><em>total_bytes_to_be_received</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function returns the current download progress, which is meaningful after <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a> has been called. </p>
<p>Progress only refers to the response body and does not include the headers.</p>
<p>This data is only available if the <code><a class="el" href="classpp_1_1_u_r_l_request_info.html" title="URLRequestInfo provides an API for creating and manipulating URL requests.">URLRequestInfo</a></code> passed to <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a> had the <code>PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS</code> property set to PP_TRUE.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">bytes_received</td><td>The number of bytes received thus far. </td></tr>
<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>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the download progress is available, false if it is not available. </dd></dl>
</div>
</div>
<a class="anchor" id="a92757c9e1261280cb4f8fd65e0c8df6f"></a><!-- doxytag: member="pp::URLLoader::GetResponseInfo" ref="a92757c9e1261280cb4f8fd65e0c8df6f" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_u_r_l_response_info.html">URLResponseInfo</a> <a class="el" href="classpp_1_1_u_r_l_loader.html#a92757c9e1261280cb4f8fd65e0c8df6f">pp::URLLoader::GetResponseInfo</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This is a function that returns the current <code><a class="el" href="classpp_1_1_u_r_l_response_info.html" title="URLResponseInfo provides an API for examining URL responses.">URLResponseInfo</a></code> object. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code><a class="el" href="classpp_1_1_u_r_l_response_info.html" title="URLResponseInfo provides an API for examining URL responses.">URLResponseInfo</a></code> corresponding to the <code><a class="el" href="classpp_1_1_u_r_l_response_info.html" title="URLResponseInfo provides an API for examining URL responses.">URLResponseInfo</a></code> if successful, an <code>is_null</code> object if the loader is not a valid resource or if <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a> has not been called. </dd></dl>
</div>
</div>
<a class="anchor" id="a5e3723f5c5d10394329899f75121faf1"></a><!-- doxytag: member="pp::URLLoader::GetUploadProgress" ref="a5e3723f5c5d10394329899f75121faf1" args="(int64_t *bytes_sent, int64_t *total_bytes_to_be_sent) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classpp_1_1_u_r_l_loader.html#a5e3723f5c5d10394329899f75121faf1">pp::URLLoader::GetUploadProgress</a> </td>
<td>(</td>
<td class="paramtype">int64_t *&#160;</td>
<td class="paramname"><em>bytes_sent</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64_t *&#160;</td>
<td class="paramname"><em>total_bytes_to_be_sent</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function returns the current upload progress (which is only meaningful after <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a> has been called). </p>
<p>Progress only refers to the request body and does not include the headers.</p>
<p>This data is only available if the <code><a class="el" href="classpp_1_1_u_r_l_request_info.html" title="URLRequestInfo provides an API for creating and manipulating URL requests.">URLRequestInfo</a></code> passed to <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a> had the <code>PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS</code> property set to <code>PP_TRUE</code>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">bytes_sent</td><td>The number of bytes sent thus far. </td></tr>
<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>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the upload progress is available, false if it is not available. </dd></dl>
</div>
</div>
<a class="anchor" id="afb72f38f30b94a2d5494225e364395b8"></a><!-- doxytag: member="pp::URLLoader::Open" ref="afb72f38f30b94a2d5494225e364395b8" args="(const URLRequestInfo &amp;request_info, const CompletionCallback &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8">pp::URLLoader::Open</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_u_r_l_request_info.html">URLRequestInfo</a> &amp;&#160;</td>
<td class="paramname"><em>request_info</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
<td class="paramname"><em>cc</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function begins loading the <code><a class="el" href="classpp_1_1_u_r_l_request_info.html" title="URLRequestInfo provides an API for creating and manipulating URL requests.">URLRequestInfo</a></code>. </p>
<p>The operation completes when response headers are received or when an error occurs. Use <a class="el" href="classpp_1_1_u_r_l_loader.html#a92757c9e1261280cb4f8fd65e0c8df6f" title="This is a function that returns the current URLResponseInfo object.">GetResponseInfo()</a> to access the response headers.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">request_info</td><td>A <code><a class="el" href="classpp_1_1_u_r_l_request_info.html" title="URLRequestInfo provides an API for creating and manipulating URL requests.">URLRequestInfo</a></code> corresponding to a <a class="el" href="classpp_1_1_u_r_l_request_info.html" title="URLRequestInfo provides an API for creating and manipulating URL requests.">URLRequestInfo</a>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">cc</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> to run on asynchronous completion of <a class="el" href="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function 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="classpp_1_1_u_r_l_loader.html#afb72f38f30b94a2d5494225e364395b8" title="This function begins loading the URLRequestInfo.">Open()</a> returns <code>PP_OK_COMPLETIONPENDING</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a907697c3c268a68eb3b4ca341aea4812"></a><!-- doxytag: member="pp::URLLoader::ReadResponseBody" ref="a907697c3c268a68eb3b4ca341aea4812" args="(void *buffer, int32_t bytes_to_read, const CompletionCallback &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_u_r_l_loader.html#a907697c3c268a68eb3b4ca341aea4812">pp::URLLoader::ReadResponseBody</a> </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>bytes_to_read</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
<td class="paramname"><em>cc</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function is used to read the response body. </p>
<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>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in,out]</td><td class="paramname">buffer</td><td>A pointer to the buffer for the response body. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">bytes_to_read</td><td>The number of bytes to read. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">cc</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">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>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing the number of bytes read or an error code from <code>pp_errors.h</code>. </dd></dl>
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="url__loader_8h.html">url_loader.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}