NetSurf
Typedefs | Functions
download.h File Reference

Core download context (interface) More...

#include "utils/errors.h"
Include dependency graph for download.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct download_context download_context
 Type of a download context. More...
 

Functions

nserror download_context_create (struct llcache_handle *llcache, struct gui_window *parent)
 Create a download context. More...
 
void download_context_destroy (download_context *ctx)
 Destroy a download context. More...
 
void download_context_abort (download_context *ctx)
 Abort a download fetch. More...
 
struct nsurldownload_context_get_url (const download_context *ctx)
 Retrieve the URL for a download. More...
 
const char * download_context_get_mime_type (const download_context *ctx)
 Retrieve the MIME type for a download. More...
 
unsigned long long int download_context_get_total_length (const download_context *ctx)
 Retrieve total byte length of download. More...
 
const char * download_context_get_filename (const download_context *ctx)
 Retrieve the filename for a download. More...
 

Detailed Description

Core download context (interface)

Definition in file download.h.

Typedef Documentation

◆ download_context

Type of a download context.

Definition at line 34 of file download.h.

Function Documentation

◆ download_context_abort()

void download_context_abort ( download_context ctx)

Abort a download fetch.

Parameters
ctxContext to abort

Called by the frontend to abort a download. The context must be destroyed independently.

Definition at line 285 of file download.c.

References gui_download_window::ctx, download_context::llcache, and llcache_handle_abort().

Referenced by ami_download_window_abort(), gui_download_window_data(), gui_download_window_destroy(), nsgtk_download_store_cancel_item(), ro_gui_download_save(), ro_gui_download_window_destroy(), and NSDownloadWindow::~NSDownloadWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ download_context_create()

nserror download_context_create ( struct llcache_handle llcache,
struct gui_window parent 
)

Create a download context.

Parameters
llcacheLow-level cache handle for download
parentParent window, for UI
Returns
NSERROR_OK on success, appropriate error otherwise

This must only be called by the core browser window fetch infrastructure. Ownership of the download context object created is passed to the frontend.

Definition at line 248 of file download.c.

References gui_download_window::ctx, download_callback(), download_context::filename, llcache, download_context::llcache, llcache_handle_change_callback(), download_context::mime_type, NSERROR_NOMEM, NSERROR_OK, download_context::parent, parent, download_context::total_length, and download_context::window.

Referenced by browser_window_convert_to_download(), and browser_window_download().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ download_context_destroy()

void download_context_destroy ( download_context ctx)

Destroy a download context.

Parameters
ctxContext to destroy

Called by the frontend when it has finished with a download context

Definition at line 270 of file download.c.

References gui_download_window::ctx, download_context::filename, download_context::llcache, llcache_handle_release(), and download_context::mime_type.

Referenced by download_callback(), gui_download_window_destroy(), gui_download_window_done(), gui_download_window_error(), nsgtk_download_store_clear_item(), ro_gui_download_window_destroy(), and NSDownloadWindow::~NSDownloadWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ download_context_get_filename()

const char * download_context_get_filename ( const download_context ctx)

Retrieve the filename for a download.

Parameters
ctxContext to retrieve filename from
Returns
Filename string

Definition at line 310 of file download.c.

References gui_download_window::ctx, and download_context::filename.

Referenced by gui_download_window_create(), NSDownloadWindow::NSDownloadWindow(), and nsgtk_download_store_cancel_item().

Here is the caller graph for this function:

◆ download_context_get_mime_type()

const char * download_context_get_mime_type ( const download_context ctx)

Retrieve the MIME type for a download.

Parameters
ctxContext to retrieve MIME type from
Returns
MIME type string

Definition at line 297 of file download.c.

References gui_download_window::ctx, and download_context::mime_type.

Referenced by download_ro_filetype().

Here is the caller graph for this function:

◆ download_context_get_total_length()

unsigned long long int download_context_get_total_length ( const download_context ctx)

Retrieve total byte length of download.

Parameters
ctxContext to retrieve byte length from
Returns
Total length, in bytes, or 0 if unknown

Definition at line 304 of file download.c.

References gui_download_window::ctx, and download_context::total_length.

Referenced by gui_download_window_create(), and NSDownloadWindow::NSDownloadWindow().

Here is the caller graph for this function:

◆ download_context_get_url()

struct nsurl * download_context_get_url ( const download_context ctx)

Retrieve the URL for a download.

The caller is borrowing the url reference from the underlying low level cache object. If it is used beyond the immediate scope of the caller an additional reference should be made.

Parameters
ctxContext to retrieve URL from
Returns
URL object

Definition at line 291 of file download.c.

References gui_download_window::ctx, download_context::llcache, and llcache_handle_get_url().

Referenced by download_ro_filetype(), and gui_download_window_create().

Here is the call graph for this function:
Here is the caller graph for this function: