summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2003-05-31 18:47:00 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2003-05-31 18:47:00 +0000
commit51ee42fc080293aba2bcde9c85e06282530b8ab6 (patch)
tree4ba4db142eabd6436f2311011802bab8e2a18749 /riscos
parent1e202c8f2af09b7a9d717885ebbe205aad5e153a (diff)
downloadnetsurf-51ee42fc080293aba2bcde9c85e06282530b8ab6.tar.gz
netsurf-51ee42fc080293aba2bcde9c85e06282530b8ab6.tar.bz2
[project @ 2003-05-31 18:47:00 by jmb]
Begin support for <OBJECT>, <EMBED> and <APPLET> tags. NB: this doesn't work yet svn path=/import/netsurf/; revision=137
Diffstat (limited to 'riscos')
-rw-r--r--riscos/plugin.c87
-rw-r--r--riscos/plugin.h26
2 files changed, 113 insertions, 0 deletions
diff --git a/riscos/plugin.c b/riscos/plugin.c
new file mode 100644
index 000000000..e6b3aabb8
--- /dev/null
+++ b/riscos/plugin.c
@@ -0,0 +1,87 @@
+/**
+ * $Id: plugin.c,v 1.1 2003/05/31 18:47:00 jmb Exp $
+ */
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "netsurf/content/content.h"
+#include "netsurf/render/html.h"
+#include "netsurf/riscos/plugin.h"
+#include "netsurf/utils/log.h"
+#include "netsurf/utils/utils.h"
+
+char* create_mime_from_ext(char* data);
+
+void plugin_fetch(struct content* content, char* url, struct box* box,
+ struct plugin_object* po) {
+
+
+ content_type mime_type;
+
+ if (po->data != NULL) {
+
+ if (po->type != NULL) {
+
+ mime_type = content_lookup((const char*)po->type);
+ }
+ else {
+
+ po->type = create_mime_from_ext(po->data);
+
+ if (po->type != NULL)
+ mime_type = content_lookup((const char*)po->type);
+
+ }
+
+ /* OK, we have an image. Let's make the image handler
+ deal with it */
+ if (mime_type == CONTENT_JPEG || mime_type == CONTENT_PNG) {
+
+ xfree(po);
+ LOG(("sending data to image handler"));
+ /* TODO - stop segfault when redrawing window */
+ /*html_fetch_image(content, url, box);*/
+ }
+ }
+ else {
+
+
+ }
+ /* TODO - this function.*/
+
+}
+
+/**
+ * create_mime_from_ext
+ * attempts to create a mime type from the filename extension.
+ * returns NULL if it fails.
+ */
+
+char* create_mime_from_ext(char* data){
+
+ char* ret;
+
+ ret = strrchr(data, '.');
+ LOG(("ret = %s", ++ret));
+
+ if ((stricmp(ret,"jpg")) == 0 || (stricmp(ret,"jpeg")) == 0) {
+ strcpy(ret,"image/jpeg");
+ LOG(("jpeg image"));
+
+ } else if ((stricmp(ret,"png")) == 0) {
+ strcpy(ret,"image/png");
+ LOG(("png image"));
+
+ } /*else if ((stricmp(ret, "gif")) == 0) {
+ ret = "image/gif";
+ }*/ else {
+
+ ret = NULL;
+ }
+
+ return ret;
+}
diff --git a/riscos/plugin.h b/riscos/plugin.h
new file mode 100644
index 000000000..98b94c4da
--- /dev/null
+++ b/riscos/plugin.h
@@ -0,0 +1,26 @@
+/**
+ * $Id: plugin.h,v 1.1 2003/05/31 18:47:00 jmb Exp $
+ */
+
+#ifndef _NETSURF_RISCOS_PLUGIN_H_
+#define _NETSURF_RISCOS_PLUGIN_H_
+
+struct plugin_object {
+
+ char* data;
+ char* src;
+ char* type;
+ char* codetype;
+ char* codebase;
+ char* classid;
+ char* paramds; /* very likely to change */
+ unsigned int* width;
+ unsigned int* height;
+
+};
+
+
+void plugin_fetch(struct content* content, char* url, struct box* box,
+ struct plugin_object* po);
+
+#endif