summaryrefslogtreecommitdiff
path: root/desktop/gui_factory.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-06-17 09:26:05 +0100
committerVincent Sanders <vince@kyllikki.org>2015-06-17 21:35:40 +0100
commite9b89f776db705ee4403a2235ec21aabab12c8f6 (patch)
tree2f08135e8025fe243bd6248d63fb7061aa0ffe4d /desktop/gui_factory.c
parentbe7a45fefed2736f7ed7f1799e9f2b1cd52235b7 (diff)
downloadnetsurf-e9b89f776db705ee4403a2235ec21aabab12c8f6.tar.gz
netsurf-e9b89f776db705ee4403a2235ec21aabab12c8f6.tar.bz2
Allow the resource scheme to provide data directly.
This allows front ends to provide resources from compiled in data instead of requiring the resources to be available on disc and forcing a redirect.
Diffstat (limited to 'desktop/gui_factory.c')
-rw-r--r--desktop/gui_factory.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index 50244e334..22364ab97 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -501,6 +501,16 @@ static nsurl *gui_default_get_resource_url(const char *path)
return NULL;
}
+static nserror gui_default_get_resource_data(const char *path, const uint8_t **data, size_t *data_len)
+{
+ return NSERROR_NOT_FOUND;
+}
+
+static nserror gui_default_release_resource_data(const uint8_t *data)
+{
+ return NSERROR_OK;
+}
+
static char *gui_default_mimetype(const char *path)
{
return strdup(guit->fetch->filetype(path));
@@ -523,6 +533,12 @@ static nserror verify_fetch_register(struct gui_fetch_table *gft)
if (gft->get_resource_url == NULL) {
gft->get_resource_url = gui_default_get_resource_url;
}
+ if (gft->get_resource_data == NULL) {
+ gft->get_resource_data = gui_default_get_resource_data;
+ }
+ if (gft->release_resource_data == NULL) {
+ gft->release_resource_data = gui_default_release_resource_data;
+ }
if (gft->mimetype == NULL) {
gft->mimetype = gui_default_mimetype;
}