summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2003-07-07 22:10:51 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2003-07-07 22:10:51 +0000
commit133c3ee759bdc27f661390633064d7554027fbcb (patch)
tree5490bd5ef69499dc8d91f1e9c0252196ae0be8c6 /content
parent1abf8018a907cd95af01dfe0196786928988a653 (diff)
downloadnetsurf-133c3ee759bdc27f661390633064d7554027fbcb.tar.gz
netsurf-133c3ee759bdc27f661390633064d7554027fbcb.tar.bz2
[project @ 2003-07-07 22:10:51 by jmb]
Rewrite plugin system backend. svn path=/import/netsurf/; revision=210
Diffstat (limited to 'content')
-rw-r--r--content/content.c12
-rw-r--r--content/content.h12
-rw-r--r--content/fetchcache.c4
3 files changed, 23 insertions, 5 deletions
diff --git a/content/content.c b/content/content.c
index 6520b6805..9b15a3b83 100644
--- a/content/content.c
+++ b/content/content.c
@@ -16,17 +16,22 @@
#include "netsurf/riscos/jpeg.h"
#include "netsurf/riscos/png.h"
#include "netsurf/riscos/gif.h"
+#include "netsurf/riscos/plugin.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/utils.h"
/* mime_map must be in sorted order by mime_type */
struct mime_entry {
- char mime_type[16];
+ char mime_type[40];
content_type type;
};
static const struct mime_entry mime_map[] = {
#ifdef riscos
+ {"application/java-vm", CONTENT_PLUGIN},
+ {"application/x-shockwave-flash", CONTENT_PLUGIN},
+ {"audio/midi", CONTENT_PLUGIN},
+ {"audio/x-midi", CONTENT_PLUGIN},
{"image/gif", CONTENT_GIF},
{"image/jpeg", CONTENT_JPEG},
{"image/png", CONTENT_PNG},
@@ -63,6 +68,8 @@ static const struct handler_entry handler_map[] = {
nspng_reformat, nspng_destroy, nspng_redraw},
{nsgif_create, nsgif_process_data, nsgif_convert, nsgif_revive,
nsgif_reformat, nsgif_destroy, nsgif_redraw},
+ {plugin_create, plugin_process_data, plugin_convert, plugin_revive,
+ plugin_reformat, plugin_destroy, plugin_redraw},
#endif
{other_create, other_process_data, other_convert, other_revive,
other_reformat, other_destroy, 0}
@@ -114,12 +121,13 @@ struct content * content_create(char *url)
* content_set_type -- initialise the content for the specified mime type
*/
-void content_set_type(struct content *c, content_type type)
+void content_set_type(struct content *c, content_type type, char* mime_type)
{
assert(c->status == CONTENT_STATUS_TYPE_UNKNOWN);
assert(type < CONTENT_UNKNOWN);
LOG(("content %s, type %i", c->url, type));
c->type = type;
+ c->mime_type = mime_type;
c->status = CONTENT_STATUS_LOADING;
content_broadcast(c, CONTENT_MSG_LOADING, 0);
handler_map[type].create(c);
diff --git a/content/content.h b/content/content.h
index 786013938..dd9b50592 100644
--- a/content/content.h
+++ b/content/content.h
@@ -48,6 +48,7 @@ typedef enum {
#ifdef riscos
CONTENT_PNG,
CONTENT_GIF,
+ CONTENT_PLUGIN,
#endif
CONTENT_OTHER,
CONTENT_UNKNOWN /* content-type not received yet */
@@ -85,6 +86,7 @@ struct content
{
char *url;
content_type type;
+ char *mime_type;
enum {
CONTENT_STATUS_TYPE_UNKNOWN, /* type not yet known */
CONTENT_STATUS_LOADING, /* content is being fetched or converted
@@ -156,6 +158,14 @@ struct content
osspriteop_area *sprite_area; // Sprite area
char *sprite_image; // Sprite image
} gif;
+
+ /* Structure for plugin */
+ struct
+ {
+ char *data; /* object data */
+ unsigned long length; /* object length */
+ char* sysvar; /* system variable set by plugin */
+ } plugin;
#endif
/* downloads */
struct
@@ -180,7 +190,7 @@ struct content
content_type content_lookup(const char *mime_type);
struct content * content_create(char *url);
-void content_set_type(struct content *c, content_type type);
+void content_set_type(struct content *c, content_type type, char *mime_type);
void content_process_data(struct content *c, char *data, unsigned long size);
void content_convert(struct content *c, unsigned long width, unsigned long height);
void content_revive(struct content *c, unsigned long width, unsigned long height);
diff --git a/content/fetchcache.c b/content/fetchcache.c
index ebd5e66d1..844111376 100644
--- a/content/fetchcache.c
+++ b/content/fetchcache.c
@@ -64,9 +64,9 @@ void fetchcache_callback(fetch_msg msg, void *p, char *data, unsigned long size)
if ((semic = strchr(mime_type, ';')) != 0)
*semic = 0; /* remove "; charset=..." */
type = content_lookup(mime_type);
- free(mime_type);
LOG(("FETCH_TYPE, type %u", type));
- content_set_type(c, type);
+ content_set_type(c, type, mime_type);
+ free(mime_type);
break;
case FETCH_DATA: