NetSurf
|
Core download context (interface) More...
#include "utils/errors.h"
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 nsurl * | download_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... | |
Core download context (interface)
Definition in file download.h.
typedef struct download_context download_context |
Type of a download context.
Definition at line 34 of file download.h.
void download_context_abort | ( | download_context * | ctx | ) |
Abort a download fetch.
ctx | Context 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().
nserror download_context_create | ( | struct llcache_handle * | llcache, |
struct gui_window * | parent | ||
) |
Create a download context.
llcache | Low-level cache handle for download |
parent | Parent window, for UI |
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().
void download_context_destroy | ( | download_context * | ctx | ) |
Destroy a download context.
ctx | Context 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().
const char * download_context_get_filename | ( | const download_context * | ctx | ) |
Retrieve the filename for a download.
ctx | Context to retrieve filename from |
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().
const char * download_context_get_mime_type | ( | const download_context * | ctx | ) |
Retrieve the MIME type for a download.
ctx | Context to retrieve MIME type from |
Definition at line 297 of file download.c.
References gui_download_window::ctx, and download_context::mime_type.
Referenced by download_ro_filetype().
unsigned long long int download_context_get_total_length | ( | const download_context * | ctx | ) |
Retrieve total byte length of download.
ctx | Context to retrieve byte length from |
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().
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.
ctx | Context to retrieve URL from |
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().