From 974e9b7264ad1ca17683b39018c88a5479519fb0 Mon Sep 17 00:00:00 2001 From: "idk%eng.sun.com" Date: Tue, 9 Nov 1999 10:28:46 +0000 Subject: [PATCH] bug 18180 Names changed Pluglet->PlugletFactory, *PlugletInstance*->*Pluglet* --- .../classes/org/mozilla/pluglet/Pluglet.java | 61 +++- .../org/mozilla/pluglet/PlugletFactory.java | 47 +++ .../org/mozilla/pluglet/PlugletLoader.java | 10 +- .../pluglet/mozilla/PlugletInstancePeer.java | 0 .../mozilla/PlugletInstancePeerImpl.java | 0 .../pluglet/mozilla/PlugletManager.java | 8 +- .../pluglet/mozilla/PlugletManagerImpl.java | 8 +- .../mozilla/pluglet/mozilla/PlugletPeer.java | 56 ++++ .../pluglet/mozilla/PlugletPeerImpl.java | 62 ++++ java/plugins/jni/makefile.win | 2 +- ...luglet_mozilla_PlugletInstancePeerImpl.cpp | 0 ..._pluglet_mozilla_PlugletInstancePeerImpl.h | 0 ...lla_pluglet_mozilla_PlugletManagerImpl.cpp | 4 +- ...zilla_pluglet_mozilla_PlugletManagerImpl.h | 4 +- ...ozilla_pluglet_mozilla_PlugletPeerImpl.cpp | 185 ++++++++++++ ..._mozilla_pluglet_mozilla_PlugletPeerImpl.h | 101 +++++++ java/plugins/src/List.cpp | 68 +++++ java/plugins/src/List.h | 46 +++ java/plugins/src/Pluglet.cpp | 271 +++++++++--------- java/plugins/src/Pluglet.h | 45 +-- java/plugins/src/PlugletEngine.cpp | 8 +- java/plugins/src/PlugletFactory.cpp | 181 ++++++++++++ java/plugins/src/PlugletFactory.h | 47 +++ java/plugins/src/PlugletInstance.cpp | 0 java/plugins/src/PlugletInstance.h | 0 java/plugins/src/PlugletInstancePeer.cpp | 0 java/plugins/src/PlugletInstancePeer.h | 0 java/plugins/src/PlugletInstanceView.cpp | 0 java/plugins/src/PlugletInstanceView.h | 0 java/plugins/src/PlugletList.cpp | 0 java/plugins/src/PlugletList.h | 0 java/plugins/src/PlugletLoader.cpp | 2 +- java/plugins/src/PlugletPeer.cpp | 69 +++++ java/plugins/src/PlugletPeer.h | 35 +++ .../PlugletView.cpp} | 0 java/plugins/src/PlugletView.h | 50 ++++ java/plugins/src/PlugletsDir.cpp | 22 +- java/plugins/src/PlugletsDir.h | 8 +- java/plugins/src/makefile.win | 8 +- java/plugins/test/test.java | 11 +- 40 files changed, 1213 insertions(+), 206 deletions(-) create mode 100644 java/plugins/classes/org/mozilla/pluglet/PlugletFactory.java delete mode 100644 java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletInstancePeer.java delete mode 100644 java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletInstancePeerImpl.java create mode 100644 java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletPeer.java create mode 100644 java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletPeerImpl.java delete mode 100644 java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl.cpp delete mode 100644 java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl.h create mode 100644 java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletPeerImpl.cpp create mode 100644 java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletPeerImpl.h create mode 100644 java/plugins/src/List.cpp create mode 100644 java/plugins/src/List.h create mode 100644 java/plugins/src/PlugletFactory.cpp create mode 100644 java/plugins/src/PlugletFactory.h delete mode 100644 java/plugins/src/PlugletInstance.cpp delete mode 100644 java/plugins/src/PlugletInstance.h delete mode 100644 java/plugins/src/PlugletInstancePeer.cpp delete mode 100644 java/plugins/src/PlugletInstancePeer.h delete mode 100644 java/plugins/src/PlugletInstanceView.cpp delete mode 100644 java/plugins/src/PlugletInstanceView.h delete mode 100644 java/plugins/src/PlugletList.cpp delete mode 100644 java/plugins/src/PlugletList.h create mode 100644 java/plugins/src/PlugletPeer.cpp create mode 100644 java/plugins/src/PlugletPeer.h rename java/plugins/{classes/org/mozilla/pluglet/PlugletInstance.java => src/PlugletView.cpp} (100%) create mode 100644 java/plugins/src/PlugletView.h diff --git a/java/plugins/classes/org/mozilla/pluglet/Pluglet.java b/java/plugins/classes/org/mozilla/pluglet/Pluglet.java index 9ca1e371567..5de24eae419 100644 --- a/java/plugins/classes/org/mozilla/pluglet/Pluglet.java +++ b/java/plugins/classes/org/mozilla/pluglet/Pluglet.java @@ -19,27 +19,66 @@ * Contributor(s): */ package org.mozilla.pluglet; - import org.mozilla.pluglet.mozilla.*; +import java.awt.Frame; +import java.awt.print.PrinterJob; public interface Pluglet { /** - * Creates a new pluglet instance, based on a MIME type. This - * allows different impelementations to be created depending on - * the specified MIME type. + * Initializes a newly created pluglet instance, passing to it the pluglet + * instance peer which it should use for all communication back to the browser. + * + * @param peer the corresponding pluglet peer */ - public PlugletInstance createPlugletInstance(String mimeType); + void initialize(PlugletPeer peer); /** - * Initializes the pluglet and will be called before any new instances are - * created. + * Called to instruct the pluglet instance to start. This will be called after + * the pluglet is first created and initialized, and may be called after the + * pluglet is stopped (via the Stop method) if the pluglet instance is returned + * to in the browser window's history. */ - public void initialize(PlugletManager manager); + void start(); /** - * Called when the browser is done with the pluglet factory, or when - * the pluglet is disabled by the user. + * Called to instruct the pluglet instance to stop, thereby suspending its state. + * This method will be called whenever the browser window goes on to display + * another page and the page containing the pluglet goes into the window's history + * list. */ - public void shutdown(); + void stop(); + /** + * Called to instruct the pluglet instance to destroy itself. This is called when + * it become no longer possible to return to the pluglet instance, either because + * the browser window's history list of pages is being trimmed, or because the + * window containing this page in the history is being closed. + */ + void destroy(); + /** + * Called to tell the pluglet that the initial src/data stream is + * ready. + * + * @result PlugletStreamListener + */ + PlugletStreamListener newStream(); + /** + * Called when the window containing the pluglet instance changes. + * + * @param frame the pluglet panel + */ + void setWindow(Frame frame); + /** + * Called to instruct the pluglet instance to print itself to a printer. + * + * @param print printer information. + */ + void print(PrinterJob printerJob); } + + + + + + + diff --git a/java/plugins/classes/org/mozilla/pluglet/PlugletFactory.java b/java/plugins/classes/org/mozilla/pluglet/PlugletFactory.java new file mode 100644 index 00000000000..9fca9fb78c6 --- /dev/null +++ b/java/plugins/classes/org/mozilla/pluglet/PlugletFactory.java @@ -0,0 +1,47 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are + * Copyright (C) 1999 Sun Microsystems, Inc. All + * Rights Reserved. + * + * Contributor(s): + */ +package org.mozilla.pluglet; + +import org.mozilla.pluglet.mozilla.*; + +public interface PlugletFactory { + /** + * Creates a new pluglet instance, based on a MIME type. This + * allows different impelementations to be created depending on + * the specified MIME type. + */ + public Pluglet createPluglet(String mimeType); + /** + * Initializes the pluglet and will be called before any new instances are + * created. + */ + public void initialize(PlugletManager manager); + /** + * Called when the browser is done with the pluglet factory, or when + * the pluglet is disabled by the user. + */ + public void shutdown(); +} + + + + + diff --git a/java/plugins/classes/org/mozilla/pluglet/PlugletLoader.java b/java/plugins/classes/org/mozilla/pluglet/PlugletLoader.java index 8b58d8bac52..94965c3668a 100644 --- a/java/plugins/classes/org/mozilla/pluglet/PlugletLoader.java +++ b/java/plugins/classes/org/mozilla/pluglet/PlugletLoader.java @@ -30,7 +30,7 @@ import java.security.*; public class PlugletLoader { // path to jar file. Name of main class sould to be in MANIFEST. - public static Pluglet getPluglet(String path) { + public static PlugletFactory getPluglet(String path) { try { org.mozilla.util.Debug.print("-- PlugletLoader.getPluglet("+path+")\n"); URL url = new URL("file:/"+path); @@ -41,7 +41,7 @@ public class PlugletLoader { Attributes attr = manifest.getMainAttributes(); String plugletClassName = attr.getValue("Pluglet-Class"); org.mozilla.util.Debug.print("-- PlugletLoader.getPluglet class name "+plugletClassName+"\n"); - org.mozilla.util.Debug.print("-- PL url[0] "+loader.getURLs()[0]); + org.mozilla.util.Debug.print("-- PL url[0] "+loader.getURLs()[0]+"\n"); if (plugletClassName == null) { //nb return null; @@ -58,9 +58,11 @@ public class PlugletLoader { collection.add(perm); policy.grantPermission(codesource,collection); Object pluglet = loader.loadClass(plugletClassName).newInstance(); - if (pluglet instanceof Pluglet) { - return (Pluglet) pluglet; + if (pluglet instanceof PlugletFactory) { + org.mozilla.util.Debug.print("-- ok we have a PlugletFactory"+"\n"); + return (PlugletFactory) pluglet; } else { + org.mozilla.util.Debug.print("-- oups we do not have a PlugletFactory"+"\n"); return null; } } catch (Exception e) { diff --git a/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletInstancePeer.java b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletInstancePeer.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletInstancePeerImpl.java b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletInstancePeerImpl.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletManager.java b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletManager.java index 84360b7807d..aa02615310e 100644 --- a/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletManager.java +++ b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletManager.java @@ -47,7 +47,7 @@ public interface PlugletManager { public String userAgent(); /** * Fetches a URL. - * @param plugletInst the pluglet making the request. + * @param pluglet the pluglet making the request. * If null, the URL is fetched in the background. * @param url the URL to fetch * @param target the target window into which to load the URL @@ -62,7 +62,7 @@ public interface PlugletManager { * 'javascript:' URLs, even if the user currently has JavaScript * disabled (usually specify false) */ - public void getURL(PlugletInstance plugletInst, + public void getURL(Pluglet pluglet, URL url, String target, PlugletStreamListener streamListener, String altHost, URL referrer, @@ -70,7 +70,7 @@ public interface PlugletManager { /** * Posts to a URL with post data and/or post headers. * - * @param plugletInst the pluglet making the request. If null, the URL + * @param pluglet the pluglet making the request. If null, the URL * is fetched in the background. * @param url the URL to fetch * @param target the target window into which to load the URL @@ -93,7 +93,7 @@ public interface PlugletManager { * are no post headers */ - public void postURL(PlugletInstance plugletInst, + public void postURL(Pluglet pluglet, URL url, int postDataLen, byte[] postData, diff --git a/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletManagerImpl.java b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletManagerImpl.java index 9bb865dc3c2..a7cd5c3269e 100644 --- a/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletManagerImpl.java +++ b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletManagerImpl.java @@ -50,7 +50,7 @@ public class PlugletManagerImpl implements PlugletManager { public native String userAgent(); /** * Fetches a URL. - * @param plugletInst the pluglet making the request. + * @param pluglet the pluglet making the request. * If null, the URL is fetched in the background. * @param url the URL to fetch * @param target the target window into which to load the URL @@ -65,7 +65,7 @@ public class PlugletManagerImpl implements PlugletManager { * 'javascript:' URLs, even if the user currently has JavaScript * disabled (usually specify false) */ - public native void getURL(PlugletInstance plugletInst, + public native void getURL(Pluglet pluglet, URL url, String target, PlugletStreamListener streamListener, String altHost, URL referrer, @@ -73,7 +73,7 @@ public class PlugletManagerImpl implements PlugletManager { /** * Posts to a URL with post data and/or post headers. * - * @param plugletInst the pluglet making the request. If null, the URL + * @param pluglet the pluglet making the request. If null, the URL * is fetched in the background. * @param url the URL to fetch * @param target the target window into which to load the URL @@ -96,7 +96,7 @@ public class PlugletManagerImpl implements PlugletManager { * are no post headers */ - public native void postURL(PlugletInstance plugletInst, + public native void postURL(Pluglet pluglet, URL url, int postDataLen, byte[] postData, diff --git a/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletPeer.java b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletPeer.java new file mode 100644 index 00000000000..ccdd07b0da8 --- /dev/null +++ b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletPeer.java @@ -0,0 +1,56 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems, + * Inc. All Rights Reserved. + */ +package org.mozilla.pluglet.mozilla; +import java.io.OutputStream; + + +public interface PlugletPeer { + public static final int NETSCAPE_WINDOW = 3; + /** + * Returns the MIME type of the pluglet instance. + */ + public String getMIMEType(); + /** + * Returns the mode of the pluglet instance, i.e. whether the pluglet + * is embedded in the html, or full page. + */ + public int getMode(); + /** + * Returns the value of a variable associated with the pluglet manager. + * @param variable the pluglet manager variable to get + */ + public String getValue(int variable); + /** + * This operation is called by the pluglet instance when it wishes to send a stream of data to the browser. It constructs a + * new output stream to which the pluglet may send the data. When complete, the Close and Release methods should be + * called on the output stream. + * @param type type MIME type of the stream to create + * @param target the target window name to receive the data + */ + public OutputStream newStream(String type, String target); + /** This operation causes status information to be displayed on the window associated with the pluglet instance. + * @param message the status message to display + */ + public void showStatus(String message); + /** + * Set the desired size of the window in which the plugin instance lives. + * + * @param width - new window width + * @param height - new window height + */ + public void setWindowSize(int width, int height); + public PlugletTagInfo getTagInfo(); +} diff --git a/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletPeerImpl.java b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletPeerImpl.java new file mode 100644 index 00000000000..63a499a72ef --- /dev/null +++ b/java/plugins/classes/org/mozilla/pluglet/mozilla/PlugletPeerImpl.java @@ -0,0 +1,62 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems, + * Inc. All Rights Reserved. + */ +package org.mozilla.pluglet.mozilla; +import java.io.OutputStream; + + +public class PlugletPeerImpl implements PlugletPeer { + private long peer = 0; + public PlugletPeerImpl(long peer) { + this.peer = peer; + nativeInitialize(); + } + /** + * Returns the MIME type of the pluglet instance. + */ + public native String getMIMEType(); + /** + * Returns the mode of the pluglet instance, i.e. whether the pluglet + * is embedded in the html, or full page. + */ + public native int getMode(); + /** + * Returns the value of a variable associated with the pluglet manager. + * @param variable the pluglet manager variable to get + */ + public native String getValue(int variable); + /** + * This operation is called by the pluglet instance when it wishes to send a stream of data to the browser. It constructs a + * new output stream to which the pluglet may send the data. When complete, the Close and Release methods should be + * called on the output stream. + * @param type type MIME type of the stream to create + * @param target the target window name to receive the data + */ + public native OutputStream newStream(String type, String target); + /** This operation causes status information to be displayed on the window associated with the pluglet instance. + * @param message the status message to display + */ + public native void showStatus(String message); + /** + * Set the desired size of the window in which the plugin instance lives. + * + * @param width - new window width + * @param height - new window height + */ + public native void setWindowSize(int width, int height); + public native PlugletTagInfo getTagInfo(); + private native void nativeFinalize(); + private native void nativeInitialize(); +}; diff --git a/java/plugins/jni/makefile.win b/java/plugins/jni/makefile.win index 770a456ec52..7da312543b4 100644 --- a/java/plugins/jni/makefile.win +++ b/java/plugins/jni/makefile.win @@ -35,7 +35,7 @@ OBJS = \ .\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletStreamInfoImpl.obj \ .\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletInputStream.obj \ .\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletOutputStream.obj \ - .\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl.obj \ + .\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletPeerImpl.obj \ .\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletManagerImpl.obj \ .\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl.obj \ .\$(OBJDIR)\PlugletTagInfo2.obj \ diff --git a/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl.cpp b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl.h b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletManagerImpl.cpp b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletManagerImpl.cpp index bd685988317..7f5cb1d40ee 100644 --- a/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletManagerImpl.cpp +++ b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletManagerImpl.cpp @@ -71,7 +71,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_us /* * Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl * Method: getURL - * Signature: (Lorg/mozilla/pluglet/PlugletInstance;Ljava/net/URL;Ljava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;Z)V + * Signature: (Lorg/mozilla/pluglet/Pluglet;Ljava/net/URL;Ljava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;Z)V */ JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_getURL (JNIEnv *env, jobject jthis, jobject, jobject, jstring, jobject, jstring, jobject, jboolean) { @@ -82,7 +82,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_getUR /* * Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl * Method: postURL - * Signature: (Lorg/mozilla/pluglet/PlugletInstance;Ljava/net/URL;I[BZLjava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;ZI[B)V + * Signature: (Lorg/mozilla/pluglet/Pluglet;Ljava/net/URL;I[BZLjava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;ZI[B)V */ JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_postURL (JNIEnv *env, jobject jthis, jobject, jobject, jint, jbyteArray, jboolean, jstring, jobject, jstring, jobject, jboolean, jint, jbyteArray) { diff --git a/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletManagerImpl.h b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletManagerImpl.h index f2c32971dc1..f963fffa086 100644 --- a/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletManagerImpl.h +++ b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletManagerImpl.h @@ -54,7 +54,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_us /* * Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl * Method: getURL - * Signature: (Lorg/mozilla/pluglet/PlugletInstance;Ljava/net/URL;Ljava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;Z)V + * Signature: (Lorg/mozilla/pluglet/Pluglet;Ljava/net/URL;Ljava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;Z)V */ JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_getURL (JNIEnv *, jobject, jobject, jobject, jstring, jobject, jstring, jobject, jboolean); @@ -62,7 +62,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_getUR /* * Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl * Method: postURL - * Signature: (Lorg/mozilla/pluglet/PlugletInstance;Ljava/net/URL;I[BZLjava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;ZI[B)V + * Signature: (Lorg/mozilla/pluglet/Pluglet;Ljava/net/URL;I[BZLjava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;ZI[B)V */ JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_postURL (JNIEnv *, jobject, jobject, jobject, jint, jbyteArray, jboolean, jstring, jobject, jstring, jobject, jboolean, jint, jbyteArray); diff --git a/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletPeerImpl.cpp b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletPeerImpl.cpp new file mode 100644 index 00000000000..5a26cf1d3dd --- /dev/null +++ b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletPeerImpl.cpp @@ -0,0 +1,185 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems, + * Inc. All Rights Reserved. + */ + +#include "nsIPluginInstancePeer.h" +#include "nsIPluginTagInfo2.h" +#include "PlugletOutputStream.h" +#include "PlugletTagInfo2.h" +#include "org_mozilla_pluglet_mozilla_PlugletPeerImpl.h" + +static jfieldID peerFID = NULL; +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: getMIMEType + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_getMIMEType + (JNIEnv *env, jobject jthis) { + nsIPluginInstancePeer * instancePeer = (nsIPluginInstancePeer*)env->GetLongField(jthis, peerFID); + if (!instancePeer) { + return NULL; + } + nsMIMEType mime; + if(NS_FAILED(instancePeer->GetMIMEType(&mime))) { + return NULL; + } + return env->NewStringUTF((char *)mime); +} + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: getMode + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_getMode + (JNIEnv *, jobject) { + return 1; //nb +} + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: getValue + * Signature: (I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_getValue + (JNIEnv *, jobject, jint) { + return NULL; //nb +} + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: newStream + * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/io/OutputStream; + */ +JNIEXPORT jobject JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_newStream + (JNIEnv *env, jobject jthis, jstring _type, jstring _target) { + nsMIMEType mimeType = NULL; + if ( _type == NULL + || _target == NULL) { + return NULL; //nb should throw NullPointerException + } + if(!(mimeType = (nsMIMEType)env->GetStringUTFChars(_type,NULL))) { + return NULL; + } + const char * target = NULL; + if(!(target = env->GetStringUTFChars(_target,NULL))) { + env->ReleaseStringUTFChars(_type,(char *)mimeType); + return NULL; + } + nsIPluginInstancePeer * instancePeer = NULL; + if(!(instancePeer = (nsIPluginInstancePeer*)env->GetLongField(jthis, peerFID))) { + env->ReleaseStringUTFChars(_type,(char *)mimeType); + env->ReleaseStringUTFChars(_target,target); + return NULL; + } + nsIOutputStream *output = NULL; + if (NS_FAILED(instancePeer->NewStream(mimeType,target,&output))) { + env->ReleaseStringUTFChars(_type,(char *)mimeType); + env->ReleaseStringUTFChars(_target,target); + return NULL; + } + env->ReleaseStringUTFChars(_type,(char *)mimeType); + env->ReleaseStringUTFChars(_target,target); + return PlugletOutputStream::GetJObject(env,output); +} + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: showStatus + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_showStatus + (JNIEnv *env, jobject jthis, jstring _msg) { + nsIPluginInstancePeer * instancePeer = (nsIPluginInstancePeer*)env->GetLongField(jthis, peerFID); + if (!instancePeer) { + return; + } + const char *msg = NULL; + if(!(msg = env->GetStringUTFChars(_msg,NULL))) { + return; + } + instancePeer->ShowStatus(msg); + env->ReleaseStringUTFChars(_msg,msg); +} + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: setWindowSize + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_setWindowSize + (JNIEnv *env, jobject jthis, jint width, jint height) { + nsIPluginInstancePeer * instancePeer = (nsIPluginInstancePeer*)env->GetLongField(jthis, peerFID); + if (!instancePeer) { + return; + } + instancePeer->SetWindowSize(width,height); + //nb add exception throwing +} + + + +static NS_DEFINE_IID(kIPluginTagInfo2,NS_IPLUGINTAGINFO2_IID); +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: getTagInfo + * Signature: ()Lorg/mozilla/pluglet/mozilla/PlugletTagInfo; + */ +JNIEXPORT jobject JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_getTagInfo + (JNIEnv *env, jobject jthis) { + nsIPluginInstancePeer * instancePeer = (nsIPluginInstancePeer*)env->GetLongField(jthis, peerFID); + nsIPluginTagInfo2 * info = NULL; + if(NS_FAILED(instancePeer->QueryInterface(kIPluginTagInfo2,(void**)&info))) { + return NULL; + } + return PlugletTagInfo2::GetJObject(env,info); +} + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: nativeFinalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_nativeFinalize + (JNIEnv *env, jobject jthis) { + nsIPluginInstancePeer * instancePeer = (nsIPluginInstancePeer*)env->GetLongField(jthis, peerFID); + if (instancePeer) { + /*nb do as in java-dom stuff */ + NS_RELEASE(instancePeer); + } +} + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: nativeInitialize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_nativeInitialize + (JNIEnv *env, jobject jthis) { + if(!peerFID) { + peerFID = env->GetFieldID(env->GetObjectClass(jthis),"peer","J"); + if (!peerFID) { + return; + } + } + nsIPluginInstancePeer * instancePeer = (nsIPluginInstancePeer*)env->GetLongField(jthis, peerFID); + if (instancePeer) { + instancePeer->AddRef(); + } +} + + + diff --git a/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletPeerImpl.h b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletPeerImpl.h new file mode 100644 index 00000000000..24c4f539bbe --- /dev/null +++ b/java/plugins/jni/org_mozilla_pluglet_mozilla_PlugletPeerImpl.h @@ -0,0 +1,101 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems, + * Inc. All Rights Reserved. + */ + +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_mozilla_pluglet_mozilla_PlugletPeerImpl */ + +#ifndef _Included_org_mozilla_pluglet_mozilla_PlugletPeerImpl +#define _Included_org_mozilla_pluglet_mozilla_PlugletPeerImpl +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: getMIMEType + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_getMIMEType + (JNIEnv *, jobject); + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl + * Method: getMode + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_getMode + (JNIEnv *, jobject); + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: getValue + * Signature: (I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_getValue + (JNIEnv *, jobject, jint); + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: newStream + * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/io/OutputStream; + */ +JNIEXPORT jobject JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_newStream + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: showStatus + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_showStatus + (JNIEnv *, jobject, jstring); + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: setWindowSize + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_setWindowSize + (JNIEnv *, jobject, jint, jint); + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: getTagInfo + * Signature: ()Lorg/mozilla/pluglet/mozilla/PlugletTagInfo; + */ +JNIEXPORT jobject JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_getTagInfo + (JNIEnv *, jobject); + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: nativeFinalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_nativeFinalize + (JNIEnv *, jobject); + +/* + * Class: org_mozilla_pluglet_mozilla_PlugletPeerImpl + * Method: nativeInitialize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletPeerImpl_nativeInitialize + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/java/plugins/src/List.cpp b/java/plugins/src/List.cpp new file mode 100644 index 00000000000..8466f8a2da2 --- /dev/null +++ b/java/plugins/src/List.cpp @@ -0,0 +1,68 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems, + * Inc. All Rights Reserved. + */ +#include"List.h" + +List::List() { + head = tail = NULL; +} + +List::~List() { + ListNode *tmp; + for(ListNode * current=head;!current;tmp = current,current = current->next, delete tmp) + ; +} + +List::ListNode::ListNode(void *v,List::ListNode *n) { + value = v; next = n; +} + +void List::Add(void *v) { + if (!v) { + return; + } + if (!tail) { + head = tail = new ListNode(v); + } else { + tail->next = new ListNode(v); + if (tail->next) { + tail = tail->next; + } + } +} + +ListIterator * List::GetIterator(void) { + return new ListIterator(this); +} + +ListIterator::ListIterator(List *list) { + current = list->head; +} +void * ListIterator::Get(void) { + void * result = NULL; + if (current) { + result = current->value; + } + return result; +} + +void * ListIterator::Next(void) { + void * result = NULL; + if (current) { + current = current->next; + result = Get(); + } + return result; +} diff --git a/java/plugins/src/List.h b/java/plugins/src/List.h new file mode 100644 index 00000000000..4a905c02c73 --- /dev/null +++ b/java/plugins/src/List.h @@ -0,0 +1,46 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems, + * Inc. All Rights Reserved. + */ +#ifndef __List_h__ +#define __List_h__ +#include //in order to have NULL definition +class ListIterator; + +class List { + friend class ListIterator; + public: + List(); + ~List(); + void Add(void *value); + ListIterator * GetIterator(void); + private: + struct ListNode { + ListNode(void *v,ListNode *n = NULL); + void * value; + ListNode * next; + }; + ListNode * head; + ListNode * tail; +}; +class ListIterator { + public: + ListIterator(List *list); + void * Get(void); + void * Next(void); + private: + List::ListNode *current; +}; + +#endif /* __List_h__ */ diff --git a/java/plugins/src/Pluglet.cpp b/java/plugins/src/Pluglet.cpp index 322c5ac0eff..0737dfb8eb0 100644 --- a/java/plugins/src/Pluglet.cpp +++ b/java/plugins/src/Pluglet.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of @@ -20,161 +20,170 @@ */ #include "Pluglet.h" #include "PlugletEngine.h" -#include "PlugletLoader.h" -#include "PlugletInstance.h" -#include "string.h" +#include "PlugletStreamListener.h" +#include "PlugletPeer.h" +#include "Registry.h" -jmethodID Pluglet::createPlugletInstanceMID = NULL; -jmethodID Pluglet::initializeMID = NULL; -jmethodID Pluglet::shutdownMID = NULL; +jmethodID Pluglet::initializeMID = NULL; +jmethodID Pluglet::startMID = NULL; +jmethodID Pluglet::stopMID = NULL; +jmethodID Pluglet::destroyMID = NULL; +jmethodID Pluglet::newStreamMID = NULL; +jmethodID Pluglet::setWindowMID = NULL; +jmethodID Pluglet::printMID = NULL; +static NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID); -nsresult Pluglet::CreatePluginInstance(const char* aPluginMIMEType, void **aResult) { - if(!aResult - || Initialize() != NS_OK) { - return NS_ERROR_FAILURE; - } - JNIEnv *env = PlugletEngine::GetJNIEnv(); - if(!env) { - return NS_ERROR_FAILURE; - } - jstring jstr = env->NewStringUTF(aPluginMIMEType); - jobject obj = env->CallObjectMethod(jthis,createPlugletInstanceMID, jstr); - if (!obj) { - return NS_ERROR_FAILURE; - } - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - return NS_ERROR_FAILURE; - } - nsISupports * instance = new PlugletInstance(obj); - NS_ADDREF(instance); - *aResult = instance; +NS_IMPL_ISUPPORTS(Pluglet, kIPluginInstanceIID); + +Pluglet::Pluglet(jobject object) { + NS_INIT_REFCNT(); + jthis = PlugletEngine::GetJNIEnv()->NewGlobalRef(object); + //nb check for null + peer = NULL; + view = new PlugletView(); + Registry::SetPeer(jthis,(jlong)this); +} + +Pluglet::~Pluglet() { + Registry::Remove(jthis); + PlugletEngine::GetJNIEnv()->DeleteGlobalRef(jthis); + NS_RELEASE(peer); +} + +NS_METHOD Pluglet::HandleEvent(nsPluginEvent* event, PRBool* handled) { + //nb we do not need it under win32 return NS_OK; } -nsresult Pluglet::Initialize(void) { +NS_METHOD Pluglet::Initialize(nsIPluginInstancePeer* _peer) { JNIEnv *env = PlugletEngine::GetJNIEnv(); - if(!env) { - return NS_ERROR_FAILURE; - } - if (!initializeMID) { + if (!printMID) { jclass clazz = env->FindClass("org/mozilla/pluglet/Pluglet"); - if(!clazz) { - return NS_ERROR_FAILURE; - } - createPlugletInstanceMID = env->GetMethodID(clazz,"createPlugletInstance","(Ljava/lang/String;)Lorg/mozilla/pluglet/PlugletInstance;"); - if (!createPlugletInstanceMID) { - return NS_ERROR_FAILURE; - } - shutdownMID = env->GetMethodID(clazz,"shutdown","()V"); - if (!shutdownMID) { - return NS_ERROR_FAILURE; - } - initializeMID = env->GetMethodID(clazz,"initialize","(Lorg/mozilla/pluglet/mozilla/PlugletManager;)V"); - if (!initializeMID) { - return NS_ERROR_FAILURE; - } - - } - if (!jthis) { - jthis = PlugletLoader::GetPluglet(path); - if (!jthis) { - return NS_ERROR_FAILURE; - } - env->CallVoidMethod(jthis,initializeMID,PlugletEngine::GetPlugletManager()); if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - return NS_ERROR_FAILURE; - } + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + initializeMID = env->GetMethodID(clazz,"initialize","(Lorg/mozilla/pluglet/mozilla/PlugletPeer;)V"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + startMID = env->GetMethodID(clazz,"start","()V"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + stopMID = env->GetMethodID(clazz,"stop","()V"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + destroyMID = env->GetMethodID(clazz,"destroy","()V"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + newStreamMID = env->GetMethodID(clazz,"newStream","()Lorg/mozilla/pluglet/PlugletStreamListener;"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + setWindowMID = env->GetMethodID(clazz,"setWindow","(Ljava/awt/Frame;)V"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + printMID = env->GetMethodID(clazz,"print","(Ljava/awt/print/PrinterJob;)V"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } } + peer = _peer; + peer->AddRef(); + jobject obj = PlugletPeer::GetJObject(peer); + if (!obj) { + return NS_ERROR_FAILURE; + } + env->CallVoidMethod(jthis,initializeMID,obj); return NS_OK; } -nsresult Pluglet::Shutdown(void) { - - if(!jthis) { - return NS_ERROR_FAILURE; - } - JNIEnv *env = PlugletEngine::GetJNIEnv(); - if(!env) { - return NS_ERROR_FAILURE; - } - env->CallVoidMethod(jthis,shutdownMID); +NS_METHOD Pluglet::GetPeer(nsIPluginInstancePeer* *result) { + peer->AddRef(); + *result = peer; + return NS_OK; +} + +NS_METHOD Pluglet::Start(void) { + JNIEnv * env = PlugletEngine::GetJNIEnv(); + env->CallVoidMethod(jthis,startMID); if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + return NS_OK; +} +NS_METHOD Pluglet::Stop(void) { + JNIEnv * env = PlugletEngine::GetJNIEnv(); + env->CallVoidMethod(jthis,stopMID); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + return NS_OK; +} +NS_METHOD Pluglet::Destroy(void) { + JNIEnv * env = PlugletEngine::GetJNIEnv(); + env->CallVoidMethod(jthis,destroyMID); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + return NS_OK; +} + +NS_METHOD Pluglet::NewStream(nsIPluginStreamListener** listener) { + if(!listener) { return NS_ERROR_FAILURE; } + JNIEnv * env = PlugletEngine::GetJNIEnv(); + jobject obj = env->CallObjectMethod(jthis,newStreamMID); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + if (obj) { + *listener = new PlugletStreamListener(obj); + (*listener)->AddRef(); + } return NS_OK; } -nsresult Pluglet::GetMIMEDescription(const char* *result) { - if(!result) { - return NS_ERROR_FAILURE; - } - *result = mimeDescription; - return (*result) ? NS_OK : NS_ERROR_FAILURE; +NS_METHOD Pluglet::GetValue(nsPluginInstanceVariable variable, void *value) { + return NS_ERROR_FAILURE; } -Pluglet::Pluglet(const char *mimeDescription, const char *path) { - jthis = NULL; - this->path = new char[strlen(path)+1]; - strcpy(this->path,path); - this->mimeDescription = new char[strlen(mimeDescription)+1]; - strcpy(this->mimeDescription,mimeDescription); - -} - -Pluglet::~Pluglet(void) { - if (path != NULL) { - delete[] path; - } - if (mimeDescription != NULL) { - delete[] mimeDescription; - } +NS_METHOD Pluglet::SetWindow(nsPluginWindow* window) { JNIEnv *env = PlugletEngine::GetJNIEnv(); - if (env != NULL) { - env->DeleteGlobalRef(jthis); + if (view->SetWindow(window)) { + env->CallVoidMethod(jthis,setWindowMID,view->GetJObject()); } + return NS_OK; } -Pluglet * Pluglet::Load(const char * path) { - char * mime = PlugletLoader::GetMIMEDescription(path); - Pluglet * result = NULL; - if (mime) { - result = new Pluglet(mime,path); - //delete[] mime; //nb we have a strange exception here - } - return result; -} - -/* - 1 if good - 0 if not good - */ -int Pluglet::Compare(const char *mimeType) { - /* mimedDescription mimeTypes:extensions:description - mimeTypes mimeType;mimeType;... - extensions extension;extension;... - */ - if (!mimeType) { - return 0; - } - char * terminator = strchr(mimeDescription,':'); // terminator have to be not equal to NULL; - char *p1 = mimeDescription; - char *p2 = strchr(p1,';'); - while ( p1 != NULL && p1 < terminator ) { - size_t n = sizeof(char) * ( ( (p2 == NULL) ? terminator : p2) - p1 ); - if (PL_strncasecmp(p1,mimeType,n) == 0) { - return 1; - } - p1 = p2 ; - if (p2 != NULL) { - p2 = strchr(++p2,';'); - p1++; - } - } - return 0; +NS_METHOD Pluglet::Print(nsPluginPrint* platformPrint) { + //nb + return NS_OK; } + + + + + + + + diff --git a/java/plugins/src/Pluglet.h b/java/plugins/src/Pluglet.h index 3c7b08cd692..6160cb65ba9 100644 --- a/java/plugins/src/Pluglet.h +++ b/java/plugins/src/Pluglet.h @@ -22,26 +22,35 @@ #define __Pluglet_h__ #include "nsplugin.h" #include "jni.h" +#include "PlugletView.h" -class Pluglet { +class Pluglet : public nsIPluginInstance { public: - nsresult CreatePluginInstance(const char* aPluginMIMEType, void **aResult); - nsresult Initialize(void); - nsresult Shutdown(void); - nsresult GetMIMEDescription(const char* *result); - /*****************************************/ - ~Pluglet(void); - int Compare(const char * mimeType); - static Pluglet * Load(const char * path); + NS_IMETHOD HandleEvent(nsPluginEvent* event, PRBool* handled); + NS_IMETHOD Initialize(nsIPluginInstancePeer* peer); + NS_IMETHOD GetPeer(nsIPluginInstancePeer* *result); + NS_IMETHOD Start(void); + NS_IMETHOD Stop(void); + NS_IMETHOD Destroy(void); + NS_IMETHOD NewStream(nsIPluginStreamListener** listener); + NS_IMETHOD SetWindow(nsPluginWindow* window); + NS_IMETHOD Print(nsPluginPrint* platformPrint); + NS_IMETHOD GetValue(nsPluginInstanceVariable variable, void *value); + NS_DECL_ISUPPORTS + + Pluglet(jobject object); + virtual ~Pluglet(void); private: jobject jthis; - static jmethodID createPlugletInstanceMID; - static jmethodID initializeMID; - static jmethodID shutdownMID; - /*****************************************/ - char *mimeDescription; - char *path; - Pluglet(const char *mimeDescription,const char * path); -}; - + static jmethodID initializeMID; + static jmethodID startMID; + static jmethodID stopMID; + static jmethodID destroyMID; + static jmethodID newStreamMID; + static jmethodID setWindowMID; + static jmethodID printMID; + static jmethodID getValueMID; + nsIPluginInstancePeer *peer; + PlugletView *view; +}; #endif /* __Pluglet_h__ */ diff --git a/java/plugins/src/PlugletEngine.cpp b/java/plugins/src/PlugletEngine.cpp index cd82549f6cc..40d25b91d0a 100644 --- a/java/plugins/src/PlugletEngine.cpp +++ b/java/plugins/src/PlugletEngine.cpp @@ -70,14 +70,14 @@ NS_METHOD PlugletEngine::CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID if (!aResult) { return NS_ERROR_FAILURE; } - Pluglet * pluglet = NULL; + PlugletFactory * plugletFactory = NULL; nsresult res = NS_ERROR_NULL_POINTER; - if ((res = dir->GetPluglet(aPluginMIMEType,&pluglet)) != NS_OK - || !pluglet) { + if ((res = dir->GetPlugletFactory(aPluginMIMEType,&plugletFactory)) != NS_OK + || !plugletFactory) { return res; } //we do not delete pluglet because we do not allocate new memory in dir->GetPluglet() - return pluglet->CreatePluginInstance(aPluginMIMEType,aResult); + return plugletFactory->CreatePluginInstance(aPluginMIMEType,aResult); } NS_METHOD PlugletEngine::GetMIMEDescription(const char* *result) { diff --git a/java/plugins/src/PlugletFactory.cpp b/java/plugins/src/PlugletFactory.cpp new file mode 100644 index 00000000000..707d3065c44 --- /dev/null +++ b/java/plugins/src/PlugletFactory.cpp @@ -0,0 +1,181 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are + * Copyright (C) 1999 Sun Microsystems, Inc. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "PlugletFactory.h" +#include "PlugletEngine.h" +#include "PlugletLoader.h" +#include "Pluglet.h" +#include "string.h" + +jmethodID PlugletFactory::createPlugletMID = NULL; +jmethodID PlugletFactory::initializeMID = NULL; +jmethodID PlugletFactory::shutdownMID = NULL; + + +nsresult PlugletFactory::CreatePluginInstance(const char* aPluginMIMEType, void **aResult) { + if(!aResult + || Initialize() != NS_OK) { + return NS_ERROR_FAILURE; + } + JNIEnv *env = PlugletEngine::GetJNIEnv(); + if(!env) { + return NS_ERROR_FAILURE; + } + jstring jstr = env->NewStringUTF(aPluginMIMEType); + jobject obj = env->CallObjectMethod(jthis,createPlugletMID, jstr); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + nsISupports * instance = new Pluglet(obj); + NS_ADDREF(instance); + *aResult = instance; + return NS_OK; +} + +nsresult PlugletFactory::Initialize(void) { + JNIEnv *env = PlugletEngine::GetJNIEnv(); + if(!env) { + return NS_ERROR_FAILURE; + } + if (!initializeMID) { + jclass clazz = env->FindClass("org/mozilla/pluglet/PlugletFactory"); + if(!clazz) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + createPlugletMID = env->GetMethodID(clazz,"createPluglet","(Ljava/lang/String;)Lorg/mozilla/pluglet/Pluglet;"); + if (!createPlugletMID) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + shutdownMID = env->GetMethodID(clazz,"shutdown","()V"); + if (!shutdownMID) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + initializeMID = env->GetMethodID(clazz,"initialize","(Lorg/mozilla/pluglet/mozilla/PlugletManager;)V"); + if (!initializeMID) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + + } + if (!jthis) { + jthis = PlugletLoader::GetPluglet(path); + if (!jthis) { + return NS_ERROR_FAILURE; + } + env->CallVoidMethod(jthis,initializeMID,PlugletEngine::GetPlugletManager()); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + } + return NS_OK; +} + +nsresult PlugletFactory::Shutdown(void) { + + if(!jthis) { + return NS_ERROR_FAILURE; + } + JNIEnv *env = PlugletEngine::GetJNIEnv(); + if(!env) { + return NS_ERROR_FAILURE; + } + env->CallVoidMethod(jthis,shutdownMID); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + return NS_ERROR_FAILURE; + } + return NS_OK; +} + +nsresult PlugletFactory::GetMIMEDescription(const char* *result) { + if(!result) { + return NS_ERROR_FAILURE; + } + *result = mimeDescription; + return (*result) ? NS_OK : NS_ERROR_FAILURE; +} + +PlugletFactory::PlugletFactory(const char *mimeDescription, const char *path) { + jthis = NULL; + this->path = new char[strlen(path)+1]; + strcpy(this->path,path); + this->mimeDescription = new char[strlen(mimeDescription)+1]; + strcpy(this->mimeDescription,mimeDescription); + +} + +PlugletFactory::~PlugletFactory(void) { + if (path != NULL) { + delete[] path; + } + if (mimeDescription != NULL) { + delete[] mimeDescription; + } + JNIEnv *env = PlugletEngine::GetJNIEnv(); + if (env != NULL) { + env->DeleteGlobalRef(jthis); + } +} + +PlugletFactory * PlugletFactory::Load(const char * path) { + char * mime = PlugletLoader::GetMIMEDescription(path); + PlugletFactory * result = NULL; + if (mime) { + result = new PlugletFactory(mime,path); + //delete[] mime; //nb we have a strange exception here + } + return result; +} + +/* + 1 if good + 0 if not good + */ +int PlugletFactory::Compare(const char *mimeType) { + /* mimedDescription mimeTypes:extensions:description + mimeTypes mimeType;mimeType;... + extensions extension;extension;... + */ + if (!mimeType) { + return 0; + } + char * terminator = strchr(mimeDescription,':'); // terminator have to be not equal to NULL; + char *p1 = mimeDescription; + char *p2 = strchr(p1,';'); + while ( p1 != NULL && p1 < terminator ) { + size_t n = sizeof(char) * ( ( (p2 == NULL) ? terminator : p2) - p1 ); + if (PL_strncasecmp(p1,mimeType,n) == 0) { + return 1; + } + p1 = p2 ; + if (p2 != NULL) { + p2 = strchr(++p2,';'); + p1++; + } + } + return 0; +} + + diff --git a/java/plugins/src/PlugletFactory.h b/java/plugins/src/PlugletFactory.h new file mode 100644 index 00000000000..4e5c1577528 --- /dev/null +++ b/java/plugins/src/PlugletFactory.h @@ -0,0 +1,47 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are + * Copyright (C) 1999 Sun Microsystems, Inc. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef __PlugletFactory_h__ +#define __PlugletFactory_h__ +#include "nsplugin.h" +#include "jni.h" + +class PlugletFactory { + public: + nsresult CreatePluginInstance(const char* aPluginMIMEType, void **aResult); + nsresult Initialize(void); + nsresult Shutdown(void); + nsresult GetMIMEDescription(const char* *result); + /*****************************************/ + ~PlugletFactory(void); + int Compare(const char * mimeType); + static PlugletFactory * Load(const char * path); + private: + jobject jthis; + static jmethodID createPlugletMID; + static jmethodID initializeMID; + static jmethodID shutdownMID; + /*****************************************/ + char *mimeDescription; + char *path; + PlugletFactory(const char *mimeDescription,const char * path); +}; + +#endif /* __PlugletFactory_h__ */ diff --git a/java/plugins/src/PlugletInstance.cpp b/java/plugins/src/PlugletInstance.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/src/PlugletInstance.h b/java/plugins/src/PlugletInstance.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/src/PlugletInstancePeer.cpp b/java/plugins/src/PlugletInstancePeer.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/src/PlugletInstancePeer.h b/java/plugins/src/PlugletInstancePeer.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/src/PlugletInstanceView.cpp b/java/plugins/src/PlugletInstanceView.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/src/PlugletInstanceView.h b/java/plugins/src/PlugletInstanceView.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/src/PlugletList.cpp b/java/plugins/src/PlugletList.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/src/PlugletList.h b/java/plugins/src/PlugletList.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/plugins/src/PlugletLoader.cpp b/java/plugins/src/PlugletLoader.cpp index b002e1573c6..56d9524ffcd 100644 --- a/java/plugins/src/PlugletLoader.cpp +++ b/java/plugins/src/PlugletLoader.cpp @@ -59,7 +59,7 @@ void PlugletLoader::Initialize(void) { clazz = NULL; return; } - getPlugletMID = env->GetStaticMethodID(clazz,"getPluglet","(Ljava/lang/String;)Lorg/mozilla/pluglet/Pluglet;"); + getPlugletMID = env->GetStaticMethodID(clazz,"getPluglet","(Ljava/lang/String;)Lorg/mozilla/pluglet/PlugletFactory;"); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); clazz = NULL; diff --git a/java/plugins/src/PlugletPeer.cpp b/java/plugins/src/PlugletPeer.cpp new file mode 100644 index 00000000000..b17454238eb --- /dev/null +++ b/java/plugins/src/PlugletPeer.cpp @@ -0,0 +1,69 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are + * Copyright (C) 1999 Sun Microsystems, Inc. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "nsISupports.h" +#include "PlugletPeer.h" +#include "PlugletEngine.h" + +jclass PlugletPeer::clazz = NULL; +jmethodID PlugletPeer::initMID = NULL; + +void PlugletPeer::Initialize(void) { + JNIEnv * env = PlugletEngine::GetJNIEnv(); + clazz = env->FindClass("org/mozilla/pluglet/mozilla/PlugletPeerImpl"); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + clazz = NULL; + return; + } + clazz = (jclass) env->NewGlobalRef(clazz); + initMID = env->GetMethodID(clazz,"","(J)V"); + if (env->ExceptionOccurred() + || !initMID) { + env->ExceptionDescribe(); + clazz = NULL; + return; + } +} + +void PlugletPeer::Destroy(void) { + //nb who gonna cal it? + JNIEnv * env = PlugletEngine::GetJNIEnv(); + if(clazz) { + env->DeleteGlobalRef(clazz); + } +} + +jobject PlugletPeer::GetJObject(const nsIPluginInstancePeer *peer) { + jobject res = NULL; + JNIEnv *env = PlugletEngine::GetJNIEnv(); + if(!clazz) { + Initialize(); + if (! clazz) { + return NULL; + } + } + res = env->NewObject(clazz,initMID,(jlong)peer); + if (env->ExceptionOccurred()) { + env->ExceptionDescribe(); + res = NULL; + } + return res; +} diff --git a/java/plugins/src/PlugletPeer.h b/java/plugins/src/PlugletPeer.h new file mode 100644 index 00000000000..da3adc892ad --- /dev/null +++ b/java/plugins/src/PlugletPeer.h @@ -0,0 +1,35 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are + * Copyright (C) 1999 Sun Microsystems, Inc. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef __PlugletPeer_h__ +#define __PlugletPeer_h__ +#include "nsIPluginInstancePeer.h" +#include "jni.h" + +class PlugletPeer { + public: + static jobject GetJObject(const nsIPluginInstancePeer *instancePeer); + private: + static void Initialize(void); + static void Destroy(void); + static jclass clazz; + static jmethodID initMID; +}; +#endif /* __PlugletPeer_h__ */ diff --git a/java/plugins/classes/org/mozilla/pluglet/PlugletInstance.java b/java/plugins/src/PlugletView.cpp similarity index 100% rename from java/plugins/classes/org/mozilla/pluglet/PlugletInstance.java rename to java/plugins/src/PlugletView.cpp diff --git a/java/plugins/src/PlugletView.h b/java/plugins/src/PlugletView.h new file mode 100644 index 00000000000..d83479f0adc --- /dev/null +++ b/java/plugins/src/PlugletView.h @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are + * Copyright (C) 1999 Sun Microsystems, Inc. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef __PlugletView_h__ +#define __PlugletView_h__ +#include +#include "nsplugindefs.h" +#include "jni.h" + +class PlugletView { + public: + PlugletView(void); + jobject GetJObject(void); + BOOLEAN SetWindow(nsPluginWindow* window); + private: + static void Initialize(void); + static jclass clazz; + static jmethodID initMID; + HWND hWND; + BOOL isCreated; + jobject frame; +}; +#endif /* __PlugletInstanceView_h__ */ + + + + + + + + + + diff --git a/java/plugins/src/PlugletsDir.cpp b/java/plugins/src/PlugletsDir.cpp index 97882ce5668..e7e2326aa3f 100644 --- a/java/plugins/src/PlugletsDir.cpp +++ b/java/plugins/src/PlugletsDir.cpp @@ -28,7 +28,7 @@ PlugletsDir::PlugletsDir(void) { PlugletsDir::~PlugletsDir(void) { if (list) { - for (PlugletListIterator *iter = list->GetIterator();iter->Get();delete iter->Get(),iter->Next()) + for (ListIterator *iter = list->GetIterator();iter->Get();delete iter->Get(),iter->Next()) ; delete list; } @@ -36,10 +36,10 @@ PlugletsDir::~PlugletsDir(void) { void PlugletsDir::LoadPluglets() { if (!list) { - list = new PlugletList(); + list = new List(); char * path = PR_GetEnv("PLUGLET"); int pathLength = strlen(path); - Pluglet *pluglet; + PlugletFactory *plugletFactory; nsFileSpec dir(path); for (nsDirectoryIterator iter(dir,PR_TRUE); iter.Exists(); iter++) { const nsFileSpec& file = iter; @@ -49,25 +49,25 @@ void PlugletsDir::LoadPluglets() { || strcmp(name+length - 4,".jar") ) { continue; } - if ( (pluglet = Pluglet::Load(name)) ) { - list->Add(pluglet); + if ( (plugletFactory = PlugletFactory::Load(name)) ) { + list->Add(plugletFactory); } } } } -nsresult PlugletsDir::GetPluglet(const char * mimeType, Pluglet **pluglet) { - if(!pluglet) { +nsresult PlugletsDir::GetPlugletFactory(const char * mimeType, PlugletFactory **plugletFactory) { + if(!plugletFactory) { return NS_ERROR_NULL_POINTER; } - *pluglet = NULL; + *plugletFactory = NULL; nsresult res = NS_ERROR_FAILURE; if(!list) { LoadPluglets(); } - for (PlugletListIterator *iter = list->GetIterator();iter->Get();iter->Next()) { - if(iter->Get()->Compare(mimeType)) { - *pluglet = iter->Get(); + for (ListIterator *iter = list->GetIterator();iter->Get();iter->Next()) { + if(((PlugletFactory*)(iter->Get()))->Compare(mimeType)) { + *plugletFactory = (PlugletFactory*)iter->Get(); res = NS_OK; break; } diff --git a/java/plugins/src/PlugletsDir.h b/java/plugins/src/PlugletsDir.h index b85ffcd70de..b2dab055a83 100644 --- a/java/plugins/src/PlugletsDir.h +++ b/java/plugins/src/PlugletsDir.h @@ -20,8 +20,8 @@ */ #ifndef __PlugletsDir_h__ #define __PlugletsDir_h__ -#include "Pluglet.h" -#include "PlugletList.h" +#include "PlugletFactory.h" +#include "List.h" class PlugletsDir { friend class PlugletsDirIterator; @@ -29,9 +29,9 @@ class PlugletsDir { PlugletsDir(void); ~PlugletsDir(void); void LoadPluglets(); - nsresult GetPluglet(const char * mimeType,Pluglet **pluglet); + nsresult GetPlugletFactory(const char * mimeType,PlugletFactory **plugletFactory); private: - PlugletList * list; + List * list; }; #endif /* __PlugletsDir_h__ */ diff --git a/java/plugins/src/makefile.win b/java/plugins/src/makefile.win index 535dfec0e36..f1161c9f54d 100644 --- a/java/plugins/src/makefile.win +++ b/java/plugins/src/makefile.win @@ -53,16 +53,16 @@ REQUIRES = java plug xpcom raptor OBJS = \ .\$(OBJDIR)\Pluglet.obj \ .\$(OBJDIR)\PlugletEngine.obj \ - .\$(OBJDIR)\PlugletList.obj \ + .\$(OBJDIR)\List.obj \ .\$(OBJDIR)\PlugletLoader.obj \ .\$(OBJDIR)\PlugletsDir.obj \ - .\$(OBJDIR)\PlugletInstance.obj \ + .\$(OBJDIR)\PlugletFactory.obj \ .\$(OBJDIR)\PlugletStreamListener.obj \ .\$(OBJDIR)\PlugletStreamInfo.obj \ - .\$(OBJDIR)\PlugletInstancePeer.obj \ + .\$(OBJDIR)\PlugletPeer.obj \ .\$(OBJDIR)\PlugletManager.obj \ .\$(OBJDIR)\PlugletInputStream.obj \ - .\$(OBJDIR)\PlugletInstanceView.obj \ + .\$(OBJDIR)\PlugletView.obj \ !ifndef OJI_DISABLE .\$(OBJDIR)\PlugletSecurityContext.obj \ !endif diff --git a/java/plugins/test/test.java b/java/plugins/test/test.java index c3da2bccfa5..71fab3fd88e 100644 --- a/java/plugins/test/test.java +++ b/java/plugins/test/test.java @@ -25,7 +25,7 @@ import java.awt.event.*; import java.awt.print.*; import java.io.*; -public class test implements Pluglet { +public class test implements PlugletFactory { public test() { org.mozilla.util.Debug.print("--test.test()\n"); } @@ -34,7 +34,7 @@ public class test implements Pluglet { * allows different impelementations to be created depending on * the specified MIME type. */ - public PlugletInstance createPlugletInstance(String mimeType) { + public Pluglet createPluglet(String mimeType) { org.mozilla.util.Debug.print("--test.createPlugletInstance\n"); return new TestInstance(); } @@ -54,11 +54,11 @@ public class test implements Pluglet { } } -class TestInstance implements PlugletInstance { +class TestInstance implements Pluglet { Panel panel; Button button; List list; - PlugletInstancePeer peer; + PlugletPeer peer; public TestInstance() { org.mozilla.util.Debug.print("--TestInstance.TestInstance() \n"); panel = new Panel(); @@ -89,7 +89,7 @@ class TestInstance implements PlugletInstance { * @param peer the corresponding pluglet instance peer */ - public void initialize(PlugletInstancePeer peer) { + public void initialize(PlugletPeer peer) { this.peer = peer; org.mozilla.util.Debug.print("--TestInstance.initialize\n"); peer.showStatus("Hello world"); @@ -131,6 +131,7 @@ class TestInstance implements PlugletInstance { * window containing this page in the history is being closed. */ public void destroy() { + org.mozilla.util.Debug.print("--TestInstance.destroy\n"); } /** * Called to tell the pluglet that the initial src/data stream is