From 236b6a15e1c458d51ec6f31a6a49b3579e91d2d3 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 7 Apr 2010 09:12:09 +0000 Subject: Add mime-type getter. svn path=/trunk/netsurf/; revision=10259 --- content/content.c | 19 +++++++++++++++++++ content/content.h | 1 + content/content_protected.h | 1 + 3 files changed, 21 insertions(+) diff --git a/content/content.c b/content/content.c index a44eb2847..9e01171ea 100644 --- a/content/content.c +++ b/content/content.c @@ -1060,6 +1060,25 @@ content_type content__get_type(struct content *c) return c->type; } +/** + * Retrieve mime-type of content + * + * \param c Content to retrieve mime-type of + * \return Pointer to mime-type, or NULL if not found. + */ +const char *content_get_mime_type(hlcache_handle *h) +{ + return content__get_mime_type(hlcache_handle_get_content(h)); +} + +const char *content__get_mime_type(struct content *c) +{ + if (c == NULL) + return NULL; + + return c->mime_type; +} + /** * Retrieve URL associated with content * diff --git a/content/content.h b/content/content.h index b9af6c267..a76783bdf 100644 --- a/content/content.h +++ b/content/content.h @@ -131,6 +131,7 @@ void content_close(struct hlcache_handle *h); /* Member accessors */ content_type content_get_type(struct hlcache_handle *c); +const char *content_get_mime_type(struct hlcache_handle *c); const char *content_get_url(struct hlcache_handle *c); const char *content_get_title(struct hlcache_handle *c); content_status content_get_status(struct hlcache_handle *c); diff --git a/content/content_protected.h b/content/content_protected.h index 013a9645f..16760180b 100644 --- a/content/content_protected.h +++ b/content/content_protected.h @@ -207,6 +207,7 @@ void content__reformat(struct content *c, int width, int height); bool content__set_title(struct content *c, const char *title); content_type content__get_type(struct content *c); +const char *content__get_mime_type(struct content *c); const char *content__get_url(struct content *c); const char *content__get_title(struct content *c); content_status content__get_status(struct content *c); -- cgit v1.2.3