improve content header usage

This commit is contained in:
Vincent Sanders 2020-05-07 20:55:44 +01:00
parent 5f8b1497e1
commit ab952e0634
32 changed files with 281 additions and 173 deletions

View File

@ -24,14 +24,13 @@
* The content functions manipulate struct contents, which correspond to URLs. * The content functions manipulate struct contents, which correspond to URLs.
*/ */
#ifndef _NETSURF_CONTENT_CONTENT_H_ #ifndef NETSURF_CONTENT_CONTENT_H_
#define _NETSURF_CONTENT_CONTENT_H_ #define NETSURF_CONTENT_CONTENT_H_
#include <libwapcaplet/libwapcaplet.h> #include <libwapcaplet/libwapcaplet.h>
#include "utils/errors.h"
#include "content/content_factory.h"
#include "desktop/search.h" /* search flags enum */ #include "desktop/search.h" /* search flags enum */
#include "netsurf/content_type.h"
#include "netsurf/mouse.h" /* mouse state enums */ #include "netsurf/mouse.h" /* mouse state enums */
#include "netsurf/console.h" /* console state and flags enums */ #include "netsurf/console.h" /* console state and flags enums */
@ -43,48 +42,8 @@ struct hlcache_handle;
struct object_params; struct object_params;
struct rect; struct rect;
struct redraw_context; struct redraw_context;
struct llcache_query_msg;
struct cert_chain; struct cert_chain;
/** Status of a content */
typedef enum {
CONTENT_STATUS_LOADING, /**< Content is being fetched or
converted and is not safe to display. */
CONTENT_STATUS_READY, /**< Some parts of content still being
loaded, but can be displayed. */
CONTENT_STATUS_DONE, /**< All finished. */
CONTENT_STATUS_ERROR /**< Error occurred, content will be
destroyed imminently. */
} content_status;
/** Used in callbacks to indicate what has occurred. */
typedef enum {
CONTENT_MSG_LOG, /**< Content wishes to log something */
CONTENT_MSG_SSL_CERTS, /**< Content is from SSL and this is its chain */
CONTENT_MSG_LOADING, /**< fetching or converting */
CONTENT_MSG_READY, /**< may be displayed */
CONTENT_MSG_DONE, /**< finished */
CONTENT_MSG_ERROR, /**< error occurred */
CONTENT_MSG_REDIRECT, /**< fetch url redirect occured */
CONTENT_MSG_STATUS, /**< new status string */
CONTENT_MSG_REFORMAT, /**< content_reformat done */
CONTENT_MSG_REDRAW, /**< needs redraw (eg. new animation frame) */
CONTENT_MSG_REFRESH, /**< wants refresh */
CONTENT_MSG_DOWNLOAD, /**< download, not for display */
CONTENT_MSG_LINK, /**< RFC5988 link */
CONTENT_MSG_GETTHREAD, /**< Javascript thread */
CONTENT_MSG_GETDIMS, /**< Get viewport dimensions. */
CONTENT_MSG_SCROLL, /**< Request to scroll content */
CONTENT_MSG_DRAGSAVE, /**< Allow drag saving of content */
CONTENT_MSG_SAVELINK, /**< Allow URL to be saved */
CONTENT_MSG_POINTER, /**< Wants a specific mouse pointer set */
CONTENT_MSG_SELECTION, /**< A selection made or cleared */
CONTENT_MSG_CARET, /**< Caret movement / hiding */
CONTENT_MSG_DRAG, /**< A drag started or ended */
CONTENT_MSG_SELECTMENU,/**< Create a select menu */
CONTENT_MSG_GADGETCLICK/**< A gadget has been clicked on (mainly for file) */
} content_msg;
/** RFC5988 metadata link */ /** RFC5988 metadata link */
struct content_rfc5988_link { struct content_rfc5988_link {
@ -286,114 +245,6 @@ union content_msg_data {
}; };
/* The following are for hlcache */
/**
* Destroy and free a content.
*
* Calls the destroy function for the content, and frees the structure.
*/
void content_destroy(struct content *c);
/**
* Register a user for callbacks.
*
* \param c the content to register
* \param callback the user callback function
* \param pw callback private data
* \return true on success, false otherwise on memory exhaustion
*
* The callback will be called when content_broadcast() is
* called with the content.
*/
bool content_add_user(struct content *h,
void (*callback)(
struct content *c,
content_msg msg,
const union content_msg_data *data,
void *pw),
void *pw);
/**
* Remove a callback user.
*
* The callback function and pw must be identical to those passed to
* content_add_user().
*
* \param c Content to remove user from
* \param callback passed when added
* \param ctx Context passed when added
*/
void content_remove_user(struct content *c,
void (*callback)(
struct content *c,
content_msg msg,
const union content_msg_data *data,
void *pw),
void *ctx);
/**
* Count users for the content.
*
* \param c Content to consider
*/
uint32_t content_count_users(struct content *c);
/**
* Determine if quirks mode matches
*
* \param c Content to consider
* \param quirks Quirks mode to match
* \return True if quirks match, false otherwise
*/
bool content_matches_quirks(struct content *c, bool quirks);
/**
* Determine if a content is shareable
*
* \param c Content to consider
* \return True if content is shareable, false otherwise
*/
bool content_is_shareable(struct content *c);
/**
* Retrieve the low-level cache handle for a content
*
* \note only used by hlcache
*
* \param c Content to retrieve from
* \return Low-level cache handle
*/
const struct llcache_handle *content_get_llcache_handle(struct content *c);
/**
* Retrieve URL associated with content
*
* \param c Content to retrieve URL from
* \return Pointer to URL, or NULL if not found.
*/
struct nsurl *content_get_url(struct content *c);
/**
* Clone a content object in its current state.
*
* \param c Content to clone
* \return Clone of \a c
*/
struct content *content_clone(struct content *c);
/**
* Abort a content object
*
* \param c The content object to abort
* \return NSERROR_OK on success, otherwise appropriate error
*/
nserror content_abort(struct content *c);
/* Client functions */
/** /**
* Get whether a content can reformat * Get whether a content can reformat
* *

View File

@ -46,13 +46,12 @@ nserror HNAME##_init(void) \
struct content; struct content;
struct llcache_handle; struct llcache_handle;
struct content_handler;
typedef struct content_handler content_handler;
void content_factory_fini(void); void content_factory_fini(void);
nserror content_factory_register_handler(const char *mime_type, nserror content_factory_register_handler(const char *mime_type,
const content_handler *handler); const struct content_handler *handler);
struct content *content_factory_create_content(struct llcache_handle *llcache, struct content *content_factory_create_content(struct llcache_handle *llcache,
const char *fallback_charset, bool quirks, const char *fallback_charset, bool quirks,

View File

@ -28,15 +28,24 @@
#define NETSURF_CONTENT_CONTENT_PROTECTED_H_ #define NETSURF_CONTENT_CONTENT_PROTECTED_H_
#include <stdio.h> #include <stdio.h>
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/content_type.h" #include "netsurf/content_type.h"
#include "content/content.h" #include "desktop/search.h" /* search flags enum */
#include "netsurf/mouse.h" /* mouse state enums */
struct nsurl; struct nsurl;
struct content_redraw_data; struct content_redraw_data;
union content_msg_data;
struct http_parameter; struct http_parameter;
struct llcache_handle; struct llcache_handle;
struct object_params; struct object_params;
struct content;
struct redraw_context;
struct rect;
struct browser_window_features;
typedef struct content_handler content_handler;
/** /**
* Content operation function table * Content operation function table
@ -457,4 +466,108 @@ const char *content__get_encoding(struct content *c, enum content_encoding_type
*/ */
bool content__is_locked(struct content *c); bool content__is_locked(struct content *c);
/**
* Destroy and free a content.
*
* Calls the destroy function for the content, and frees the structure.
*/
void content_destroy(struct content *c);
/**
* Register a user for callbacks.
*
* \param c the content to register
* \param callback the user callback function
* \param pw callback private data
* \return true on success, false otherwise on memory exhaustion
*
* The callback will be called when content_broadcast() is
* called with the content.
*/
bool content_add_user(struct content *h,
void (*callback)(
struct content *c,
content_msg msg,
const union content_msg_data *data,
void *pw),
void *pw);
/**
* Remove a callback user.
*
* The callback function and pw must be identical to those passed to
* content_add_user().
*
* \param c Content to remove user from
* \param callback passed when added
* \param ctx Context passed when added
*/
void content_remove_user(struct content *c,
void (*callback)(
struct content *c,
content_msg msg,
const union content_msg_data *data,
void *pw),
void *ctx);
/**
* Count users for the content.
*
* \param c Content to consider
*/
uint32_t content_count_users(struct content *c);
/**
* Determine if quirks mode matches
*
* \param c Content to consider
* \param quirks Quirks mode to match
* \return True if quirks match, false otherwise
*/
bool content_matches_quirks(struct content *c, bool quirks);
/**
* Determine if a content is shareable
*
* \param c Content to consider
* \return True if content is shareable, false otherwise
*/
bool content_is_shareable(struct content *c);
/**
* Retrieve the low-level cache handle for a content
*
* \note only used by hlcache
*
* \param c Content to retrieve from
* \return Low-level cache handle
*/
const struct llcache_handle *content_get_llcache_handle(struct content *c);
/**
* Retrieve URL associated with content
*
* \param c Content to retrieve URL from
* \return Pointer to URL, or NULL if not found.
*/
struct nsurl *content_get_url(struct content *c);
/**
* Clone a content object in its current state.
*
* \param c Content to clone
* \return Clone of \a c
*/
struct content *content_clone(struct content *c);
/**
* Abort a content object
*
* \param c The content object to abort
* \return NSERROR_OK on success, otherwise appropriate error
*/
nserror content_abort(struct content *c);
#endif #endif

View File

@ -20,15 +20,17 @@
#include <libwapcaplet/libwapcaplet.h> #include <libwapcaplet/libwapcaplet.h>
#include <dom/dom.h> #include <dom/dom.h>
#include "content/content_protected.h" #include "utils/errors.h"
#include "content/fetch.h"
#include "content/hlcache.h"
#include "desktop/system_colour.h"
#include "utils/corestrings.h" #include "utils/corestrings.h"
#include "utils/utils.h" #include "utils/utils.h"
#include "utils/http.h" #include "utils/http.h"
#include "utils/log.h" #include "utils/log.h"
#include "utils/messages.h" #include "utils/messages.h"
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/fetch.h"
#include "content/hlcache.h"
#include "desktop/system_colour.h"
#include "css/css.h" #include "css/css.h"
#include "css/hints.h" #include "css/hints.h"

View File

@ -40,6 +40,7 @@
#include "netsurf/plot_style.h" #include "netsurf/plot_style.h"
#include "css/hints.h" #include "css/hints.h"
#include "desktop/frame_types.h" #include "desktop/frame_types.h"
#include "content/content_factory.h"
#include "html/html.h" #include "html/html.h"
#include "html/private.h" #include "html/private.h"

View File

@ -22,12 +22,14 @@
* Implementation of HTML content DOM event handling. * Implementation of HTML content DOM event handling.
*/ */
#include "utils/config.h"
#include "utils/corestrings.h" #include "utils/corestrings.h"
#include "utils/nsoption.h" #include "utils/nsoption.h"
#include "utils/log.h" #include "utils/log.h"
#include "utils/ascii.h" #include "utils/ascii.h"
#include "utils/string.h" #include "utils/string.h"
#include "utils/nsurl.h" #include "utils/nsurl.h"
#include "content/content.h"
#include "javascript/js.h" #include "javascript/js.h"
#include "html/private.h" #include "html/private.h"

View File

@ -48,6 +48,7 @@
#include "netsurf/layout.h" #include "netsurf/layout.h"
#include "netsurf/misc.h" #include "netsurf/misc.h"
#include "content/hlcache.h" #include "content/hlcache.h"
#include "content/content_factory.h"
#include "desktop/selection.h" #include "desktop/selection.h"
#include "desktop/scrollbar.h" #include "desktop/scrollbar.h"
#include "desktop/textarea.h" #include "desktop/textarea.h"

View File

@ -52,6 +52,7 @@
#include "netsurf/content.h" #include "netsurf/content.h"
#include "netsurf/browser_window.h" #include "netsurf/browser_window.h"
#include "netsurf/layout.h" #include "netsurf/layout.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "css/utils.h" #include "css/utils.h"
#include "desktop/scrollbar.h" #include "desktop/scrollbar.h"

View File

@ -45,6 +45,7 @@
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/bitmap.h" #include "netsurf/bitmap.h"
#include "netsurf/layout.h" #include "netsurf/layout.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "css/utils.h" #include "css/utils.h"
#include "desktop/selection.h" #include "desktop/selection.h"

View File

@ -36,6 +36,7 @@
#include "netsurf/content.h" #include "netsurf/content.h"
#include "javascript/js.h" #include "javascript/js.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/fetch.h" #include "content/fetch.h"
#include "content/hlcache.h" #include "content/hlcache.h"

View File

@ -33,6 +33,7 @@
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h" #include "desktop/gui_internal.h"
#include "image/bmp.h" #include "image/bmp.h"
@ -87,10 +88,14 @@ static nserror nsbmp_create_bmp_data(nsbmp_content *bmp)
return NSERROR_OK; return NSERROR_OK;
} }
static nserror nsbmp_create(const content_handler *handler, static nserror
lwc_string *imime_type, const struct http_parameter *params, nsbmp_create(const struct content_handler *handler,
llcache_handle *llcache, const char *fallback_charset, lwc_string *imime_type,
bool quirks, struct content **c) const struct http_parameter *params,
llcache_handle *llcache,
const char *fallback_charset,
bool quirks,
struct content **c)
{ {
nsbmp_content *bmp; nsbmp_content *bmp;
nserror error; nserror error;

View File

@ -43,7 +43,9 @@
#include "netsurf/bitmap.h" #include "netsurf/bitmap.h"
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h" #include "desktop/gui_internal.h"
#include "image/image.h" #include "image/image.h"

View File

@ -32,6 +32,7 @@
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h" #include "desktop/gui_internal.h"
#include "image/image.h" #include "image/image.h"

View File

@ -33,7 +33,9 @@
#include "utils/messages.h" #include "utils/messages.h"
#include "netsurf/bitmap.h" #include "netsurf/bitmap.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h" #include "desktop/gui_internal.h"
#include "image/image_cache.h" #include "image/image_cache.h"

View File

@ -29,6 +29,7 @@
#include "netsurf/bitmap.h" #include "netsurf/bitmap.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h" #include "desktop/gui_internal.h"
#include "image/image_cache.h" #include "image/image_cache.h"

View File

@ -49,6 +49,7 @@
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h" #include "desktop/gui_internal.h"
#include "image/rsvg.h" #include "image/rsvg.h"

View File

@ -34,6 +34,7 @@
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "image/svg.h" #include "image/svg.h"

View File

@ -26,8 +26,10 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include "utils/errors.h"
#include "utils/config.h" #include "utils/config.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/hlcache.h" #include "content/hlcache.h"
#include "utils/log.h" #include "utils/log.h"
#include "utils/messages.h" #include "utils/messages.h"

View File

@ -45,6 +45,7 @@
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/layout.h" #include "netsurf/layout.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/hlcache.h" #include "content/hlcache.h"
#include "css/utils.h" #include "css/utils.h"
#include "utils/nsoption.h" #include "utils/nsoption.h"

View File

@ -38,6 +38,7 @@
#include "content/hlcache.h" #include "content/hlcache.h"
// Note, this is *ONLY* so that we can abort cleanly during shutdown of the cache // Note, this is *ONLY* so that we can abort cleanly during shutdown of the cache
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
typedef struct hlcache_entry hlcache_entry; typedef struct hlcache_entry hlcache_entry;
typedef struct hlcache_retrieval_ctx hlcache_retrieval_ctx; typedef struct hlcache_retrieval_ctx hlcache_retrieval_ctx;

View File

@ -23,6 +23,7 @@
* Free text search (core) * Free text search (core)
*/ */
#include "utils/errors.h"
#include "content/content.h" #include "content/content.h"
#include "netsurf/types.h" #include "netsurf/types.h"
#include "netsurf/browser_window.h" #include "netsurf/browser_window.h"

View File

@ -33,14 +33,13 @@
#include "utils/talloc.h" #include "utils/talloc.h"
#include "utils/utf8.h" #include "utils/utf8.h"
#include "utils/utils.h" #include "utils/utils.h"
#include "netsurf/types.h"
#include "netsurf/mouse.h" #include "netsurf/mouse.h"
#include "netsurf/form.h" #include "netsurf/form.h"
#include "netsurf/window.h" #include "netsurf/window.h"
#include "netsurf/browser_window.h" #include "netsurf/browser_window.h"
#include "netsurf/keypress.h" #include "netsurf/keypress.h"
#include "html/box.h" #include "content/content.h"
#include "html/private.h"
#include "html/layout.h"
#include "desktop/browser_private.h" #include "desktop/browser_private.h"
#include "desktop/textinput.h" #include "desktop/textinput.h"

View File

@ -40,7 +40,9 @@
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/bitmap.h" #include "netsurf/bitmap.h"
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "amiga/bitmap.h" #include "amiga/bitmap.h"

View File

@ -36,7 +36,9 @@
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/bitmap.h" #include "netsurf/bitmap.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/handlers/image/image_cache.h" #include "content/handlers/image/image_cache.h"
#include "amiga/bitmap.h" #include "amiga/bitmap.h"

View File

@ -36,6 +36,7 @@
#include "html/box.h" #include "html/box.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "amiga/filetype.h" #include "amiga/filetype.h"
#include "amiga/datatypes.h" #include "amiga/datatypes.h"

View File

@ -29,6 +29,7 @@
#include "utils/nsurl.h" #include "utils/nsurl.h"
#include "netsurf/browser_window.h" #include "netsurf/browser_window.h"
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/content_factory.h"
#include "desktop/save_complete.h" #include "desktop/save_complete.h"
#include "desktop/save_pdf.h" #include "desktop/save_pdf.h"
#include "desktop/save_text.h" #include "desktop/save_text.h"

View File

@ -45,7 +45,9 @@
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/bitmap.h" #include "netsurf/bitmap.h"
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "amiga/os3support.h" #include "amiga/os3support.h"
#include "amiga/bitmap.h" #include "amiga/bitmap.h"

View File

@ -35,6 +35,7 @@
#include "amiga/filetype.h" #include "amiga/filetype.h"
#include "amiga/plugin_hack.h" #include "amiga/plugin_hack.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/llcache.h" #include "content/llcache.h"

View File

@ -38,7 +38,9 @@
#include "utils/utils.h" #include "utils/utils.h"
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "riscos/content-handlers/artworks.h" #include "riscos/content-handlers/artworks.h"

View File

@ -35,7 +35,9 @@
#include "utils/utils.h" #include "utils/utils.h"
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "riscos/content-handlers/draw.h" #include "riscos/content-handlers/draw.h"

View File

@ -36,7 +36,9 @@
#include "netsurf/plotters.h" #include "netsurf/plotters.h"
#include "netsurf/content.h" #include "netsurf/content.h"
#include "content/llcache.h" #include "content/llcache.h"
#include "content/content.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "content/content_factory.h"
#include "riscos/gui.h" #include "riscos/gui.h"
#include "riscos/image.h" #include "riscos/image.h"

View File

@ -18,7 +18,7 @@
/** /**
* \file * \file
* Declaration of content type enumerations. * Declaration of content enumerations.
* *
* The content enumerations are defined here. * The content enumerations are defined here.
*/ */
@ -28,17 +28,27 @@
/** Debugging dump operations */ /** Debugging dump operations */
enum content_debug { enum content_debug {
CONTENT_DEBUG_RENDER, /** Debug the contents rendering. */ /** Debug the contents rendering. */
CONTENT_DEBUG_DOM, /** Debug the contents Document Object. */ CONTENT_DEBUG_RENDER,
CONTENT_DEBUG_REDRAW /** Debug redraw operations. */
/** Debug the contents Document Object. */
CONTENT_DEBUG_DOM,
/** Debug redraw operations. */
CONTENT_DEBUG_REDRAW
}; };
/** Content encoding information types */ /** Content encoding information types */
enum content_encoding_type { enum content_encoding_type {
CONTENT_ENCODING_NORMAL, /** The content encoding */ /** The content encoding */
CONTENT_ENCODING_SOURCE /** The content encoding source */ CONTENT_ENCODING_NORMAL,
/** The content encoding source */
CONTENT_ENCODING_SOURCE
}; };
/** The type of a content. */ /** The type of a content. */
typedef enum { typedef enum {
/** no type for content */ /** no type for content */
@ -73,4 +83,98 @@ typedef enum {
} content_type; } content_type;
/** Status of a content */
typedef enum {
/** Content is being fetched or converted and is not safe to display. */
CONTENT_STATUS_LOADING,
/** Some parts of content still being loaded, but can be displayed. */
CONTENT_STATUS_READY,
/** Content has completed all processing. */
CONTENT_STATUS_DONE,
/** Error occurred, content will be destroyed imminently. */
CONTENT_STATUS_ERROR
} content_status;
/**
* Used in callbacks to indicate what has occurred.
*/
typedef enum {
/** Content wishes to log something */
CONTENT_MSG_LOG,
/** Content is from SSL and this is its chain */
CONTENT_MSG_SSL_CERTS,
/** fetching or converting */
CONTENT_MSG_LOADING,
/** may be displayed */
CONTENT_MSG_READY,
/** content has finished processing */
CONTENT_MSG_DONE,
/** error occurred */
CONTENT_MSG_ERROR,
/** fetch url redirect occured */
CONTENT_MSG_REDIRECT,
/** new status string */
CONTENT_MSG_STATUS,
/** content_reformat done */
CONTENT_MSG_REFORMAT,
/** needs redraw (eg. new animation frame) */
CONTENT_MSG_REDRAW,
/** wants refresh */
CONTENT_MSG_REFRESH,
/** download, not for display */
CONTENT_MSG_DOWNLOAD,
/** RFC5988 link */
CONTENT_MSG_LINK,
/** Javascript thread */
CONTENT_MSG_GETTHREAD,
/** Get viewport dimensions. */
CONTENT_MSG_GETDIMS,
/** Request to scroll content */
CONTENT_MSG_SCROLL,
/** Allow drag saving of content */
CONTENT_MSG_DRAGSAVE,
/** Allow URL to be saved */
CONTENT_MSG_SAVELINK,
/** Wants a specific mouse pointer set */
CONTENT_MSG_POINTER,
/** A selection made or cleared */
CONTENT_MSG_SELECTION,
/** Caret movement / hiding */
CONTENT_MSG_CARET,
/** A drag started or ended */
CONTENT_MSG_DRAG,
/** Create a select menu */
CONTENT_MSG_SELECTMENU,
/** A gadget has been clicked on (mainly for file) */
CONTENT_MSG_GADGETCLICK
} content_msg;
#endif #endif