NetSurf
|
Content factory implementation. More...
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "utils/http.h"
#include "content/content.h"
#include "content/content_factory.h"
#include "content/content_protected.h"
#include "content/llcache.h"
Go to the source code of this file.
Data Structures | |
struct | content_handler_entry |
Entry in list of content handlers. More... | |
Typedefs | |
typedef struct content_handler_entry | content_handler_entry |
Entry in list of content handlers. More... | |
Functions | |
void | content_factory_fini (void) |
Clean up after the content factory. More... | |
nserror | content_factory_register_handler (const char *mime_type, const content_handler *handler) |
Register a handler with the content factory. More... | |
static const content_handler * | content_lookup (lwc_string *mime_type) |
Find a handler for a MIME type. More... | |
content_type | content_factory_type_from_mime_type (lwc_string *mime_type) |
Compute the generic content type for a MIME type. More... | |
struct content * | content_factory_create_content (llcache_handle *llcache, const char *fallback_charset, bool quirks, lwc_string *effective_type) |
Create a content object. More... | |
Variables | |
static content_handler_entry * | content_handlers |
Content factory implementation.
Definition in file content_factory.c.
typedef struct content_handler_entry content_handler_entry |
Entry in list of content handlers.
struct content * content_factory_create_content | ( | llcache_handle * | llcache, |
const char * | fallback_charset, | ||
bool | quirks, | ||
lwc_string * | effective_type | ||
) |
Create a content object.
llcache | Underlying source data handle |
fallback_charset | Character set to fall back to if none specified |
quirks | Quirkiness of containing document |
effective_type | Effective MIME type of content |
Definition at line 169 of file content_factory.c.
References content_lookup(), content_handler::create, content::fallback_charset, content::handler, http_content_type_destroy(), http_parse_content_type(), llcache, llcache_handle_get_header(), NSERROR_OK, http_content_type::parameters, and content::quirks.
Referenced by hlcache_find_content().
void content_factory_fini | ( | void | ) |
Clean up after the content factory.
Definition at line 53 of file content_factory.c.
References content_handlers, content_handler::fini, content_handler_entry::handler, content_handler_entry::mime_type, and content_handler_entry::next.
Referenced by netsurf_exit().
nserror content_factory_register_handler | ( | const char * | mime_type, |
const content_handler * | handler | ||
) |
Register a handler with the content factory.
mime_type | MIME type to handle |
handler | Content handler for MIME type |
Definition at line 80 of file content_factory.c.
References content_handlers, content_handler_entry::handler, content_handler_entry::mime_type, content_handler_entry::next, NSERROR_NOMEM, and NSERROR_OK.
Referenced by amiga_plugin_hack_init(), html_init(), nscss_init(), and textplain_init().
content_type content_factory_type_from_mime_type | ( | lwc_string * | mime_type | ) |
Compute the generic content type for a MIME type.
mime_type | MIME type to consider |
Definition at line 147 of file content_factory.c.
References content_lookup(), CONTENT_NONE, content_handler_entry::handler, content_handler_entry::mime_type, content_handler::type, and type.
Referenced by ami_file_set_type(), box_object(), exec_inline_script(), hlcache_type_is_acceptable(), HOOKF(), and mimesniff_compute_effective_type().
|
static |
Find a handler for a MIME type.
mime_type | MIME type to search for |
Definition at line 122 of file content_factory.c.
References content_handlers, content_handler_entry::handler, content_handler_entry::mime_type, and content_handler_entry::next.
Referenced by content_factory_create_content(), and content_factory_type_from_mime_type().
|
static |
Definition at line 48 of file content_factory.c.
Referenced by content_factory_fini(), content_factory_register_handler(), and content_lookup().