Pepper_47_C++_interfaces
Public Member Functions | List of all members
pp::URLRequestInfo Class Reference

URLRequestInfo provides an API for creating and manipulating URL requests. More...

#include <url_request_info.h>

Inheritance diagram for pp::URLRequestInfo:
Inheritance graph
Collaboration diagram for pp::URLRequestInfo:
Collaboration graph

Public Member Functions

 URLRequestInfo ()
 
 URLRequestInfo (const InstanceHandle &instance)
 
 URLRequestInfo (const URLRequestInfo &other)
 
bool SetProperty (PP_URLRequestProperty property, const Var &value)
 
bool AppendDataToBody (const void *data, uint32_t len)
 
bool AppendFileToBody (const FileRef &file_ref, PP_Time expected_last_modified_time=0)
 
bool AppendFileRangeToBody (const FileRef &file_ref, int64_t start_offset, int64_t length, PP_Time expected_last_modified_time=0)
 
bool SetURL (const Var &url_string)
 
bool SetMethod (const Var &method_string)
 
bool SetHeaders (const Var &headers_string)
 
bool SetStreamToFile (bool enable)
 
bool SetFollowRedirects (bool enable)
 
bool SetRecordDownloadProgress (bool enable)
 
bool SetRecordUploadProgress (bool enable)
 
bool SetCustomReferrerURL (const Var &url)
 
bool SetAllowCrossOriginRequests (bool enable)
 
bool SetAllowCredentials (bool enable)
 
bool SetCustomContentTransferEncoding (const Var &content_transfer_encoding)
 
bool SetPrefetchBufferUpperThreshold (int32_t size)
 
bool SetPrefetchBufferLowerThreshold (int32_t size)
 
bool SetCustomUserAgent (const Var &user_agent)
 
- Public Member Functions inherited from pp::Resource
 Resource ()
 The default constructor. More...
 
 Resource (const Resource &other)
 
virtual ~Resource ()
 Destructor. More...
 
Resourceoperator= (const Resource &other)
 
bool is_null () const
 
PP_Resource pp_resource () const
 
PP_Resource detach ()
 

Additional Inherited Members

- Protected Member Functions inherited from pp::Resource
 Resource (PP_Resource resource)
 
 Resource (PassRef, PP_Resource resource)
 
void PassRefFromConstructor (PP_Resource resource)
 
void Clear ()
 Sets this resource to null. This releases ownership of the resource. More...
 

Detailed Description

URLRequestInfo provides an API for creating and manipulating URL requests.

Definition at line 20 of file url_request_info.h.

Constructor & Destructor Documentation

pp::URLRequestInfo::URLRequestInfo ( )
inline

Default constructor. This constructor creates an is_null resource.

Definition at line 24 of file url_request_info.h.

pp::URLRequestInfo::URLRequestInfo ( const InstanceHandle instance)
explicit

A constructor used to allocate a new URLLoader in the browser. The resulting object will be is_null if the allocation failed.

Parameters
[in]instanceThe instance with which this resource will be associated.

Definition at line 22 of file url_request_info.cc.

References pp::Resource::PassRefFromConstructor(), and pp::InstanceHandle::pp_instance().

pp::URLRequestInfo::URLRequestInfo ( const URLRequestInfo other)

The copy constructor for URLRequestInfo.

Parameters
[in]otherA URLRequestInfo to be copied.

Definition at line 29 of file url_request_info.cc.

Member Function Documentation

bool pp::URLRequestInfo::AppendDataToBody ( const void *  data,
uint32_t  len 
)

AppendDataToBody() appends data to the request body. A content-length request header will be automatically generated.

Parameters
[in]dataA pointer to a buffer holding the data.
[in]lenThe length, in bytes, of the data.
Returns
true if successful, false if any of the parameters are invalid.

Definition at line 41 of file url_request_info.cc.

References pp::Resource::pp_resource().

bool pp::URLRequestInfo::AppendFileRangeToBody ( const FileRef file_ref,
int64_t  start_offset,
int64_t  length,
PP_Time  expected_last_modified_time = 0 
)

AppendFileRangeToBody() is a pointer to a function used to append part or all of a file, to be uploaded, to the request body. A content-length request header will be automatically generated.

Parameters
[in]file_refA FileRef containing the file reference.
[in]start_offsetAn optional starting point offset within the file.
[in]lengthAn optional number of bytes of the file to be included. If the value is -1, then the sub-range to upload extends to the end of the file.
[in]expected_last_modified_timeAn optional (non-zero) last modified time stamp used to validate that the file was not modified since the given time before it was uploaded. The upload will fail with an error code of PP_ERROR_FILECHANGED if the file has been modified since the given time. If expected_last_modified_time is 0, then no validation is performed.
Returns
true if successful, false if any of the parameters are invalid.

Definition at line 61 of file url_request_info.cc.

References AppendFileToBody(), and pp::Resource::pp_resource().

bool pp::URLRequestInfo::AppendFileToBody ( const FileRef file_ref,
PP_Time  expected_last_modified_time = 0 
)

AppendFileToBody() is used to append an entire file, to be uploaded, to the request body. A content-length request header will be automatically generated.

Parameters
[in]file_refA FileRef containing the file reference.
[in]expected_last_modified_timeAn optional (non-zero) last modified time stamp used to validate that the file was not modified since the given time before it was uploaded. The upload will fail with an error code of PP_ERROR_FILECHANGED if the file has been modified since the given time. If expected_last_modified_time is 0, then no validation is performed.
Returns
true if successful, false if any of the parameters are invalid.

Definition at line 48 of file url_request_info.cc.

References pp::Resource::pp_resource().

Referenced by AppendFileRangeToBody().

bool pp::URLRequestInfo::SetAllowCredentials ( bool  enable)
inline

SetAllowCredentials() sets the PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS (corresponding to a bool of type PP_VARTYPE_BOOL). The default of the property is false. Whether HTTP credentials are sent with cross-origin requests. If false, no credentials are sent with the request and cookies are ignored in the response. If the request is not cross-origin, this property is ignored.

Parameters
[in]enableA bool containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 244 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetAllowCrossOriginRequests ( bool  enable)
inline

SetAllowCrossOriginRequests() sets the PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS (corresponding to a bool of type PP_VARTYPE_BOOL). The default of the property is false. Whether cross-origin requests are allowed. Cross-origin requests are made using the CORS (Cross-Origin Resource Sharing) algorithm to check whether the request should be allowed. For the complete CORS algorithm, refer to the Cross-Origin Resource Sharing documentation.

Parameters
[in]enableA bool containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 229 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetCustomContentTransferEncoding ( const Var content_transfer_encoding)
inline

SetCustomContentTransferEncoding() sets the PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING (corresponding to a string of type PP_VARTYPE_STRING or might be set to undefined as PP_VARTYPE_UNDEFINED). Set it to a string to set a custom content-transfer-encoding header (if empty, that header will be omitted), or to undefined to use the default (if any). Only loaders with universal access (only available on trusted implementations) will accept URLRequestInfo objects that try to set a custom content transfer encoding; if given to a loader without universal access, PP_ERROR_BADARGUMENT will result.

Parameters
[in]content_transfer_encodingA Var containing the property value. To use the default content transfer encoding, set content_transfer_encoding to an undefined Var.
Returns
true if successful, false if the parameter is invalid.

Definition at line 264 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetCustomReferrerURL ( const Var url)
inline

SetCustomReferrerURL() sets the PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL (corresponding to a string of type PP_VARTYPE_STRING or might be set to undefined as PP_VARTYPE_UNDEFINED). Set it to a string to set a custom referrer (if empty, the referrer header will be omitted), or to undefined to use the default referrer. Only loaders with universal access (only available on trusted implementations) will accept URLRequestInfo objects that try to set a custom referrer; if given to a loader without universal access, PP_ERROR_BADARGUMENT will result.

Parameters
[in]urlA Var containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 212 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetCustomUserAgent ( const Var user_agent)
inline

SetCustomUserAgent() sets the PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT (corresponding to a string of type PP_VARTYPE_STRING or might be set to undefined as PP_VARTYPE_UNDEFINED). Set it to a string to set a custom user-agent header (if empty, that header will be omitted), or to undefined to use the default. Only loaders with universal access (only available on trusted implementations) will accept URLRequestInfo objects that try to set a custom user agent; if given to a loader without universal access, PP_ERROR_BADARGUMENT will result.

Parameters
[in]user_agentA Var containing the property value. To use the default user agent, set user_agent to an undefined Var.
Returns
true if successful, false if the parameter is invalid.

Definition at line 327 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetFollowRedirects ( bool  enable)
inline

