summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-rw-r--r--desktop/gui_factory.c16
-rw-r--r--desktop/gui_fetch.h31
2 files changed, 45 insertions, 2 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;
}
diff --git a/desktop/gui_fetch.h b/desktop/gui_fetch.h
index 46d31e0f4..20db39d20 100644
--- a/desktop/gui_fetch.h
+++ b/desktop/gui_fetch.h
@@ -47,9 +47,9 @@ struct gui_fetch_table {
/* Optional entries */
/**
- * Callback to translate resource to full url.
+ * Translate resource to full url.
*
- * @note used in resource fetcher
+ * @note Only used in resource fetcher
*
* Transforms a resource: path into a full URL. The returned URL
* is used as the target for a redirect. The caller takes ownership of
@@ -62,6 +62,33 @@ struct gui_fetch_table {
struct nsurl* (*get_resource_url)(const char *path);
/**
+ * Translate resource to source data.
+ *
+ * @note Only used in resource fetcher
+ *
+ * Obtains the data for a resource directly
+ *
+ * \param path The path of the resource to locate.
+ * \param data Pointer to recive data into
+ * \param data_len Pointer to length of returned data
+ * \return NSERROR_OK and the data and length values updated
+ * else appropriate error code.
+ */
+ nserror (*get_resource_data)(const char *path, const uint8_t **data, size_t *data_len);
+
+ /**
+ * Releases source data.
+ *
+ * @note Only used in resource fetcher
+ *
+ * Releases source data obtained from get_resource_data()
+ *
+ * \param data The value returned from a previous get_resource_data call
+ * \return NSERROR_OK on success else appropriate error code.
+ */
+ nserror (*release_resource_data)(const uint8_t *data);
+
+ /**
* Find a MIME type for a local file
*
* @note only used in curl fetcher on RISC OS otherwise its a