Pepper_47_C_interfaces
|
#include <ppb_url_loader.h>
Public Attributes | |
PP_Resource(* | Create )(PP_Instance instance) |
PP_Bool(* | IsURLLoader )(PP_Resource resource) |
int32_t(* | Open )(PP_Resource loader, PP_Resource request_info, struct PP_CompletionCallback callback) |
int32_t(* | FollowRedirect )(PP_Resource loader, struct PP_CompletionCallback callback) |
PP_Bool(* | GetUploadProgress )(PP_Resource loader, int64_t *bytes_sent, int64_t *total_bytes_to_be_sent) |
PP_Bool(* | GetDownloadProgress )(PP_Resource loader, int64_t *bytes_received, int64_t *total_bytes_to_be_received) |
PP_Resource(* | GetResponseInfo )(PP_Resource loader) |
int32_t(* | ReadResponseBody )(PP_Resource loader, void *buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) |
int32_t(* | FinishStreamingToFile )(PP_Resource loader, struct PP_CompletionCallback callback) |
void(* | Close )(PP_Resource loader) |
The PPB_URLLoader interface contains pointers to functions for loading URLs. The typical steps for loading a URL are:
URLRequestInfo
object and set properties on it. Refer to PPB_URLRequestInfo
for further information.URLRequestInfo
as an argument.PPB_URLResponseInfo
for further information.Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE
was set on the URLRequestInfo
in step #2:
URLResponseInfo
returned in step #4. Definition at line 51 of file ppb_url_loader.h.
void(* PPB_URLLoader_1_0::Close)(PP_Resource loader) |
Close is a pointer to a function used to cancel any pending IO and close the URLLoader
object. Any pending callbacks will still run, reporting PP_ERROR_ABORTED
if pending IO was interrupted. It is NOT valid to call Open() again after a call to this function.
Note: If the URLLoader
object is destroyed while it is still open, then it will be implicitly closed so you are not required to call Close().
[in] | loader | A PP_Resource corresponding to a URLLoader . |
Definition at line 217 of file ppb_url_loader.h.
PP_Resource(* PPB_URLLoader_1_0::Create)(PP_Instance instance) |
Create() creates a new URLLoader
object. The URLLoader
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.
[in] | instance | A PP_Instance identifying one instance of a module. |
PP_Resource
corresponding to a URLLoader if successful, 0 if the instance is invalid. Definition at line 64 of file ppb_url_loader.h.
int32_t(* PPB_URLLoader_1_0::FinishStreamingToFile)(PP_Resource loader, struct PP_CompletionCallback callback) |
FinishStreamingToFile() is used to wait for the response body to be completely downloaded to the file provided by the GetBodyAsFileRef() in the current URLResponseInfo
. This function is only used if PP_URLREQUESTPROPERTY_STREAMTOFILE
was set on the URLRequestInfo
passed to Open().
[in] | loader | A PP_Resource corresponding to a URLLoader . |
[in] | callback | A PP_CompletionCallback to run on asynchronous completion. This callback will run when body is downloaded or an error occurs after FinishStreamingToFile() returns PP_OK_COMPLETIONPENDING . |
pp_errors.h
. Definition at line 202 of file ppb_url_loader.h.
int32_t(* PPB_URLLoader_1_0::FollowRedirect)(PP_Resource loader, struct PP_CompletionCallback callback) |
FollowRedirect() can be invoked to follow a redirect after Open() completed on receiving redirect headers.
[in] | loader | A PP_Resource corresponding to a URLLoader . |
[in] | callback | A PP_CompletionCallback to run on asynchronous completion of FollowRedirect(). This callback will run when response headers for the redirect url are received or error occurred. This callback will only run if FollowRedirect() returns PP_OK_COMPLETIONPENDING . |
pp_errors.h
. Definition at line 109 of file ppb_url_loader.h.
PP_Bool(* PPB_URLLoader_1_0::GetDownloadProgress)(PP_Resource loader, int64_t *bytes_received, int64_t *total_bytes_to_be_received) |
GetDownloadProgress() returns the current download progress, which is meaningful after Open() has been called. Progress only refers to the response body and does not include the headers.
This data is only available if the URLRequestInfo
passed to Open() had the PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS
property set to PP_TRUE
.
[in] | loader | A PP_Resource corresponding to a URLLoader . |
[in] | bytes_received | The number of bytes received thus far. |
[in] | total_bytes_to_be_received | The total number of bytes to be received. The total bytes to be received may be unknown, in which case total_bytes_to_be_received will be set to -1. |
PP_TRUE
if the download progress is available, PP_FALSE
if it is not available. Definition at line 150 of file ppb_url_loader.h.
PP_Resource(* PPB_URLLoader_1_0::GetResponseInfo)(PP_Resource loader) |
GetResponseInfo() returns the current URLResponseInfo
object.
[in] | instance | A PP_Resource corresponding to a URLLoader . |
PP_Resource
corresponding to the URLResponseInfo
if successful, 0 if the loader is not a valid resource or if Open() has not been called. Definition at line 163 of file ppb_url_loader.h.
PP_Bool(* PPB_URLLoader_1_0::GetUploadProgress)(PP_Resource loader, int64_t *bytes_sent, int64_t *total_bytes_to_be_sent) |
GetUploadProgress() returns the current upload progress (which is meaningful after Open() has been called). Progress only refers to the request body and does not include the headers.
This data is only available if the URLRequestInfo
passed to Open() had the PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS
property set to PP_TRUE.
[in] | loader | A PP_Resource corresponding to a URLLoader . |
[in] | bytes_sent | The number of bytes sent thus far. |
[in] | total_bytes_to_be_sent | The total number of bytes to be sent. |
PP_TRUE
if the upload progress is available, PP_FALSE
if it is not available. Definition at line 128 of file ppb_url_loader.h.
PP_Bool(* PPB_URLLoader_1_0::IsURLLoader)(PP_Resource resource) |
IsURLLoader() determines if a resource is an URLLoader
.
[in] | resource | A PP_Resource corresponding to a URLLoader . |
PP_TRUE
if the resource is a URLLoader
, PP_FALSE
if the resource is invalid or some type other than URLLoader
. Definition at line 75 of file ppb_url_loader.h.
int32_t(* PPB_URLLoader_1_0::Open)(PP_Resource loader, PP_Resource request_info, struct PP_CompletionCallback callback) |
Open() begins loading the URLRequestInfo
. The operation completes when response headers are received or when an error occurs. Use GetResponseInfo() to access the response headers.
[in] | loader | A PP_Resource corresponding to a URLLoader . |
[in] | resource | A PP_Resource corresponding to a URLRequestInfo . |
[in] | callback | A PP_CompletionCallback to run on asynchronous completion of Open(). This callback will run when response headers for the url are received or error occurred. This callback will only run if Open() returns PP_OK_COMPLETIONPENDING . |
pp_errors.h
. Definition at line 92 of file ppb_url_loader.h.
int32_t(* PPB_URLLoader_1_0::ReadResponseBody)(PP_Resource loader, void *buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) |
ReadResponseBody() is used to read the response body. 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.
[in] | loader | A PP_Resource corresponding to a URLLoader . |
[in,out] | buffer | A pointer to the buffer for the response body. |
[in] | bytes_to_read | The number of bytes to read. |
[in] | callback | A PP_CompletionCallback 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 PP_OK_COMPLETIONPENDING . |
pp_errors.h
. Definition at line 181 of file ppb_url_loader.h.