SetFollowRedirects() sets the PP_URLREQUESTPROPERTY_FOLLOWREDIRECT (corresponding to a bool of type PP_VARTYPE_BOOL). The default of the property is true. Set this value to false if you want to use URLLoader::FollowRedirects() to follow the redirects only after examining redirect headers.

Parameters
[in]enableA bool containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 167 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetHeaders ( const Var headers_string)
inline

SetHeaders() sets the PP_URLREQUESTPROPERTY_HEADERS (corresponding to a
delimited string of type PP_VARTYPE_STRING) property for the request. Refer to the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"Header Field Definitions documentation for further information.

Parameters
[in]headers_stringA Var containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 139 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetMethod ( const Var method_string)
inline

SetMethod() sets the PP_URLREQUESTPROPERTY_METHOD (corresponding to a string of type PP_VARTYPE_STRING) property for the request. This string is either a POST or GET. Refer to the HTTP Methods documentation for further information.

Parameters
[in]method_stringA Var containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 124 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetPrefetchBufferLowerThreshold ( int32_t  size)
inline

SetPrefetchBufferLowerThreshold() sets the PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD (corresponding to a integer of type PP_VARTYPE_INT32). The default is not defined and is set by the browser to a value appropriate for the default PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD. Set it to an integer to set a lower threshold for the prefetched buffer of an asynchronous load. When reached, the browser will resume loading if If PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD had previously been reached. When setting this property, PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD must also be set. Behavior is undefined if the former is >= the latter.

Parameters
[in]sizeAn int32_t containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 307 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetPrefetchBufferUpperThreshold ( int32_t  size)
inline

SetPrefetchBufferUpperThreshold() sets the PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD (corresponding to a integer of type PP_VARTYPE_INT32). The default is not defined and is set by the browser possibly depending on system capabilities. Set it to an integer to set an upper threshold for the prefetched buffer of an asynchronous load. When exceeded, the browser will defer loading until PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD is hit, at which time it will begin prefetching again. When setting this property, PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD must also be set. Behavior is undefined if the former is <= the latter.

Parameters
[in]sizeAn int32_t containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 285 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetProperty ( PP_URLRequestProperty  property,
const Var value 
)

SetProperty() sets a request property. The value of the property must be the correct type according to the property being set.

Parameters
[in]propertyA PP_URLRequestProperty identifying the property to set.
[in]valueA Var containing the property value.
Returns
true if successful, false if any of the parameters are invalid.

Definition at line 33 of file url_request_info.cc.

References pp::Resource::pp_resource(), and pp::Var::pp_var().

Referenced by SetAllowCredentials(), SetAllowCrossOriginRequests(), SetCustomContentTransferEncoding(), SetCustomReferrerURL(), SetCustomUserAgent(), SetFollowRedirects(), SetHeaders(), SetMethod(), SetPrefetchBufferLowerThreshold(), SetPrefetchBufferUpperThreshold(), SetRecordDownloadProgress(), SetRecordUploadProgress(), SetStreamToFile(), and SetURL().

bool pp::URLRequestInfo::SetRecordDownloadProgress ( bool  enable)
inline

SetRecordDownloadProgress() sets the PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGESS (corresponding to a bool of type PP_VARTYPE_BOOL). The default of the property is false. Set this value to true if you want to be able to poll the download progress using URLLoader::GetDownloadProgress().

Parameters
[in]enableA bool containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 181 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetRecordUploadProgress ( bool  enable)
inline

SetRecordUploadProgress() sets the PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS (corresponding to a bool of type PP_VARTYPE_BOOL). The default of the property is false. Set this value to true if you want to be able to poll the upload progress using URLLoader::GetUploadProgress().

Parameters
[in]enableA bool containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 194 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetStreamToFile ( bool  enable)
inline

SetStreamToFile() sets the PP_URLREQUESTPROPERTY_STREAMTOFILE (corresponding to a bool of type PP_VARTYPE_BOOL). The default of the property is false. Set this value to true if you want to download the data to a file. Use URL_Loader::FinishStreamingToFile() to complete the download.

Parameters
[in]enableA bool containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 153 of file url_request_info.h.

References SetProperty().

bool pp::URLRequestInfo::SetURL ( const Var url_string)
inline

SetURL() sets the PP_URLREQUESTPROPERTY_URL property for the request.

Parameters
[in]url_stringA Var containing the property value.
Returns
true if successful, false if the parameter is invalid.

Definition at line 110 of file url_request_info.h.

References SetProperty().


The documentation for this class was generated from the following files: