EWebKit  1.0
Typedefs | Enumerations | Functions
ewk_download_job.h File Reference

Describes the Download Job API. More...

#include "ewk_url_request.h"
#include "ewk_url_response.h"
#include <Eina.h>

Go to the source code of this file.

Typedefs

typedef struct EwkObject Ewk_Download_Job
 
typedef enum Ewk_Download_Job_State Ewk_Download_Job_State
 Creates a type name for Ewk_Download_Job_State.
 

Enumerations

enum  Ewk_Download_Job_State {
  EWK_DOWNLOAD_JOB_STATE_UNKNOWN = -1, EWK_DOWNLOAD_JOB_STATE_NOT_STARTED, EWK_DOWNLOAD_JOB_STATE_DOWNLOADING, EWK_DOWNLOAD_JOB_STATE_FAILED,
  EWK_DOWNLOAD_JOB_STATE_CANCELLING, EWK_DOWNLOAD_JOB_STATE_CANCELLED, EWK_DOWNLOAD_JOB_STATE_FINISHED
}
 Defines the possible states of a download. More...
 

Functions

EAPI Ewk_Download_Job_State ewk_download_job_state_get (const Ewk_Download_Job *download)
 
EAPI Ewk_Url_Requestewk_download_job_request_get (const Ewk_Download_Job *download)
 
EAPI Ewk_Url_Responseewk_download_job_response_get (const Ewk_Download_Job *download)
 
EAPI const char * ewk_download_job_destination_get (const Ewk_Download_Job *download)
 
EAPI Eina_Bool ewk_download_job_destination_set (Ewk_Download_Job *download, const char *destination)
 
EAPI const char * ewk_download_job_suggested_filename_get (const Ewk_Download_Job *download)
 
EAPI Eina_Bool ewk_download_job_cancel (Ewk_Download_Job *download)
 
EAPI double ewk_download_job_estimated_progress_get (const Ewk_Download_Job *download)
 
EAPI double ewk_download_job_elapsed_time_get (const Ewk_Download_Job *download)
 
EAPI uint64_t ewk_download_job_received_data_size_get (const Ewk_Download_Job *download)
 

Detailed Description

Describes the Download Job API.

Note
Ewk_Download_Job encapsulates a WebKit download job in order to provide information about it and interact with it (e.g. set the destination path, cancel the download, ...).

Typedef Documentation

typedef struct EwkObject Ewk_Download_Job

Declare Ewk_Download_Job as Ewk_Object.

See also
Ewk_Object

Enumeration Type Documentation

Defines the possible states of a download.

Enumerator
EWK_DOWNLOAD_JOB_STATE_UNKNOWN 

The download state is unknown.

EWK_DOWNLOAD_JOB_STATE_NOT_STARTED 

The download has not started yet.

EWK_DOWNLOAD_JOB_STATE_DOWNLOADING 

The download has started.

EWK_DOWNLOAD_JOB_STATE_FAILED 

The download stopped because of a failure.

EWK_DOWNLOAD_JOB_STATE_CANCELLING 

The download is being cancelled.

EWK_DOWNLOAD_JOB_STATE_CANCELLED 

The download stopped because it was cancelled.

EWK_DOWNLOAD_JOB_STATE_FINISHED 

The download completed successfully.

Function Documentation

EAPI Eina_Bool ewk_download_job_cancel ( Ewk_Download_Job download)

Cancels the download asynchronously.

When the ongoing download operation is effectively cancelled, a "Ewk_Download_Cancelled_Cb" will be called in DownloadManager.

Parameters
downloada Ewk_Download_Job to cancel.
Returns
EINA_TRUE if the cancellation request was taken into account, or EINA_FALSE otherwise.
EAPI const char* ewk_download_job_destination_get ( const Ewk_Download_Job download)

Query the URL to which the downloaded file will be written.

Parameters
downloada Ewk_Download_Job to query.
Returns
the destination pointer, that may be NULL. This pointer is guaranteed to be eina_stringshare, so whenever possible save yourself some cpu cycles and use eina_stringshare_ref() instead of eina_stringshare_add() or strdup().
EAPI Eina_Bool ewk_download_job_destination_set ( Ewk_Download_Job download,
const char *  destination 
)

Sets the destination path for this download.

Sets the path to which the downloaded file will be written.

This method needs to be called before the download transfer starts, by connecting to the "download,new" signal on the Ewk_View and setting the destination in the callback. To set the destination using the filename suggested by the server use ewk_download_job_suggested_filename_get().

Parameters
downloadEwk_Download_Job to update.
destinationthe destination path.
Returns
EINA_TRUE if successful, EINA_FALSE otherwise.
See also
ewk_download_job_suggested_filename_get
EAPI double ewk_download_job_elapsed_time_get ( const Ewk_Download_Job download)

Gets the elapsed time in seconds, including any fractional part.

If the download finished, had an error or was cancelled this is the time between its start and the event.

Parameters
downloada Ewk_Download_Job
Returns
seconds since the download was started or 0.0 in case of failure.
EAPI double ewk_download_job_estimated_progress_get ( const Ewk_Download_Job download)

Query the estimated progress for this download.

Parameters
downloada Ewk_Download_Job to query.
Returns
an estimate of the of the percent complete for a download as a range from 0.0 to 1.0.
EAPI uint64_t ewk_download_job_received_data_size_get ( const Ewk_Download_Job download)

Gets the data size, already downloaded.

If the download finished, had an error or was cancelled this is the data size between its start and the end.

Parameters
downloada Ewk_Download_Job to query.
Returns
the size of the data already downloaded, since the download was started or 0.0 in case of failure.
EAPI Ewk_Url_Request* ewk_download_job_request_get ( const Ewk_Download_Job download)

Query the URL request for this download.

Parameters
downloada Ewk_Download_Job to query.
Returns
the Ewk_Url_Request for this download.
EAPI Ewk_Url_Response* ewk_download_job_response_get ( const Ewk_Download_Job download)

Query the URL response for this download.

Parameters
downloada Ewk_Download_Job to query.
Returns
the Ewk_Url_Response for this download or NULL if it was not received yet.
EAPI Ewk_Download_Job_State ewk_download_job_state_get ( const Ewk_Download_Job download)

Query the state for this download.

Parameters
downloada Ewk_Download_Job to query.
Returns
the download state.
EAPI const char* ewk_download_job_suggested_filename_get ( const Ewk_Download_Job download)

Queries the suggested file name for this download.

It can be useful to use the value returned by this function to construct the destination path to pass to ewk_download_job_destination_set().

Parameters
downloadEwk_Download_Job to query.
Returns
The suggested file name for this download. This pointer is guaranteed to be eina_stringshare, so whenever possible save yourself some cpu cycles and use eina_stringshare_ref() instead of eina_stringshare_add() or strdup().
See also
ewk_download_job_destination_set