From 3405803280c9cafab0a4ef229faa4bc447e4c953 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 7 Nov 2014 12:33:34 +0000 Subject: Improve content encoding information API Extend the content_get_encoding() API to retrieve the source of the encoding as well as the actual encoding. --- content/content.c | 8 ++++---- content/content.h | 8 +++++++- content/content_protected.h | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'content') diff --git a/content/content.c b/content/content.c index 83fdacf78..cd493ba44 100644 --- a/content/content.c +++ b/content/content.c @@ -1323,19 +1323,19 @@ bool content_get_quirks(hlcache_handle *h) * \param c Content to retrieve bitmap from * \return Pointer to bitmap, or NULL if none. */ -const char *content_get_encoding(hlcache_handle *h) +const char *content_get_encoding(hlcache_handle *h, enum content_encoding_type op) { - return content__get_encoding(hlcache_handle_get_content(h)); + return content__get_encoding(hlcache_handle_get_content(h), op); } -const char *content__get_encoding(struct content *c) +const char *content__get_encoding(struct content *c, enum content_encoding_type op) { const char *encoding = NULL; if ((c != NULL) && (c->handler != NULL) && (c->handler->get_encoding != NULL) ) { - encoding = c->handler->get_encoding(c); + encoding = c->handler->get_encoding(c, op); } return encoding; diff --git a/content/content.h b/content/content.h index bc47ffef0..9c9d64975 100644 --- a/content/content.h +++ b/content/content.h @@ -94,6 +94,12 @@ enum content_debug { CONTENT_DEBUG_REDRAW /** Debug redraw operations. */ }; +/** Content encoding informstion types */ +enum content_encoding_type { + CONTENT_ENCODING_NORMAL, /** The content encoding */ + CONTENT_ENCODING_SOURCE /** The content encoding source */ +}; + /** RFC5988 metadata link */ struct content_rfc5988_link { struct content_rfc5988_link *next; /**< next rfc5988_link in list */ @@ -328,7 +334,7 @@ nsurl *content_get_refresh_url(struct hlcache_handle *c); struct bitmap *content_get_bitmap(struct hlcache_handle *c); bool content_get_opaque(struct hlcache_handle *h); bool content_get_quirks(struct hlcache_handle *h); -const char *content_get_encoding(struct hlcache_handle *h); +const char *content_get_encoding(struct hlcache_handle *h, enum content_encoding_type op); bool content_is_locked(struct hlcache_handle *h); diff --git a/content/content_protected.h b/content/content_protected.h index af274ef5a..2647b2e0f 100644 --- a/content/content_protected.h +++ b/content/content_protected.h @@ -80,7 +80,7 @@ struct content_handler { nserror (*debug)(struct content *c, enum content_debug op); nserror (*clone)(const struct content *old, struct content **newc); bool (*matches_quirks)(const struct content *c, bool quirks); - const char *(*get_encoding)(const struct content *c); + const char *(*get_encoding)(const struct content *c, enum content_encoding_type op); content_type (*type)(void); /** handler dependant content sensitive internal data interface. */ @@ -198,7 +198,7 @@ void content__invalidate_reuse_data(struct content *c); nsurl *content__get_refresh_url(struct content *c); struct bitmap *content__get_bitmap(struct content *c); bool content__get_opaque(struct content *c); -const char *content__get_encoding(struct content *c); +const char *content__get_encoding(struct content *c, enum content_encoding_type op); bool content__is_locked(struct content *c); #endif -- cgit v1.2.3