Compare commits
6 Commits
src
...
OJINetwork
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cee4e9073 | ||
|
|
93a3bbce56 | ||
|
|
e0dd53369a | ||
|
|
6c8b3ae9ee | ||
|
|
283fb8c0df | ||
|
|
9348bf6f5d |
31
mozilla/modules/oji/Makefile
Normal file
31
mozilla/modules/oji/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the MODULES/OJI tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH=../..
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
|
||||
#// (these must come before the common makefiles are included)
|
||||
#//
|
||||
#// DIRS - There are subdirectories to process
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DIRS= public src
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
36
mozilla/modules/oji/Makefile.in
Normal file
36
mozilla/modules/oji/Makefile.in
Normal file
@@ -0,0 +1,36 @@
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the MODULES/OJI tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH=../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
|
||||
#// (these must come before the common makefiles are included)
|
||||
#//
|
||||
#// DIRS - There are subdirectories to process
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DIRS= public src
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
9
mozilla/modules/oji/macbuild/oji.Prefix
Normal file
9
mozilla/modules/oji/macbuild/oji.Prefix
Normal file
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// oji.Prefix
|
||||
//
|
||||
// Global prefix file for the oji.shlb target.
|
||||
//
|
||||
//
|
||||
|
||||
#include "MacPrefix.h"
|
||||
#include "ojiConfig.h"
|
||||
BIN
mozilla/modules/oji/macbuild/oji.mcp
Normal file
BIN
mozilla/modules/oji/macbuild/oji.mcp
Normal file
Binary file not shown.
9
mozilla/modules/oji/macbuild/ojiConfig.h
Normal file
9
mozilla/modules/oji/macbuild/ojiConfig.h
Normal file
@@ -0,0 +1,9 @@
|
||||
/* #define EDITOR 1
|
||||
|
||||
#include "NSCrossProductDefines.h"
|
||||
#include "IDE_Options.h"
|
||||
|
||||
#define JAVA
|
||||
|
||||
#define MOZILLA_CLIENT 1 */
|
||||
|
||||
8
mozilla/modules/oji/macbuild/ojiDebug.Prefix
Normal file
8
mozilla/modules/oji/macbuild/ojiDebug.Prefix
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// ojiDebug.Prefix
|
||||
//
|
||||
// Global prefix file for the ojiDebug.shlb target.
|
||||
//
|
||||
|
||||
#include "MacPrefix_debug.h"
|
||||
#include "ojiConfig.h"
|
||||
30
mozilla/modules/oji/makefile.win
Normal file
30
mozilla/modules/oji/makefile.win
Normal file
@@ -0,0 +1,30 @@
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the MODULES\APPLET tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH=..\..
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
|
||||
#// (these must come before the common makefiles are included)
|
||||
#//
|
||||
#// DIRS - There are subdirectories to process
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DIRS= public src
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
30
mozilla/modules/oji/public/MANIFEST
Normal file
30
mozilla/modules/oji/public/MANIFEST
Normal file
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsIJRIPlugin.h
|
||||
nsIJVMConsole.h
|
||||
nsIJVMManager.h
|
||||
nsIJVMPlugin.h
|
||||
nsIJVMPluginInstance.h
|
||||
nsIJVMPluginTagInfo.h
|
||||
nsISymantecDebugger.h
|
||||
nsISymantecDebugManager.h
|
||||
nsjvm.h
|
||||
33
mozilla/modules/oji/public/Makefile
Normal file
33
mozilla/modules/oji/public/Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
MODULE = oji
|
||||
|
||||
EXPORTS = \
|
||||
nsjvm.h \
|
||||
nsIJRIPlugin.h \
|
||||
nsIJVMConsole.h \
|
||||
nsIJVMManager.h \
|
||||
nsIJVMPlugin.h \
|
||||
nsIJVMPluginInstance.h \
|
||||
nsIJVMPluginTagInfo.h \
|
||||
nsISymantecDebugManager.h \
|
||||
nsISymantecDebugger.h
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
@@ -1,4 +1,3 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
@@ -14,21 +13,28 @@
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH=../..
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
MODULE = oji
|
||||
|
||||
EXPORTS = \
|
||||
nsjvm.h \
|
||||
nsIJRIPlugin.h \
|
||||
nsIJVMConsole.h \
|
||||
nsIJVMManager.h \
|
||||
nsIJVMPlugin.h \
|
||||
nsIJVMPluginInstance.h \
|
||||
nsIJVMPluginTagInfo.h \
|
||||
nsISymantecDebugManager.h \
|
||||
nsISymantecDebugger.h
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
EXPORT_RESOURCE_XPINSTALL = \
|
||||
$(srcdir)/progress.xul \
|
||||
$(srcdir)/progress.html \
|
||||
$(srcdir)/progress.css \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
$(INSTALL) $(EXPORT_RESOURCE_XPINSTALL) $(DIST)/bin/res/xpinstall
|
||||
@@ -1,4 +1,4 @@
|
||||
#!nmake
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
@@ -15,17 +15,22 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
DEPTH = ..\..\..
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) progress.xul $(DIST)\bin\res\xpinstall
|
||||
$(MAKE_INSTALL) progress.css $(DIST)\bin\res\xpinstall
|
||||
$(MAKE_INSTALL) progress.html $(DIST)\bin\res\xpinstall
|
||||
MODULE = oji
|
||||
|
||||
EXPORTS = \
|
||||
nsjvm.h \
|
||||
nsIJRIPlugin.h \
|
||||
nsIJVMConsole.h \
|
||||
nsIJVMManager.h \
|
||||
nsIJVMPlugin.h \
|
||||
nsIJVMPluginInstance.h \
|
||||
nsIJVMPluginTagInfo.h \
|
||||
nsISymantecDebugManager.h \
|
||||
nsISymantecDebugger.h
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\res\xpinstall\progress.xul
|
||||
rm -f $(DIST)\res\xpinstall\progress.css
|
||||
rm -f $(DIST)\res\xpinstall\progress.html
|
||||
66
mozilla/modules/oji/public/nsIJRIPlugin.h
Normal file
66
mozilla/modules/oji/public/nsIJRIPlugin.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
|
||||
//
|
||||
// This interface allows a Java virtual machine to be plugged into
|
||||
// Communicator to implement the APPLET tag and host applets.
|
||||
//
|
||||
// Note that this is the C++ interface that the plugin sees. The browser
|
||||
// uses a specific implementation of this, nsJVMPlugin, found in jvmmgr.h.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJRIPlugin_h___
|
||||
#define nsIJRIPlugin_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "jri.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// JRI Plugin Class Interface
|
||||
// This interface is provided for backward compatibility for the Netscape JVM.
|
||||
|
||||
class nsIJRIPlugin : public nsISupports {
|
||||
public:
|
||||
|
||||
// QueryInterface on nsIJVMPlugin to get this.
|
||||
|
||||
// Find or create a JRIEnv for the current thread.
|
||||
// Returns NULL if an error occurs.
|
||||
NS_IMETHOD_(nsrefcnt)
|
||||
GetJRIEnv(JRIEnv* *result) = 0;
|
||||
|
||||
// This method must be called when the caller is done using the JRIEnv.
|
||||
// This decrements a refcount associated with it may free it.
|
||||
NS_IMETHOD_(nsrefcnt)
|
||||
ReleaseJRIEnv(JRIEnv* env) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IJRIPLUGIN_IID \
|
||||
{ /* bfe2d7d0-0164-11d2-815b-006008119d7a */ \
|
||||
0xbfe2d7d0, \
|
||||
0x0164, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJRIPlugin_h___ */
|
||||
71
mozilla/modules/oji/public/nsIJVMConsole.h
Normal file
71
mozilla/modules/oji/public/nsIJVMConsole.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
|
||||
//
|
||||
// This interface allows a Java virtual machine to be plugged into
|
||||
// Communicator to implement the APPLET tag and host applets.
|
||||
//
|
||||
// Note that this is the C++ interface that the plugin sees. The browser
|
||||
// uses a specific implementation of this, nsJVMPlugin, found in jvmmgr.h.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJVMConsole_h___
|
||||
#define nsIJVMConsole_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// JVM Console Interface
|
||||
// This interface defines the API the browser needs to show and hide the JVM's
|
||||
// Java console, and to send text to it.
|
||||
|
||||
class nsIJVMConsole : public nsISupports {
|
||||
public:
|
||||
|
||||
// QueryInterface on nsIJVMPlugin to get this.
|
||||
|
||||
NS_IMETHOD
|
||||
ShowConsole(void) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
HideConsole(void) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
IsConsoleVisible(PRBool *result) = 0;
|
||||
|
||||
// Prints a message to the Java console. The encodingName specifies the
|
||||
// encoding of the message, and if NULL, specifies the default platform
|
||||
// encoding.
|
||||
NS_IMETHOD
|
||||
Print(const char* msg, const char* encodingName = NULL) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IJVMCONSOLE_IID \
|
||||
{ /* 85344580-01c1-11d2-815b-006008119d7a */ \
|
||||
0x85344580, \
|
||||
0x01c1, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJVMConsole_h___ */
|
||||
68
mozilla/modules/oji/public/nsIJVMManager.h
Normal file
68
mozilla/modules/oji/public/nsIJVMManager.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
|
||||
//
|
||||
// This interface allows a Java virtual machine to be plugged into
|
||||
// Communicator to implement the APPLET tag and host applets.
|
||||
//
|
||||
// Note that this is the C++ interface that the plugin sees. The browser
|
||||
// uses a specific implementation of this, nsJVMPlugin, found in jvmmgr.h.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJVMManager_h___
|
||||
#define nsIJVMManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NPJVM_MIME_TYPE "application/x-java-vm" // XXX application/java
|
||||
|
||||
enum {
|
||||
NS_JVM_ERROR_BASE = NS_ERROR_BASE + 0x10000,
|
||||
NS_JVM_ERROR_NO_CLASSES,
|
||||
NS_JVM_ERROR_WRONG_CLASSES,
|
||||
NS_JVM_ERROR_JAVA_ERROR,
|
||||
NS_JVM_ERROR_NO_DEBUGGER
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Java VM Plugin Manager
|
||||
// This interface defines additional entry points that are available
|
||||
// to JVM plugins for browsers that support JVM plugins.
|
||||
|
||||
class nsIJVMPlugin;
|
||||
|
||||
class nsIJVMManager : public nsISupports {
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
#define NS_IJVMMANAGER_IID \
|
||||
{ /* a1e5ed50-aa4a-11d1-85b2-00805f0e4dfe */ \
|
||||
0xa1e5ed50, \
|
||||
0xaa4a, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb2, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJVMManager_h___ */
|
||||
128
mozilla/modules/oji/public/nsIJVMPlugin.h
Normal file
128
mozilla/modules/oji/public/nsIJVMPlugin.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
|
||||
//
|
||||
// This interface allows a Java virtual machine to be plugged into
|
||||
// Communicator to implement the APPLET tag and host applets.
|
||||
//
|
||||
// Note that this is the C++ interface that the plugin sees. The browser
|
||||
// uses a specific implementation of this, nsJVMPlugin, found in jvmmgr.h.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJVMPlugin_h___
|
||||
#define nsIJVMPlugin_h___
|
||||
|
||||
#include "nsIPlugin.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "jni.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Java VM Plugin Interface
|
||||
// This interface defines additional entry points that a plugin developer needs
|
||||
// to implement in order to implement a Java virtual machine plugin.
|
||||
|
||||
struct nsJVMInitArgs {
|
||||
PRUint32 version;
|
||||
const char* classpathAdditions; // appended to the JVM's classpath
|
||||
// other fields may be added here for version numbers beyond 0x00010000
|
||||
};
|
||||
|
||||
/**
|
||||
* nsJVMInitArgs_Version is the current version number for the nsJVMInitArgs
|
||||
* struct specified above. The nsVersionOk macro should be used when comparing
|
||||
* a supplied nsJVMInitArgs struct against this version.
|
||||
*/
|
||||
#define nsJVMInitArgs_Version 0x00010000L
|
||||
|
||||
|
||||
class nsIJVMPlugin : public nsIPlugin {
|
||||
public:
|
||||
|
||||
// This method us used to start the Java virtual machine.
|
||||
// It sets up any global state necessary to host Java programs.
|
||||
// Note that calling this method is distinctly separate from
|
||||
// initializing the nsIJVMPlugin object (done by the Initialize
|
||||
// method).
|
||||
NS_IMETHOD
|
||||
StartupJVM(nsJVMInitArgs* initargs) = 0;
|
||||
|
||||
// This method us used to stop the Java virtual machine.
|
||||
// It tears down any global state necessary to host Java programs.
|
||||
// The fullShutdown flag specifies whether the browser is quitting
|
||||
// (PR_TRUE) or simply whether the JVM is being shut down (PR_FALSE).
|
||||
NS_IMETHOD
|
||||
ShutdownJVM(PRBool fullShutdown = PR_FALSE) = 0;
|
||||
|
||||
// Causes the JVM to append a new directory to its classpath.
|
||||
// If the JVM doesn't support this operation, an error is returned.
|
||||
NS_IMETHOD
|
||||
AddToClassPath(const char* dirPath) = 0;
|
||||
|
||||
// Causes the JVM to remove a directory from its classpath.
|
||||
// If the JVM doesn't support this operation, an error is returned.
|
||||
NS_IMETHOD
|
||||
RemoveFromClassPath(const char* dirPath) = 0;
|
||||
|
||||
// Returns the current classpath in use by the JVM.
|
||||
NS_IMETHOD
|
||||
GetClassPath(const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetJavaWrapper(JNIEnv* jenv, jint obj, jobject *jobj) = 0;
|
||||
|
||||
#if 0 // still trying to decide on this
|
||||
// nsIPrincipals is a array of pointers to principals associated with this
|
||||
// java object trying to run a JS script.
|
||||
NS_IMETHOD
|
||||
GetPrincipalArray(JNIEnv *pJNIEnv, PRInt32 frameIndex, nsIPrincipal ***principalArray, PRInt32 *length) = 0;
|
||||
#endif
|
||||
|
||||
// Find or create a JNIEnv for the current thread.
|
||||
// Returns NULL if an error occurs.
|
||||
NS_IMETHOD_(nsrefcnt)
|
||||
GetJNIEnv(JNIEnv* *result) = 0;
|
||||
|
||||
// This method must be called when the caller is done using the JNIEnv.
|
||||
// This decrements a refcount associated with it may free it.
|
||||
NS_IMETHOD_(nsrefcnt)
|
||||
ReleaseJNIEnv(JNIEnv* env) = 0;
|
||||
|
||||
#ifdef XP_MAC
|
||||
// beard: since only my plugin has implemented this so far, I'll leave it conditional for now.
|
||||
/**
|
||||
* Gives time to the JVM from the main event loop of the browser. This is
|
||||
* necessary when there aren't any plugin instances around, but Java threads exist.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
SpendTime(PRUint32 timeMillis) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define NS_IJVMPLUGIN_IID \
|
||||
{ /* da6f3bc0-a1bc-11d1-85b1-00805f0e4dfe */ \
|
||||
0xda6f3bc0, \
|
||||
0xa1bc, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJVMPlugin_h___ */
|
||||
59
mozilla/modules/oji/public/nsIJVMPluginInstance.h
Normal file
59
mozilla/modules/oji/public/nsIJVMPluginInstance.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
|
||||
//
|
||||
// This interface allows a Java virtual machine to be plugged into
|
||||
// Communicator to implement the APPLET tag and host applets.
|
||||
//
|
||||
// Note that this is the C++ interface that the plugin sees. The browser
|
||||
// uses a specific implementation of this, nsJVMPlugin, found in jvmmgr.h.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJVMPluginInstance_h___
|
||||
#define nsIJVMPluginInstance_h___
|
||||
|
||||
#include "nsIPluginInstance.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Java VM Plugin Instance Interface
|
||||
|
||||
class nsIJVMPluginInstance : public nsIPluginInstance {
|
||||
public:
|
||||
|
||||
// This method is called when LiveConnect wants to find the Java object
|
||||
// associated with this plugin instance, e.g. the Applet or JavaBean object.
|
||||
NS_IMETHOD
|
||||
GetJavaObject(jobject *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetText(const char* *result) = 0;
|
||||
};
|
||||
|
||||
#define NS_IJVMPLUGININSTANCE_IID \
|
||||
{ /* a0c057d0-01c1-11d2-815b-006008119d7a */ \
|
||||
0xa0c057d0, \
|
||||
0x01c1, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJVMPluginInstance_h___ */
|
||||
69
mozilla/modules/oji/public/nsIJVMPluginTagInfo.h
Normal file
69
mozilla/modules/oji/public/nsIJVMPluginTagInfo.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
|
||||
//
|
||||
// This interface allows a Java virtual machine to be plugged into
|
||||
// Communicator to implement the APPLET tag and host applets.
|
||||
//
|
||||
// Note that this is the C++ interface that the plugin sees. The browser
|
||||
// uses a specific implementation of this, nsJVMPlugin, found in jvmmgr.h.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJVMPluginTagInfo_h___
|
||||
#define nsIJVMPluginTagInfo_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Java VM Plugin Instance Peer Interface
|
||||
// This interface provides additional hooks into the plugin manager that allow
|
||||
// a plugin to implement the plugin manager's Java virtual machine.
|
||||
|
||||
class nsIJVMPluginTagInfo : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
GetCode(const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetCodeBase(const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetArchive(const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetName(const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetMayScript(PRBool *result) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IJVMPLUGINTAGINFO_IID \
|
||||
{ /* 27b42df0-a1bd-11d1-85b1-00805f0e4dfe */ \
|
||||
0x27b42df0, \
|
||||
0xa1bd, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJVMPluginTagInfo_h___ */
|
||||
56
mozilla/modules/oji/public/nsISymantecDebugManager.h
Normal file
56
mozilla/modules/oji/public/nsISymantecDebugManager.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS FOR SYMANTEC DEBUGGER
|
||||
//
|
||||
// This interface allows the browser to initialize a JVM that supports a
|
||||
// debugger. It's called the "Symantec Debugger Interface" because it currently
|
||||
// provides access to the Symantec Cafe or Visual Cafe debugger in the Netscape
|
||||
// JVM. It is not meant to be the be-all-to-end-all of debugger interfaces.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsISymantecDebugManager_h___
|
||||
#define nsISymantecDebugManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Symantec Debug Manager Interface
|
||||
//
|
||||
// Implemented by the browser that supports the Symantec debugger.
|
||||
|
||||
class nsISymantecDebugManager : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
SetDebugAgentPassword(PRInt32 pwd) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ISYMANTECDEBUGMANAGER_IID \
|
||||
{ /* 131362e0-d985-11d1-8155-006008119d7a */ \
|
||||
0x131362e0, \
|
||||
0xd985, \
|
||||
0x11d1, \
|
||||
{0x81, 0x55, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsISymantecDebugManager_h___ */
|
||||
62
mozilla/modules/oji/public/nsISymantecDebugger.h
Normal file
62
mozilla/modules/oji/public/nsISymantecDebugger.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS FOR SYMANTEC DEBUGGER
|
||||
//
|
||||
// This interface allows the browser to initialize a JVM that supports a
|
||||
// debugger. It's called the "Symantec Debugger Interface" because it currently
|
||||
// provides access to the Symantec Cafe or Visual Cafe debugger in the Netscape
|
||||
// JVM. It is not meant to be the be-all-to-end-all of debugger interfaces.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsISymantecDebugger_h___
|
||||
#define nsISymantecDebugger_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Symantec Debugger Interface
|
||||
//
|
||||
// Implemented by the JVM plugin that supports the Symantec debugger.
|
||||
|
||||
enum nsSymantecDebugPort {
|
||||
nsSymantecDebugPort_None = 0,
|
||||
nsSymantecDebugPort_SharedMemory = -1
|
||||
// anything else is a port number
|
||||
};
|
||||
|
||||
class nsISymantecDebugger : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
StartDebugger(nsSymantecDebugPort port) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ISYMANTECDEBUGGER_IID \
|
||||
{ /* 954399f0-d980-11d1-8155-006008119d7a */ \
|
||||
0x954399f0, \
|
||||
0xd980, \
|
||||
0x11d1, \
|
||||
{0x81, 0x55, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsISymantecDebugger_h___ */
|
||||
46
mozilla/modules/oji/public/nsjvm.h
Normal file
46
mozilla/modules/oji/public/nsjvm.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
|
||||
//
|
||||
// This interface allows a Java virtual machine to be plugged into
|
||||
// Communicator to implement the APPLET tag and host applets.
|
||||
//
|
||||
// Note that this is the C++ interface that the plugin sees. The browser
|
||||
// uses a specific implementation of this, nsJVMPlugin, found in jvmmgr.h.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsjvm_h___
|
||||
#define nsjvm_h___
|
||||
|
||||
#include "nsplugin.h"
|
||||
#include "nsIJRIPlugin.h"
|
||||
#include "nsIJVMConsole.h"
|
||||
#include "nsIJVMManager.h"
|
||||
#include "nsIJVMPlugin.h"
|
||||
#include "nsIJVMPluginInstance.h"
|
||||
#include "nsIJVMPluginTagInfo.h"
|
||||
#include "nsISymantecDebugManager.h"
|
||||
#include "nsISymantecDebugger.h"
|
||||
#include "nsICapsManager.h"
|
||||
#include "nsILiveconnect.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsjvm_h___ */
|
||||
@@ -2,5 +2,4 @@
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsISoftwareUpdate.h
|
||||
nsSoftwareUpdateIIDs.h
|
||||
jvmmgr.h
|
||||
29
mozilla/modules/oji/src/Makefile
Normal file
29
mozilla/modules/oji/src/Makefile
Normal file
@@ -0,0 +1,29 @@
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build OJI
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
MODULE = ojiimpl
|
||||
|
||||
ifdef MOZ_OJI
|
||||
LIBRARY_NAME = oji
|
||||
|
||||
CPPSRCS = jvmmgr.cpp \
|
||||
lcglue.cpp \
|
||||
scd.cpp
|
||||
|
||||
REQUIRES = img java js lay layer plugin plugimpl pref style util xpcom raptor oji caps
|
||||
LCFLAGS += -DJSJDLL=\"$(JSJDLL)\"
|
||||
INCLUDES += -I$(DIST)/include/private
|
||||
|
||||
endif # MOZ_OJI
|
||||
|
||||
EXPORTS = jvmmgr.h
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
35
mozilla/modules/oji/src/Makefile.in
Normal file
35
mozilla/modules/oji/src/Makefile.in
Normal file
@@ -0,0 +1,35 @@
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build OJI
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
MODULE = ojiimpl
|
||||
|
||||
ifdef MOZ_OJI
|
||||
LIBRARY_NAME = oji
|
||||
|
||||
CPPSRCS = jvmmgr.cpp \
|
||||
lcglue.cpp \
|
||||
scd.cpp
|
||||
|
||||
REQUIRES = img java js lay layer plugin plugimpl pref style util xpcom raptor oji caps
|
||||
LCFLAGS += -DJSJDLL=\"$(JSJDLL)\"
|
||||
INCLUDES += -I$(DIST)/include/private
|
||||
endif # MOZ_OJI
|
||||
|
||||
EXPORTS = jvmmgr.h
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
7
mozilla/modules/oji/src/export.mac
Normal file
7
mozilla/modules/oji/src/export.mac
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# This is a list of files to be copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsjvm.h
|
||||
nsscd.h
|
||||
jvmmgr.h
|
||||
1023
mozilla/modules/oji/src/jvmmgr.cpp
Normal file
1023
mozilla/modules/oji/src/jvmmgr.cpp
Normal file
File diff suppressed because it is too large
Load Diff
241
mozilla/modules/oji/src/jvmmgr.h
Normal file
241
mozilla/modules/oji/src/jvmmgr.h
Normal file
@@ -0,0 +1,241 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jvmmgr_h___
|
||||
#define jvmmgr_h___
|
||||
|
||||
#include "xp_core.h" /* include first because of Bool problem */
|
||||
#include "prtypes.h"
|
||||
#include "nsCom.h"
|
||||
#include "nsError.h" /* for nsresult */
|
||||
#include "jni.h"
|
||||
|
||||
struct nsJVMMgr;
|
||||
|
||||
typedef enum nsJVMStatus {
|
||||
nsJVMStatus_Enabled, /* but not Running */
|
||||
nsJVMStatus_Disabled, /* explicitly disabled */
|
||||
nsJVMStatus_Running, /* enabled and started */
|
||||
nsJVMStatus_Failed /* enabled but failed to start */
|
||||
} nsJVMStatus;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "nsjvm.h"
|
||||
#include "nsAgg.h"
|
||||
#include "jsjava.h"
|
||||
#include "nsVector.h"
|
||||
|
||||
class nsIPluginTagInfo2;
|
||||
class nsSymantecDebugManager;
|
||||
|
||||
struct ThreadLocalStorageAtIndex0 {
|
||||
PRUint32 refcount;
|
||||
};
|
||||
typedef struct ThreadLocalStorageAtIndex0 ThreadLocalStorageAtIndex0;
|
||||
|
||||
/*******************************************************************************
|
||||
* JVMMgr is the interface to the JVM manager that the browser sees. All
|
||||
* files that want to include java services should include this header file.
|
||||
* nsIJVMManager is the more limited interface what the JVM plugin sees.
|
||||
******************************************************************************/
|
||||
|
||||
struct nsJVMMgr : public nsIJVMManager {
|
||||
public:
|
||||
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
/* from nsIJVMManager: */
|
||||
|
||||
/* JVMMgr specific methods: */
|
||||
|
||||
/* ====> From here on are things only called by the browser, not the plugin... */
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
|
||||
nsIJVMPlugin* GetJVMPlugin(void) { return fJVM; }
|
||||
|
||||
/* Unlike the nsIJVMPlugin::StartupJVM, this version handles putting
|
||||
* up any error dialog: */
|
||||
nsJVMStatus StartupJVM(void);
|
||||
nsJVMStatus ShutdownJVM(PRBool fullShutdown = PR_FALSE);
|
||||
nsJVMStatus GetJVMStatus(void);
|
||||
void SetJVMEnabled(PRBool enabled);
|
||||
|
||||
void ReportJVMError(nsresult err);
|
||||
const char* GetJavaErrorString(JNIEnv* env);
|
||||
|
||||
nsresult AddToClassPath(const char* dirPath);
|
||||
PRBool MaybeStartupLiveConnect(void);
|
||||
PRBool MaybeShutdownLiveConnect(void);
|
||||
PRBool IsLiveConnectEnabled(void);
|
||||
JSJavaVM* GetJSJavaVM() { return fJSJavaVM; }
|
||||
|
||||
|
||||
protected:
|
||||
nsJVMMgr(nsISupports* outer);
|
||||
virtual ~nsJVMMgr(void);
|
||||
|
||||
void EnsurePrefCallbackRegistered(void);
|
||||
const char* GetJavaErrorString(JRIEnv* env);
|
||||
|
||||
nsIJVMPlugin* fJVM;
|
||||
nsJVMStatus fStatus;
|
||||
PRBool fRegisteredJavaPrefChanged;
|
||||
nsISupports* fDebugManager;
|
||||
JSJavaVM * fJSJavaVM;
|
||||
nsVector* fClassPathAdditions;
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* Symantec Debugger Stuff
|
||||
******************************************************************************/
|
||||
|
||||
class nsSymantecDebugManager : public nsISymantecDebugManager {
|
||||
public:
|
||||
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
NS_IMETHOD
|
||||
SetDebugAgentPassword(PRInt32 pwd);
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr,
|
||||
nsJVMMgr* jvmMgr);
|
||||
|
||||
protected:
|
||||
nsSymantecDebugManager(nsISupports* outer, nsJVMMgr* jvmMgr);
|
||||
virtual ~nsSymantecDebugManager(void);
|
||||
|
||||
nsJVMMgr* fJVMMgr;
|
||||
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* nsJVMPluginTagInfo: The browser makes one of these when it sees an APPLET or
|
||||
* appropriate OBJECT tag.
|
||||
******************************************************************************/
|
||||
|
||||
class nsJVMPluginTagInfo : public nsIJVMPluginTagInfo {
|
||||
public:
|
||||
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
/* from nsIJVMPluginTagInfo: */
|
||||
|
||||
/* ====> These are usually only called by the plugin, not the browser... */
|
||||
|
||||
NS_IMETHOD
|
||||
GetCode(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetCodeBase(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetArchive(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetName(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetMayScript(PRBool *result);
|
||||
|
||||
/* Methods specific to nsJVMPluginInstancePeer: */
|
||||
|
||||
/* ====> From here on are things only called by the browser, not the plugin... */
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr,
|
||||
nsIPluginTagInfo2* info);
|
||||
|
||||
protected:
|
||||
|
||||
nsJVMPluginTagInfo(nsISupports* outer, nsIPluginTagInfo2* info);
|
||||
virtual ~nsJVMPluginTagInfo(void);
|
||||
|
||||
/* Instance Variables: */
|
||||
nsIPluginTagInfo2* fPluginTagInfo;
|
||||
char* fSimulatedCodebase;
|
||||
char* fSimulatedCode;
|
||||
};
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*******************************************************************************
|
||||
* Convenience Routines
|
||||
******************************************************************************/
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
/* Returns the JVM manager. You must do a Release on the pointer returned when
|
||||
you're done with it. */
|
||||
PR_EXTERN(struct nsJVMMgr*)
|
||||
JVM_GetJVMMgr(void);
|
||||
|
||||
PR_EXTERN(nsJVMStatus)
|
||||
JVM_StartupJVM(void);
|
||||
|
||||
PR_EXTERN(nsJVMStatus)
|
||||
JVM_ShutdownJVM(void);
|
||||
|
||||
PR_EXTERN(nsJVMStatus)
|
||||
JVM_GetJVMStatus(void);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
JVM_AddToClassPath(const char* dirPath);
|
||||
|
||||
PR_EXTERN(void)
|
||||
JVM_ShowConsole(void);
|
||||
|
||||
PR_EXTERN(void)
|
||||
JVM_HideConsole(void);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
JVM_IsConsoleVisible(void);
|
||||
|
||||
PR_EXTERN(void)
|
||||
JVM_ToggleConsole(void);
|
||||
|
||||
PR_EXTERN(void)
|
||||
JVM_PrintToConsole(const char* msg);
|
||||
|
||||
PR_EXTERN(void)
|
||||
JVM_StartDebugger(void);
|
||||
|
||||
PR_EXTERN(JNIEnv*)
|
||||
JVM_GetJNIEnv(void);
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
JVM_ReleaseJNIEnv(JNIEnv *pJNIEnv);
|
||||
|
||||
PR_EXTERN(nsresult)
|
||||
JVM_SpendTime(PRUint32 timeMillis);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
JVM_MaybeStartupLiveConnect(void);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
JVM_MaybeShutdownLiveConnect(void);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
JVM_IsLiveConnectEnabled(void);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* jvmmgr_h___ */
|
||||
468
mozilla/modules/oji/src/lcglue.cpp
Normal file
468
mozilla/modules/oji/src/lcglue.cpp
Normal file
@@ -0,0 +1,468 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "prthread.h"
|
||||
#include "pprthred.h"
|
||||
#include "jsjava.h"
|
||||
#ifdef MOCHA
|
||||
#include "libmocha.h"
|
||||
#include "libevent.h"
|
||||
#endif
|
||||
#include "jvmmgr.h"
|
||||
#include "npglue.h"
|
||||
|
||||
static NS_DEFINE_IID(kIJVMPluginInstanceIID, NS_IJVMPLUGININSTANCE_IID);
|
||||
static NS_DEFINE_IID(kIJVMPluginTagInfoIID, NS_IJVMPLUGINTAGINFO_IID);
|
||||
|
||||
static PRUintn tlsIndex_g = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// LiveConnect callbacks
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T>
|
||||
class ThreadLocalStorage {
|
||||
public:
|
||||
ThreadLocalStorage(PRThreadPrivateDTOR dtor) : mIndex(0), mValid(PR_FALSE)
|
||||
{
|
||||
mValid = (PR_NewThreadPrivateIndex(&mIndex, dtor) == PR_SUCCESS);
|
||||
}
|
||||
|
||||
void set(T value)
|
||||
{
|
||||
if (mValid) PR_SetThreadPrivate(mIndex, value);
|
||||
}
|
||||
|
||||
T get()
|
||||
{
|
||||
return (T) (mValid ? PR_GetThreadPrivate(mIndex) : 0);
|
||||
}
|
||||
|
||||
private:
|
||||
PRUintn mIndex;
|
||||
PRBool mValid;
|
||||
};
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
#include "jscntxt.h"
|
||||
|
||||
#ifdef MOCHA
|
||||
|
||||
static JSContext* PR_CALLBACK
|
||||
map_jsj_thread_to_js_context_impl(JSJavaThreadState *jsj_env, JNIEnv *env, char **errp)
|
||||
{
|
||||
JSContext *cx = LM_GetCrippledContext();
|
||||
PRBool jvmMochaPrefsEnabled = PR_FALSE;
|
||||
|
||||
*errp = NULL;
|
||||
#if 0
|
||||
nsJVMMgr* pJVMMgr = JVM_GetJVMMgr();
|
||||
if (pJVMMgr != NULL) {
|
||||
nsIJVMPlugin* pJVMPI = pJVMMgr->GetJVMPlugin();
|
||||
jvmMochaPrefsEnabled = LM_GetMochaEnabled();
|
||||
if (pJVMPI != NULL) {
|
||||
nsIPluginInstance* pPIT;
|
||||
nsresult err = pJVMPI->GetPluginInstance(env, &pPIT);
|
||||
if ( (err == NS_OK) && (pPIT != NULL) ) {
|
||||
nsIJVMPluginInstance* pJVMPIT;
|
||||
if (pPIT->QueryInterface(kIJVMPluginInstanceIID,
|
||||
(void**)&pJVMPIT) == NS_OK) {
|
||||
nsPluginInstancePeer* pPITP;
|
||||
err = pJVMPIT->GetPeer((nsIPluginInstancePeer**)&pPITP);
|
||||
if ( (err == NS_OK) &&(pPITP != NULL) ) {
|
||||
cx = pPITP->GetJSContext();
|
||||
pPITP->Release();
|
||||
}
|
||||
pJVMPIT->Release();
|
||||
}
|
||||
pPIT->Release();
|
||||
}
|
||||
// pJVMPI->Release(); // GetJVMPlugin no longer calls AddRef
|
||||
}
|
||||
pJVMMgr->Release();
|
||||
}
|
||||
if (jvmMochaPrefsEnabled == PR_FALSE)
|
||||
{
|
||||
*errp = strdup("Java preference is disabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( cx == NULL )
|
||||
{
|
||||
*errp = strdup("Java thread could not be associated with a JSContext");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
return cx;
|
||||
}
|
||||
|
||||
static void PR_CALLBACK detach_jsjava_thread_state(void* env)
|
||||
{
|
||||
JSJavaThreadState *jsj_env = (JSJavaThreadState*)env;
|
||||
JSJ_DetachCurrentThreadFromJava(jsj_env);
|
||||
}
|
||||
|
||||
/*
|
||||
** This callback is called to map a JSContext to a JSJavaThreadState which
|
||||
** is a wrapper around JNIEnv. Hence this callback essentially maps a JSContext
|
||||
** to a java thread. JSJ_AttachCurrentThreadToJava just calls AttachCurrentThread
|
||||
** on the java vm.
|
||||
*/
|
||||
static JSJavaThreadState* PR_CALLBACK
|
||||
map_js_context_to_jsj_thread_impl(JSContext *cx, char **errp)
|
||||
{
|
||||
*errp = NULL;
|
||||
|
||||
static ThreadLocalStorage<JSJavaThreadState*> localThreadState(&detach_jsjava_thread_state);
|
||||
JSJavaThreadState* jsj_env = localThreadState.get();
|
||||
if (jsj_env != NULL)
|
||||
return jsj_env;
|
||||
|
||||
if (ET_InitMoja(0) != LM_MOJA_OK) {
|
||||
*errp = strdup("LiveConnect initialization failed.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JSJavaVM* js_jvm = NULL;
|
||||
nsJVMMgr* pJVMMgr = JVM_GetJVMMgr();
|
||||
if (pJVMMgr != NULL) {
|
||||
js_jvm = pJVMMgr->GetJSJavaVM();
|
||||
pJVMMgr->Release();
|
||||
if (js_jvm == NULL) {
|
||||
*errp = strdup("Failed to attach to a Java VM.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
jsj_env = JSJ_AttachCurrentThreadToJava(js_jvm, NULL, NULL);
|
||||
localThreadState.set(jsj_env);
|
||||
|
||||
return jsj_env;
|
||||
}
|
||||
|
||||
/*
|
||||
** This callback is called to map a applet,bean to its corresponding JSObject
|
||||
** created on javascript side and then map that to a java wrapper JSObject class.
|
||||
** This callback is called in JSObject.getWindow implementation to get
|
||||
** a java wrapper JSObject class for a applet only once.
|
||||
** Note that once a mapping between applet -> javascript JSObject -> Java wrapper JSObject
|
||||
** is made, all subsequent method calls via JSObject use the internal field
|
||||
** to get to the javascript JSObject.
|
||||
*/
|
||||
static JSObject* PR_CALLBACK
|
||||
map_java_object_to_js_object_impl(JNIEnv *env, void *pNSIPluginInstanceIn, char **errp)
|
||||
{
|
||||
MWContext *cx;
|
||||
JSObject *window;
|
||||
MochaDecoder *decoder;
|
||||
PRBool mayscript = PR_FALSE;
|
||||
PRBool jvmMochaPrefsEnabled = PR_FALSE;
|
||||
nsresult err = NS_OK;
|
||||
|
||||
*errp = NULL;
|
||||
/* XXX assert JS is locked */
|
||||
|
||||
if (!pNSIPluginInstanceIn) {
|
||||
env->ThrowNew(env->FindClass("java/lang/NullPointerException"),0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsJVMMgr* pJVMMgr = JVM_GetJVMMgr();
|
||||
if (pJVMMgr != NULL) {
|
||||
nsIJVMPlugin* pJVMPI = pJVMMgr->GetJVMPlugin();
|
||||
jvmMochaPrefsEnabled = LM_GetMochaEnabled();
|
||||
if (pJVMPI != NULL) {
|
||||
//jobject javaObject = applet;
|
||||
nsIPluginInstance* pPIT;
|
||||
//nsresult err = pJVMPI->GetPluginInstance(javaObject, &pPIT);
|
||||
pPIT = (nsIPluginInstance*)pNSIPluginInstanceIn;
|
||||
if ( (err == NS_OK) && (pPIT != NULL) ) {
|
||||
nsIJVMPluginInstance* pJVMPIT;
|
||||
if (pPIT->QueryInterface(kIJVMPluginInstanceIID,
|
||||
(void**)&pJVMPIT) == NS_OK) {
|
||||
nsPluginInstancePeer* pPITP;
|
||||
err = pJVMPIT->GetPeer((nsIPluginInstancePeer**)&pPITP);
|
||||
if ( (err == NS_OK) &&(pPITP != NULL) ) {
|
||||
nsIJVMPluginTagInfo* pJVMTagInfo;
|
||||
if (pPITP->QueryInterface(kIJVMPluginTagInfoIID,
|
||||
(void**)&pJVMTagInfo) == NS_OK) {
|
||||
err = pJVMTagInfo->GetMayScript(&mayscript);
|
||||
PR_ASSERT(err != NS_OK ? mayscript == PR_FALSE : PR_TRUE);
|
||||
pJVMTagInfo->Release();
|
||||
}
|
||||
cx = pPITP->GetMWContext();
|
||||
pPITP->Release();
|
||||
}
|
||||
pJVMPIT->Release();
|
||||
}
|
||||
pPIT->Release();
|
||||
}
|
||||
// pJVMPI->Release(); // GetJVMPlugin no longer calls AddRef
|
||||
}
|
||||
pJVMMgr->Release();
|
||||
}
|
||||
|
||||
if ( (mayscript == PR_FALSE)
|
||||
||(jvmMochaPrefsEnabled == PR_FALSE)
|
||||
)
|
||||
{
|
||||
*errp = strdup("JSObject.getWindow() requires mayscript attribute on this Applet or java preference is disabled");
|
||||
goto except;
|
||||
}
|
||||
|
||||
|
||||
if (!cx || (cx->type != MWContextBrowser && cx->type != MWContextPane))
|
||||
{
|
||||
*errp = strdup("JSObject.getWindow() can only be called in MWContextBrowser or MWContextPane");
|
||||
return 0;
|
||||
}
|
||||
|
||||
decoder = LM_GetMochaDecoder(cx);
|
||||
|
||||
/* if there is a decoder now, reflect the window */
|
||||
if (decoder && (jvmMochaPrefsEnabled == PR_TRUE)) {
|
||||
window = decoder->window_object;
|
||||
}
|
||||
|
||||
LM_PutMochaDecoder(decoder);
|
||||
|
||||
return window;
|
||||
except:
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static JavaVM* PR_CALLBACK
|
||||
get_java_vm_impl(char **errp)
|
||||
{
|
||||
*errp = NULL;
|
||||
JavaVM *pJavaVM = NULL;
|
||||
|
||||
nsJVMMgr* pJVMMgr = JVM_GetJVMMgr();
|
||||
if (pJVMMgr != NULL) {
|
||||
nsIJVMPlugin* pJVMPI = pJVMMgr->GetJVMPlugin();
|
||||
if (pJVMPI != NULL) {
|
||||
nsresult err = pJVMPI->GetJavaVM(&pJavaVM);
|
||||
PR_ASSERT(err != NS_OK ? pJavaVM == NULL : PR_TRUE);
|
||||
// pJVMPI->Release(); // GetJVMPlugin no longer calls AddRef
|
||||
}
|
||||
pJVMMgr->Release();
|
||||
}
|
||||
if ( pJavaVM == NULL )
|
||||
{
|
||||
*errp = strdup("Could not find a JavaVM to attach to.");
|
||||
}
|
||||
return pJavaVM;
|
||||
}
|
||||
#endif
|
||||
|
||||
static JSPrincipals* PR_CALLBACK
|
||||
get_JSPrincipals_from_java_caller_impl(JNIEnv *pJNIEnv, JSContext *pJSContext)
|
||||
{
|
||||
nsIPrincipal **ppNSIPrincipalArray = NULL;
|
||||
PRInt32 length = 0;
|
||||
nsresult err = NS_OK;
|
||||
void *pNSPrincipalArray = NULL;
|
||||
#if 0 // TODO: =-= sudu: fix it.
|
||||
nsJVMMgr* pJVMMgr = JVM_GetJVMMgr();
|
||||
if (pJVMMgr != NULL) {
|
||||
nsIJVMPlugin* pJVMPI = pJVMMgr->GetJVMPlugin();
|
||||
if (pJVMPI != NULL) {
|
||||
err = pJVMPI->GetPrincipalArray(pJNIEnv, 0, &ppNSIPrincipalArray, &length);
|
||||
if ((err == NS_OK) && (ppNSIPrincipalArray != NULL)) {
|
||||
nsIPluginManager *pNSIPluginManager = NULL;
|
||||
NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
|
||||
err = pJVMMgr->QueryInterface(kIPluginManagerIID,
|
||||
(void**)&pNSIPluginManager);
|
||||
|
||||
if( (err == NS_OK)
|
||||
&& (pNSIPluginManager != NULL )
|
||||
)
|
||||
{
|
||||
nsCCapsManager *pNSCCapsManager = NULL;
|
||||
NS_DEFINE_IID(kICapsManagerIID, NS_ICAPSMANAGER_IID);
|
||||
err = pNSIPluginManager->QueryInterface(kICapsManagerIID, (void**)&pNSCCapsManager);
|
||||
if( (err == NS_OK)
|
||||
&& (pNSCCapsManager != NULL)
|
||||
)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
nsPrincipal *pNSPrincipal = NULL;
|
||||
pNSPrincipalArray = nsCapsNewPrincipalArray(length);
|
||||
if (pNSPrincipalArray != NULL)
|
||||
{
|
||||
while( i<length )
|
||||
{
|
||||
err = pNSCCapsManager->GetNSPrincipal(ppNSIPrincipalArray[i], &pNSPrincipal);
|
||||
nsCapsSetPrincipalArrayElement(pNSPrincipalArray, i, pNSPrincipal);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
pNSCCapsManager->Release();
|
||||
}
|
||||
pNSIPluginManager->Release();
|
||||
}
|
||||
}
|
||||
//pJVMPI->Release();
|
||||
}
|
||||
pJVMMgr->Release();
|
||||
}
|
||||
#endif
|
||||
if ( (pNSPrincipalArray != NULL)
|
||||
&&(length != 0)
|
||||
)
|
||||
{
|
||||
return LM_GetJSPrincipalsFromJavaCaller(pJSContext, pNSPrincipalArray);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static jobject PR_CALLBACK
|
||||
get_java_wrapper_impl(JNIEnv *pJNIEnv, jint jsobject)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
jobject pJSObjectWrapper = NULL;
|
||||
nsJVMMgr* pJVMMgr = JVM_GetJVMMgr();
|
||||
if (pJVMMgr != NULL) {
|
||||
nsIJVMPlugin* pJVMPI = pJVMMgr->GetJVMPlugin();
|
||||
if (pJVMPI != NULL) {
|
||||
err = pJVMPI->GetJavaWrapper(pJNIEnv, jsobject, &pJSObjectWrapper);
|
||||
//pJVMPI->Release();
|
||||
}
|
||||
pJVMMgr->Release();
|
||||
}
|
||||
if ( err != NS_OK )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return pJSObjectWrapper;
|
||||
}
|
||||
|
||||
static JSBool PR_CALLBACK
|
||||
enter_js_from_java_impl(JNIEnv *jEnv, char **errp)
|
||||
{
|
||||
#ifdef OJI
|
||||
ThreadLocalStorageAtIndex0 *priv = NULL;
|
||||
if ( PR_GetCurrentThread() == NULL )
|
||||
{
|
||||
PR_AttachThread(PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL);
|
||||
priv = (ThreadLocalStorageAtIndex0 *)malloc(sizeof(ThreadLocalStorageAtIndex0));
|
||||
priv->refcount=1;
|
||||
PR_SetThreadPrivate(tlsIndex_g, (void *)priv);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv = (ThreadLocalStorageAtIndex0 *)PR_GetThreadPrivate(tlsIndex_g);
|
||||
if(priv != NULL)
|
||||
{
|
||||
priv->refcount++;
|
||||
}
|
||||
}
|
||||
|
||||
return LM_LockJS(errp);
|
||||
#else
|
||||
return JS_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void PR_CALLBACK
|
||||
exit_js_impl(JNIEnv *jEnv)
|
||||
{
|
||||
ThreadLocalStorageAtIndex0 *priv = NULL;
|
||||
|
||||
LM_UnlockJS();
|
||||
|
||||
if ( (PR_GetCurrentThread() != NULL )
|
||||
&& ((priv = (ThreadLocalStorageAtIndex0 *)PR_GetThreadPrivate(tlsIndex_g)) != NULL)
|
||||
)
|
||||
{
|
||||
priv->refcount--;
|
||||
if(priv->refcount == 0)
|
||||
{
|
||||
PR_SetThreadPrivate(tlsIndex_g, NULL);
|
||||
PR_DetachThread();
|
||||
free(priv);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static PRBool PR_CALLBACK
|
||||
create_java_vm_impl(SystemJavaVM* *jvm, JNIEnv* *initialEnv, void* initargs)
|
||||
{
|
||||
const char* classpath = (const char*)initargs; // unused (should it be?)
|
||||
*jvm = (SystemJavaVM*)JVM_GetJVMMgr(); // unused in the browser
|
||||
*initialEnv = JVM_GetJNIEnv();
|
||||
return (*jvm != NULL && *initialEnv != NULL);
|
||||
}
|
||||
|
||||
static PRBool PR_CALLBACK
|
||||
destroy_java_vm_impl(SystemJavaVM* jvm, JNIEnv* initialEnv)
|
||||
{
|
||||
JVM_ReleaseJNIEnv(initialEnv);
|
||||
// need to release jvm
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static JNIEnv* PR_CALLBACK
|
||||
attach_current_thread_impl(SystemJavaVM* jvm)
|
||||
{
|
||||
return JVM_GetJNIEnv();
|
||||
}
|
||||
|
||||
static PRBool PR_CALLBACK
|
||||
detach_current_thread_impl(SystemJavaVM* jvm, JNIEnv* env)
|
||||
{
|
||||
JVM_ReleaseJNIEnv(env);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static SystemJavaVM* PR_CALLBACK
|
||||
get_java_vm_impl(JNIEnv* env)
|
||||
{
|
||||
// only one SystemJavaVM for the whole browser, so it doesn't depend on env
|
||||
return (SystemJavaVM*)JVM_GetJVMMgr();
|
||||
}
|
||||
|
||||
#endif /* MOCHA */
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
|
||||
/*
|
||||
* Callbacks for client-specific jsjava glue
|
||||
*/
|
||||
JSJCallbacks jsj_callbacks = {
|
||||
map_jsj_thread_to_js_context_impl,
|
||||
map_js_context_to_jsj_thread_impl,
|
||||
map_java_object_to_js_object_impl,
|
||||
get_JSPrincipals_from_java_caller_impl,
|
||||
enter_js_from_java_impl,
|
||||
exit_js_impl,
|
||||
NULL, // error_print
|
||||
get_java_wrapper_impl,
|
||||
create_java_vm_impl,
|
||||
destroy_java_vm_impl,
|
||||
attach_current_thread_impl,
|
||||
detach_current_thread_impl,
|
||||
get_java_vm_impl
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
119
mozilla/modules/oji/src/makefile.win
Normal file
119
mozilla/modules/oji/src/makefile.win
Normal file
@@ -0,0 +1,119 @@
|
||||
IGNORE_MANIFEST=1
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH= ..\..\..
|
||||
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
!ifdef MOZ_OJI
|
||||
|
||||
!ifndef MAKE_OBJ_TYPE
|
||||
MAKE_OBJ_TYPE=EXE
|
||||
!endif
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
LIBNAME=oji$(MOZ_BITS)
|
||||
PDBFILE=$(LIBNAME).pdb
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define the files necessary to build the target (ie. OBJS)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
OBJS = .\$(OBJDIR)\jvmmgr.obj \
|
||||
.\$(OBJDIR)\lcglue.obj \
|
||||
.\$(OBJDIR)\scd.obj
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
|
||||
#// (these must be defined before the common makefiles are included)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any local options for the make tools
|
||||
#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
LINCS= $(LINCS) -I_jri \
|
||||
#
|
||||
# For Win16 the following include directories are copied into
|
||||
# ns/dist/public/win16
|
||||
#
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
-I$(PUBLIC)/caps \
|
||||
-I$(PUBLIC)/js \
|
||||
-I$(PUBLIC)/java \
|
||||
-I$(PUBLIC)/libimg \
|
||||
-I$(PUBLIC)/nspr \
|
||||
-I$(PUBLIC)/dbm \
|
||||
-I$(PUBLIC)/security \
|
||||
-I$(PUBLIC)/pref \
|
||||
-I$(PUBLIC)/xpcom \
|
||||
-I$(PUBLIC)/raptor \
|
||||
-I$(PUBLIC)/plugin \
|
||||
-I$(PUBLIC)/oji \
|
||||
-I$(PUBLIC)/plugimpl \
|
||||
!endif
|
||||
-I$(DIST)/include/private \
|
||||
-I$(DEPTH)/lib/layout \
|
||||
-I$(DEPTH)/lib/libstyle \
|
||||
-I$(DEPTH)/lib/libjar \
|
||||
$(NULL)
|
||||
|
||||
CSRCS = jvmmgr.cpp \
|
||||
scd.cpp
|
||||
|
||||
!endif # MOZ_OJI
|
||||
|
||||
MODULE = ojiimpl
|
||||
|
||||
EXPORTS = jvmmgr.h
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
LCFLAGS=$(LCFLAGS) ^
|
||||
$(JAVA_DEFINES)
|
||||
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
PUBLIC_HEADER_DIR=$(PUBLIC)\ojiimpl
|
||||
!else
|
||||
PUBLIC_HEADER_DIR=$(PUBLIC)\win16
|
||||
!endif
|
||||
|
||||
export::
|
||||
$(MAKE_INSTALL) jvmmgr.h $(PUBLIC_HEADER_DIR)
|
||||
|
||||
!ifdef MOZ_OJI
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
$(RM_R) _jri
|
||||
!endif # MOZ_OJI
|
||||
82
mozilla/modules/oji/src/nsscd.h
Normal file
82
mozilla/modules/oji/src/nsscd.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NETSCAPE JAVA VM PLUGIN EXTENSIONS FOR SYMANTEC DEBUGGER
|
||||
//
|
||||
// This interface allows the browser to initialize a JVM that supports a
|
||||
// debugger. It's called the "Symantec Debugger Interface" because it currently
|
||||
// provides access to the Symantec Cafe or Visual Cafe debugger in the Netscape
|
||||
// JVM. It is not meant to be the be-all-to-end-all of debugger interfaces.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsscd_h___
|
||||
#define nsscd_h___
|
||||
|
||||
#include "nsjvm.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Symantec Debug Manager Interface
|
||||
//
|
||||
// Implemented by the browser that supports the Symantec debugger.
|
||||
|
||||
class NPISymantecDebugManager : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD_(PRBool)
|
||||
SetDebugAgentPassword(PRInt32 pwd) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NP_ISYMANTECDEBUGMANAGER_IID \
|
||||
{ /* 131362e0-d985-11d1-8155-006008119d7a */ \
|
||||
0x131362e0, \
|
||||
0xd985, \
|
||||
0x11d1, \
|
||||
{0x81, 0x55, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Symantec Debugger Interface
|
||||
//
|
||||
// Implemented by the JVM plugin that supports the Symantec debugger.
|
||||
|
||||
enum NPSymantecDebugPort {
|
||||
NPSymantecDebugPort_None = 0,
|
||||
NPSymantecDebugPort_SharedMemory = -1
|
||||
// anything else is a port number
|
||||
};
|
||||
|
||||
class NPISymantecDebugger : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD_(JVMError)
|
||||
StartDebugger(NPSymantecDebugPort port) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NP_ISYMANTECDEBUGGER_IID \
|
||||
{ /* 954399f0-d980-11d1-8155-006008119d7a */ \
|
||||
0x954399f0, \
|
||||
0xd980, \
|
||||
0x11d1, \
|
||||
{0x81, 0x55, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#endif /* nsscd_h___ */
|
||||
95
mozilla/modules/oji/src/scd.cpp
Normal file
95
mozilla/modules/oji/src/scd.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Manager Methods to support the JVM Plugin API
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "jvmmgr.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kISymantecDebugManagerIID, NS_ISYMANTECDEBUGMANAGER_IID);
|
||||
|
||||
NS_IMPL_AGGREGATED(nsSymantecDebugManager);
|
||||
|
||||
nsSymantecDebugManager::nsSymantecDebugManager(nsISupports* outer, nsJVMMgr* jvmMgr)
|
||||
: fJVMMgr(jvmMgr)
|
||||
{
|
||||
NS_INIT_AGGREGATED(outer);
|
||||
}
|
||||
|
||||
nsSymantecDebugManager::~nsSymantecDebugManager()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsSymantecDebugManager::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(kISymantecDebugManagerIID)) {
|
||||
*aInstancePtr = this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsSymantecDebugManager::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr,
|
||||
nsJVMMgr* jvmMgr)
|
||||
{
|
||||
if (outer && !aIID.Equals(kISupportsIID))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
nsSymantecDebugManager* dbgr = new nsSymantecDebugManager(outer, jvmMgr);
|
||||
if (dbgr == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
dbgr->AddRef();
|
||||
*aInstancePtr = dbgr->GetInner();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(XP_PC) && defined(_WIN32)
|
||||
extern "C" HWND FindNavigatorHiddenWindow(void);
|
||||
#endif
|
||||
|
||||
NS_METHOD
|
||||
nsSymantecDebugManager::SetDebugAgentPassword(PRInt32 pwd)
|
||||
{
|
||||
#if defined(XP_PC) && defined(_WIN32)
|
||||
HWND win = FindNavigatorHiddenWindow();
|
||||
HANDLE sem;
|
||||
long err;
|
||||
|
||||
/* set up by aHiddenFrameClass in CNetscapeApp::InitInstance */
|
||||
err = SetWindowLong(win, 0, pwd);
|
||||
if (err == 0) {
|
||||
// PR_LOG(NSJAVA, PR_LOG_ALWAYS,
|
||||
// ("SetWindowLong returned %ld (err=%d)\n", err, GetLastError()));
|
||||
/* continue so that we try to wake up the DebugManager */
|
||||
}
|
||||
sem = OpenSemaphore(SEMAPHORE_MODIFY_STATE, FALSE, "Netscape-Symantec Debugger");
|
||||
if (sem) {
|
||||
ReleaseSemaphore(sem, 1, NULL);
|
||||
CloseHandle(sem);
|
||||
}
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
35
mozilla/modules/plugin/Makefile
Normal file
35
mozilla/modules/plugin/Makefile
Normal file
@@ -0,0 +1,35 @@
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the MODULES/OJI tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH=../..
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
|
||||
#// (these must come before the common makefiles are included)
|
||||
#//
|
||||
#// DIRS - There are subdirectories to process
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
ifndef NGLAYOUT_PLUGINS
|
||||
DIRS= public src
|
||||
else
|
||||
DIRS= public nglsrc
|
||||
endif
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
40
mozilla/modules/plugin/Makefile.in
Normal file
40
mozilla/modules/plugin/Makefile.in
Normal file
@@ -0,0 +1,40 @@
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the MODULES/OJI tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH=../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
|
||||
#// (these must come before the common makefiles are included)
|
||||
#//
|
||||
#// DIRS - There are subdirectories to process
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
ifndef NGLAYOUT_PLUGINS
|
||||
DIRS= public src
|
||||
else
|
||||
DIRS= public nglsrc
|
||||
endif
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
1948
mozilla/modules/plugin/bad/badapter.cpp
Normal file
1948
mozilla/modules/plugin/bad/badapter.cpp
Normal file
File diff suppressed because it is too large
Load Diff
42
mozilla/modules/plugin/base/public/MANIFEST
Normal file
42
mozilla/modules/plugin/base/public/MANIFEST
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsIEventHandler.h
|
||||
nsIFileUtilities.h
|
||||
nsIJRILiveConnectPlugin.h
|
||||
nsIJRILiveConnectPlugInstPeer.h
|
||||
nsILiveConnectPlugin.h
|
||||
nsILiveConnectPlugInstPeer.h
|
||||
nsIMalloc.h
|
||||
nsIPlugin.h
|
||||
nsIPluginInstance.h
|
||||
nsIPluginInstancePeer.h
|
||||
nsIPluginManager.h
|
||||
nsIPluginManager2.h
|
||||
nsIPluginStream.h
|
||||
nsIPluginStreamPeer.h
|
||||
nsIPluginStreamPeer2.h
|
||||
nsIPluginTagInfo.h
|
||||
nsIPluginTagInfo2.h
|
||||
nsISeekablePluginStreamPeer.h
|
||||
nsIWindowlessPlugInstPeer.h
|
||||
nsplugin.h
|
||||
nsplugindefs.h
|
||||
52
mozilla/modules/plugin/base/public/Makefile
Normal file
52
mozilla/modules/plugin/base/public/Makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
MODULE = plugin
|
||||
|
||||
EXPORTS = \
|
||||
nsIEventHandler.h \
|
||||
nsIFileUtilities.h \
|
||||
nsIJRILiveConnectPlugin.h \
|
||||
nsIJRILiveConnectPlugInstPeer.h \
|
||||
nsILiveConnectPlugin.h \
|
||||
nsILiveConnectPlugInstPeer.h \
|
||||
nsIMalloc.h \
|
||||
nsIPlugin.h \
|
||||
nsIPluginInstance.h \
|
||||
nsIPluginInstancePeer.h \
|
||||
nsIPluginManager.h \
|
||||
nsIPluginManager2.h \
|
||||
nsIPluginStream.h \
|
||||
nsIPluginTagInfo.h \
|
||||
nsIPluginTagInfo2.h \
|
||||
nsIWindowlessPlugInstPeer.h \
|
||||
nsIPluginInputStream.h \
|
||||
nsIPluginInputStream2.h \
|
||||
nsIPluginStreamListener.h \
|
||||
nsplugin.h \
|
||||
nsplugindefs.h
|
||||
|
||||
# DEPRECATED -- remove before we ship 5.0
|
||||
EXPORTS += \
|
||||
nsIPluginStream.h \
|
||||
nsIPluginStreamPeer.h \
|
||||
nsIPluginStreamPeer2.h \
|
||||
nsISeekablePluginStreamPeer.h \
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
59
mozilla/modules/plugin/base/public/Makefile.in
Normal file
59
mozilla/modules/plugin/base/public/Makefile.in
Normal file
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = plugin
|
||||
|
||||
EXPORTS = \
|
||||
nsIEventHandler.h \
|
||||
nsIFileUtilities.h \
|
||||
nsIJRILiveConnectPlugin.h \
|
||||
nsIJRILiveConnectPlugInstPeer.h \
|
||||
nsILiveConnectPlugin.h \
|
||||
nsILiveConnectPlugInstPeer.h \
|
||||
nsIMalloc.h \
|
||||
nsIPlugin.h \
|
||||
nsIPluginInstance.h \
|
||||
nsIPluginInstancePeer.h \
|
||||
nsIPluginManager.h \
|
||||
nsIPluginManager2.h \
|
||||
nsIPluginStream.h \
|
||||
nsIPluginTagInfo.h \
|
||||
nsIPluginTagInfo2.h \
|
||||
nsIWindowlessPlugInstPeer.h \
|
||||
nsIPluginInputStream.h \
|
||||
nsIPluginInputStream2.h \
|
||||
nsIPluginStreamListener.h \
|
||||
nsplugin.h \
|
||||
nsplugindefs.h
|
||||
|
||||
# DEPRECATED -- remove before we ship 5.0
|
||||
EXPORTS += \
|
||||
nsIPluginStream.h \
|
||||
nsIPluginStreamPeer.h \
|
||||
nsIPluginStreamPeer2.h \
|
||||
nsISeekablePluginStreamPeer.h \
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
54
mozilla/modules/plugin/base/public/makefile.win
Normal file
54
mozilla/modules/plugin/base/public/makefile.win
Normal file
@@ -0,0 +1,54 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
MODULE = plugin
|
||||
|
||||
EXPORTS = \
|
||||
nsIEventHandler.h \
|
||||
nsIFileUtilities.h \
|
||||
nsIJRILiveConnectPlugin.h \
|
||||
nsIJRILiveConnectPlugInstPeer.h \
|
||||
nsILiveConnectPlugin.h \
|
||||
nsILiveConnectPlugInstPeer.h \
|
||||
nsIMalloc.h \
|
||||
nsIPlugin.h \
|
||||
nsIPluginInstance.h \
|
||||
nsIPluginInstancePeer.h \
|
||||
nsIPluginManager.h \
|
||||
nsIPluginManager2.h \
|
||||
nsIPluginTagInfo.h \
|
||||
nsIPluginTagInfo2.h \
|
||||
nsIWindowlessPlugInstPeer.h \
|
||||
nsIPluginInputStream.h \
|
||||
nsIPluginInputStream2.h \
|
||||
nsIPluginStreamListener.h \
|
||||
nsplugin.h \
|
||||
nsplugindefs.h
|
||||
|
||||
# DEPRECATED -- remove before we ship 5.0
|
||||
EXPORTS = $(EXPORTS) \
|
||||
nsIPluginStream.h \
|
||||
nsIPluginStreamPeer.h \
|
||||
nsIPluginStreamPeer2.h \
|
||||
nsISeekablePluginStreamPeer.h \
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
81
mozilla/modules/plugin/base/public/nsIEventHandler.h
Normal file
81
mozilla/modules/plugin/base/public/nsIEventHandler.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIEventHandler_h___
|
||||
#define nsIEventHandler_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Instance Interface
|
||||
|
||||
/**
|
||||
* The nsIEventHandler interface provides the callback to handle events.
|
||||
* It is implemented by the plugin, and is the superclass for nsIPluginInstance.
|
||||
*/
|
||||
class nsIEventHandler : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Handles an event. An nsIEventHandler can also get registered with with
|
||||
* nsIPluginManager2::RegisterWindow and will be called whenever an event
|
||||
* comes in for that window.
|
||||
*
|
||||
* Note that for Unix and Mac the nsPluginEvent structure is different
|
||||
* from the old NPEvent structure -- it's no longer the native event
|
||||
* record, but is instead a struct. This was done for future extensibility,
|
||||
* and so that the Mac could receive the window argument too. For Windows
|
||||
* and OS2, it's always been a struct, so there's no change for them.
|
||||
*
|
||||
* (Corresponds to NPP_HandleEvent.)
|
||||
*
|
||||
* @param event - the event to be handled
|
||||
* @param handled - set to PR_TRUE if event was handled
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
HandleEvent(nsPluginEvent* event, PRBool* handled) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IEVENTHANDLER_IID \
|
||||
{ /* a447ddf0-1a99-11d2-815f-006008119d7a */ \
|
||||
0xa447ddf0, \
|
||||
0x1a99, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5f, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIEventHandler_h___ */
|
||||
92
mozilla/modules/plugin/base/public/nsIFileUtilities.h
Normal file
92
mozilla/modules/plugin/base/public/nsIFileUtilities.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIFileUtilities_h___
|
||||
#define nsIFileUtilities_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File Utilities Interface
|
||||
// This interface reflects operations only available in Communicator 5.0.
|
||||
|
||||
/**
|
||||
* The nsIFileUtilities interface provides access to random file operations.
|
||||
* To obtain: QueryInterface on nsIPluginManager.
|
||||
*/
|
||||
class nsIFileUtilities : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the name of the browser executable program.
|
||||
*
|
||||
* @param result - the returned path to the program
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetProgramPath(const char* *result) = 0;
|
||||
|
||||
/**
|
||||
* Returns the name of the temporary directory.
|
||||
*
|
||||
* @param result - the returned path to the temp directory
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetTempDirPath(const char* *result) = 0;
|
||||
|
||||
/**
|
||||
* Returns a unique temporary file name.
|
||||
*
|
||||
* @param prefix - a string to prefix to the temporary file name
|
||||
* @param bufLen - the length of the resultBuf to receive the data
|
||||
* @param resultBuf - the returned temp file name
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
NewTempFileName(const char* prefix, PRUint32 bufLen, char* resultBuf) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IFILEUTILITIES_IID \
|
||||
{ /* 89a31ce0-019a-11d2-815b-006008119d7a */ \
|
||||
0x89a31ce0, \
|
||||
0x019a, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIFileUtilities_h___ */
|
||||
@@ -0,0 +1,98 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJRILiveConnectPluginInstancePeer_h__
|
||||
#define nsIJRILiveConnectPluginInstancePeer_h__
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// JRI-Based LiveConnect Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This stuff is here so that the browser can support older JRI-based
|
||||
// LiveConnected plugins (when using old plugin to new C++-style plugin
|
||||
// adapter code).
|
||||
//
|
||||
// Warning: Don't use this anymore, unless you're sure that you have to!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "jri.h"
|
||||
|
||||
/**
|
||||
* The nsIJRILiveConnectPluginInstancePeer interface is implemented by browsers
|
||||
* that support JRI-based LiveConnect. Note that for 5.0, LiveConnect support
|
||||
* has become JNI-based, so this interface is effectively deprecated.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginInstancePeer
|
||||
*/
|
||||
class nsIJRILiveConnectPluginInstancePeer : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns a JRI reference to the Java peer object associated with the
|
||||
* plugin instance. This object is an instance of the class specified
|
||||
* by nsIJRILiveConnectPlugin::GetJavaClass.
|
||||
*
|
||||
* (Corresponds to NPN_GetJavaPeer.)
|
||||
*
|
||||
* @param resultingJavaPeer - a resulting reference to the Java instance
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetJavaPeer(jref *resultingJavaPeer) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IJRILIVECONNECTPLUGININSTANCEPEER_IID \
|
||||
{ /* 25b63f40-f773-11d1-815b-006008119d7a */ \
|
||||
0x25b63f40, \
|
||||
0xf773, \
|
||||
0x11d1, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
// QueryInterface for this IID on nsIPluginManager to get a JRIEnv
|
||||
// XXX change this
|
||||
#define NS_IJRIENV_IID \
|
||||
{ /* f9d4ea00-a1bc-11d1-85b1-00805f0e4dfe */ \
|
||||
0xf9d4ea00, \
|
||||
0xa1bc, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJRILiveConnectPluginInstancePeer_h__ */
|
||||
88
mozilla/modules/plugin/base/public/nsIJRILiveConnectPlugin.h
Normal file
88
mozilla/modules/plugin/base/public/nsIJRILiveConnectPlugin.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJRILiveConnectPlugin_h__
|
||||
#define nsIJRILiveConnectPlugin_h__
|
||||
|
||||
#include "nsIPlugin.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// JRI-Based LiveConnect Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This stuff is here so that the browser can support older JRI-based
|
||||
// LiveConnected plugins (when using old plugin to new C++-style plugin
|
||||
// adapter code).
|
||||
//
|
||||
// Warning: Don't use this anymore, unless you're sure that you have to!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "jri.h"
|
||||
|
||||
/**
|
||||
* The nsIJRILiveConnectPlugin interface defines additional entry points that a
|
||||
* plugin developer needs to implement in order for the plugin to support
|
||||
* JRI-based LiveConnect, as opposed to the standard JNI-based LiveConnect
|
||||
* (which new in 5.0).
|
||||
*
|
||||
* Plugin developers requiring this capability should implement this interface
|
||||
* in addition to the basic nsIPlugin interface.
|
||||
*/
|
||||
class nsIJRILiveConnectPlugin : public nsIPlugin {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the class of the Java instance to be associated with the
|
||||
* plugin.
|
||||
*
|
||||
* (Corresponds to NPP_GetJavaClass.)
|
||||
*
|
||||
* @param resultingClass - a resulting reference to the Java class
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetJavaClass(jref *resultingClass) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IJRILIVECONNECTPLUGIN_IID \
|
||||
{ /* c94058e0-f772-11d1-815b-006008119d7a */ \
|
||||
0xc94058e0, \
|
||||
0xf772, \
|
||||
0x11d1, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJRILiveConnectPlugin_h__ */
|
||||
@@ -0,0 +1,86 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIJRILiveConnectPluginInstancePeer_h__
|
||||
#define nsIJRILiveConnectPluginInstancePeer_h__
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// JRI-Based LiveConnect Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This stuff is here so that the browser can support older JRI-based
|
||||
// LiveConnected plugins (when using old plugin to new C++-style plugin
|
||||
// adapter code).
|
||||
//
|
||||
// Warning: Don't use this anymore, unless you're sure that you have to!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "jri.h" // ancient
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// JRILiveConnect Plugin Instance Peer Interface
|
||||
// Browsers that support JRI-based LiveConnect implement this subclass of
|
||||
// plugin instance peer.
|
||||
|
||||
class nsIJRILiveConnectPluginInstancePeer : public nsISupports {
|
||||
public:
|
||||
|
||||
// (Corresponds to NPN_GetJavaPeer.)
|
||||
NS_IMETHOD_(jref)
|
||||
GetJavaPeer(void) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IJRILIVECONNECTPLUGININSTANCEPEER_IID \
|
||||
{ /* 25b63f40-f773-11d1-815b-006008119d7a */ \
|
||||
0x25b63f40, \
|
||||
0xf773, \
|
||||
0x11d1, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
// QueryInterface for this IID on nsIPluginManager to get a JRIEnv
|
||||
// XXX change this
|
||||
#define NS_IJRIENV_IID \
|
||||
{ /* f9d4ea00-a1bc-11d1-85b1-00805f0e4dfe */ \
|
||||
0xf9d4ea00, \
|
||||
0xa1bc, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIJRILiveConnectPluginInstancePeer_h__ */
|
||||
@@ -0,0 +1,86 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsILiveConnectPluginInstancePeer_h___
|
||||
#define nsILiveConnectPluginInstancePeer_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
#include "jni.h" // standard JVM API
|
||||
|
||||
/**
|
||||
* The nsILiveConnectPluginInstancePeer interface is implemented by browsers
|
||||
* that support LiveConnect, i.e. scriptability via JavaScript. Note that this
|
||||
* LiveConnect interface is now JNI-based (since 5.0).
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginInstancePeer
|
||||
*/
|
||||
class nsILiveConnectPluginInstancePeer : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns a JNI reference to the Java peer object associated with the
|
||||
* plugin instance. This object is an instance of the class specified
|
||||
* by nsIJRILiveConnectPlugin::GetJavaClass.
|
||||
*
|
||||
* (New JNI-based entry point, roughly corresponds to NPN_GetJavaPeer.)
|
||||
*
|
||||
* @param resultingJavaPeer - a resulting reference to the Java instance
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetJavaPeer(jobject *resultingJavaPeer) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ILIVECONNECTPLUGININSTANCEPEER_IID \
|
||||
{ /* 1e3502a0-a1bd-11d1-85b1-00805f0e4dfe */ \
|
||||
0x1e3502a0, \
|
||||
0xa1bd, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
// QueryInterface for this IID on nsIPluginManager to get a JNIEnv
|
||||
// XXX change this
|
||||
#define NS_IJNIENV_IID \
|
||||
{ /* 04610650-a1bd-11d1-85b1-00805f0e4dfe */ \
|
||||
0x04610650, \
|
||||
0xa1bd, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsILiveConnectPluginInstancePeer_h___ */
|
||||
75
mozilla/modules/plugin/base/public/nsILiveConnectPlugin.h
Normal file
75
mozilla/modules/plugin/base/public/nsILiveConnectPlugin.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsILiveConnectPlugin_h__
|
||||
#define nsILiveConnectPlugin_h__
|
||||
|
||||
#include "nsIPlugin.h"
|
||||
#include "jni.h" // standard JVM API
|
||||
|
||||
/**
|
||||
* The nsILiveConnectPlugin interface defines additional entry points that a
|
||||
* plugin developer needs to implement in order for the plugin to support
|
||||
* JNI-based LiveConnect (new in 5.0).
|
||||
*
|
||||
* Plugin developers requiring this capability should implement this interface
|
||||
* in addition to the basic nsIPlugin interface.
|
||||
*/
|
||||
class nsILiveConnectPlugin : public nsIPlugin {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the class of the Java instance to be associated with the
|
||||
* plugin.
|
||||
*
|
||||
* (New JNI-based entry point, roughly corresponds to NPP_GetJavaClass.)
|
||||
*
|
||||
* @param resultingClass - a resulting reference to the Java class
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetJavaClass(jclass *resultingClass) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ILIVECONNECTPLUGIN_IID \
|
||||
{ /* cf134df0-a1bc-11d1-85b1-00805f0e4dfe */ \
|
||||
0xcf134df0, \
|
||||
0xa1bc, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsILiveConnectPlugin_h__ */
|
||||
@@ -0,0 +1,74 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsILiveConnectPluginInstancePeer_h___
|
||||
#define nsILiveConnectPluginInstancePeer_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "jni.h" // standard JVM API
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// LiveConnect Plugin Instance Peer Interface
|
||||
// Browsers that support JNI-based LiveConnect implement this subclass of
|
||||
// plugin instance peer.
|
||||
|
||||
class nsILiveConnectPluginInstancePeer : public nsISupports {
|
||||
public:
|
||||
|
||||
// (New JNI-based entry point, roughly corresponds to NPN_GetJavaPeer.)
|
||||
NS_IMETHOD_(jobject)
|
||||
GetJavaPeer(void) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ILIVECONNECTPLUGININSTANCEPEER_IID \
|
||||
{ /* 1e3502a0-a1bd-11d1-85b1-00805f0e4dfe */ \
|
||||
0x1e3502a0, \
|
||||
0xa1bd, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
// QueryInterface for this IID on nsIPluginManager to get a JNIEnv
|
||||
// XXX change this
|
||||
#define NS_IJNIENV_IID \
|
||||
{ /* 04610650-a1bd-11d1-85b1-00805f0e4dfe */ \
|
||||
0x04610650, \
|
||||
0xa1bd, \
|
||||
0x11d1, \
|
||||
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsILiveConnectPluginInstancePeer_h___ */
|
||||
94
mozilla/modules/plugin/base/public/nsIMalloc.h
Normal file
94
mozilla/modules/plugin/base/public/nsIMalloc.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIMalloc_h___
|
||||
#define nsIMalloc_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIMalloc : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Allocates a block of memory of a particular size.
|
||||
*
|
||||
* @param size - the size of the block to allocate
|
||||
* @result the block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*)
|
||||
Alloc(PRUint32 size) = 0;
|
||||
|
||||
/**
|
||||
* Reallocates a block of memory to a new size.
|
||||
*
|
||||
* @param ptr - the block of memory to reallocate
|
||||
* @param size - the new size
|
||||
* @result the rellocated block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*)
|
||||
Realloc(void* ptr, PRUint32 size) = 0;
|
||||
|
||||
/**
|
||||
* Frees a block of memory.
|
||||
*
|
||||
* @param ptr - the block of memory to free
|
||||
*/
|
||||
NS_IMETHOD_(void)
|
||||
Free(void* ptr) = 0;
|
||||
|
||||
/**
|
||||
* Returns the size of a block of memory. Returns -1
|
||||
* if the size is not available.
|
||||
*
|
||||
* @param ptr - the block of memory
|
||||
* @result the size or -1 if not available
|
||||
*/
|
||||
NS_IMETHOD_(PRInt32)
|
||||
GetSize(void* ptr) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether the block of memory was allocated by this
|
||||
* memory allocator. Returns PR_FALSE if this information is
|
||||
* not available.
|
||||
*
|
||||
* @param ptr - the block of memory
|
||||
* @result true if allocated by this nsIMalloc, false if not or
|
||||
* if it can't be determined
|
||||
*/
|
||||
NS_IMETHOD_(PRBool)
|
||||
DidAlloc(void* ptr) = 0;
|
||||
|
||||
/**
|
||||
* Attempts to shrink the heap.
|
||||
*/
|
||||
NS_IMETHOD_(void)
|
||||
HeapMinimize(void) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IMALLOC_IID \
|
||||
{ /* c4744e60-1875-11d2-815f-006008119d7a */ \
|
||||
0xc4744e60, \
|
||||
0x1875, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5f, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIMalloc_h___ */
|
||||
121
mozilla/modules/plugin/base/public/nsIPlugin.h
Normal file
121
mozilla/modules/plugin/base/public/nsIPlugin.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPlugin_h___
|
||||
#define nsIPlugin_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsIFactory.h"
|
||||
|
||||
/**
|
||||
* The nsIPlugin interface is the minimum interface plugin developers need to
|
||||
* support in order to implement a plugin. The plugin manager may QueryInterface
|
||||
* for more specific plugin types, e.g. nsILiveConnectPlugin.
|
||||
*
|
||||
* The old NPP_New plugin operation is now subsumed by two operations:
|
||||
*
|
||||
* CreateInstance -- called once, after the plugin instance is created. This
|
||||
* method is used to initialize the new plugin instance (although the actual
|
||||
* plugin instance object will be created by the plugin manager).
|
||||
*
|
||||
* nsIPluginInstance::Start -- called when the plugin instance is to be
|
||||
* started. This happens in two circumstances: (1) after the plugin instance
|
||||
* is first initialized, and (2) after a plugin instance is returned to
|
||||
* (e.g. by going back in the window history) after previously being stopped
|
||||
* by the Stop method.
|
||||
*/
|
||||
struct nsIPlugin : public nsIFactory {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initializes the plugin and will be called before any new instances are
|
||||
* created. It is passed browserInterfaces on which QueryInterface
|
||||
* may be used to obtain an nsIPluginManager, and other interfaces.
|
||||
*
|
||||
* @param browserInterfaces - an object that allows access to other browser
|
||||
* interfaces via QueryInterface
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
Initialize(nsISupports* browserInterfaces) = 0;
|
||||
|
||||
/**
|
||||
* Called when the browser is done with the plugin factory, or when
|
||||
* the plugin is disabled by the user.
|
||||
*
|
||||
* (Corresponds to NPP_Shutdown.)
|
||||
*
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
Shutdown(void) = 0;
|
||||
|
||||
/**
|
||||
* Returns the MIME description for the plugin. The MIME description
|
||||
* is a colon-separated string containg the plugin MIME type, plugin
|
||||
* data file extension, and plugin name, e.g.:
|
||||
*
|
||||
* "application/x-simple-plugin:smp:Simple LiveConnect Sample Plug-in"
|
||||
*
|
||||
* (Corresponds to NPP_GetMIMEDescription.)
|
||||
*
|
||||
* @param resultingDesc - the resulting MIME description
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetMIMEDescription(const char* *resultingDesc) = 0;
|
||||
|
||||
/**
|
||||
* Returns the value of a variable associated with the plugin.
|
||||
*
|
||||
* (Corresponds to NPP_GetValue.)
|
||||
*
|
||||
* @param variable - the plugin variable to get
|
||||
* @param value - the address of where to store the resulting value
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginVariable variable, void *value) = 0;
|
||||
};
|
||||
|
||||
#define NS_IPLUGIN_IID \
|
||||
{ /* df773070-0199-11d2-815b-006008119d7a */ \
|
||||
0xdf773070, \
|
||||
0x0199, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPlugin_h___ */
|
||||
65
mozilla/modules/plugin/base/public/nsIPluginInputStream.h
Normal file
65
mozilla/modules/plugin/base/public/nsIPluginInputStream.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginInputStream_h___
|
||||
#define nsIPluginInputStream_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
||||
/**
|
||||
* The nsIPluginInputStream interface ...
|
||||
*/
|
||||
class nsIPluginInputStream : public nsIInputStream {
|
||||
public:
|
||||
|
||||
// (Corresponds to NPStream's lastmodified field.)
|
||||
NS_IMETHOD
|
||||
GetLastModified(PRUint32 *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
RequestRead(nsByteRange* rangeList) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGININPUTSTREAM_IID \
|
||||
{ /* af160530-542a-11d2-8164-006008119d7a */ \
|
||||
0xaf160530, \
|
||||
0x542a, \
|
||||
0x11d2, \
|
||||
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginInputStream_h___ */
|
||||
66
mozilla/modules/plugin/base/public/nsIPluginInputStream2.h
Normal file
66
mozilla/modules/plugin/base/public/nsIPluginInputStream2.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginInputStream2_h___
|
||||
#define nsIPluginInputStream2_h___
|
||||
|
||||
#include "nsIPluginInputStream.h"
|
||||
|
||||
/**
|
||||
* The nsIPluginInputStream2 interface ...
|
||||
*/
|
||||
class nsIPluginInputStream2 : public nsIPluginInputStream {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
GetContentLength(PRUint32 *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetHeaderFields(PRUint16& n, const char*const*& names, const char*const*& values) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetHeaderField(const char* name, const char* *result) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGININPUTSTREAM2_IID \
|
||||
{ /* cfb36db0-542a-11d2-8164-006008119d7a */ \
|
||||
0xcfb36db0, \
|
||||
0x542a, \
|
||||
0x11d2, \
|
||||
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginInputStream2_h___ */
|
||||
196
mozilla/modules/plugin/base/public/nsIPluginInstance.h
Normal file
196
mozilla/modules/plugin/base/public/nsIPluginInstance.h
Normal file
@@ -0,0 +1,196 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginInstance_h___
|
||||
#define nsIPluginInstance_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsIEventHandler.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Instance Interface
|
||||
|
||||
/**
|
||||
* The nsIPluginInstance interface is the minimum interface plugin developers
|
||||
* need to support in order to implement a plugin instance. The plugin manager
|
||||
* may QueryInterface for more specific types, e.g. nsILiveConnectPluginInstance.
|
||||
*
|
||||
* (Corresponds to NPP object.)
|
||||
*
|
||||
* The old NPP_Destroy call has been factored into two plugin instance
|
||||
* methods:
|
||||
*
|
||||
* Stop -- called when the plugin instance is to be stopped (e.g. by
|
||||
* displaying another plugin manager window, causing the page containing
|
||||
* the plugin to become removed from the display).
|
||||
*
|
||||
* Destroy -- called once, before the plugin instance peer is to be
|
||||
* destroyed. This method is used to destroy the plugin instance.
|
||||
*/
|
||||
class nsIPluginInstance : public nsIEventHandler {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initializes a newly created plugin instance, passing to it the plugin
|
||||
* instance peer which it should use for all communication back to the browser.
|
||||
*
|
||||
* @param peer - the corresponding plugin instance peer
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
Initialize(nsIPluginInstancePeer* peer) = 0;
|
||||
|
||||
/**
|
||||
* Returns a reference back to the plugin instance peer. This method is
|
||||
* used whenever the browser needs to obtain the peer back from a plugin
|
||||
* instance. The implementation of this method should be sure to increment
|
||||
* the reference count on the peer by calling AddRef.
|
||||
*
|
||||
* @param resultingPeer - the resulting plugin instance peer
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetPeer(nsIPluginInstancePeer* *resultingPeer) = 0;
|
||||
|
||||
/**
|
||||
* Called to instruct the plugin instance to start. This will be called after
|
||||
* the plugin is first created and initialized, and may be called after the
|
||||
* plugin is stopped (via the Stop method) if the plugin instance is returned
|
||||
* to in the browser window's history.
|
||||
*
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
Start(void) = 0;
|
||||
|
||||
/**
|
||||
* Called to instruct the plugin 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 plugin goes into the window's history
|
||||
* list.
|
||||
*
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
Stop(void) = 0;
|
||||
|
||||
/**
|
||||
* Called to instruct the plugin instance to destroy itself. This is called when
|
||||
* it become no longer possible to return to the plugin 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.
|
||||
*
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
Destroy(void) = 0;
|
||||
|
||||
/**
|
||||
* Called when the window containing the plugin instance changes.
|
||||
*
|
||||
* (Corresponds to NPP_SetWindow.)
|
||||
*
|
||||
* @param window - the plugin window structure
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
SetWindow(nsPluginWindow* window) = 0;
|
||||
|
||||
#ifndef NEW_PLUGIN_STREAM_API
|
||||
/**
|
||||
* Called when a new plugin stream must be constructed in order for the plugin
|
||||
* instance to receive a stream of data from the browser.
|
||||
*
|
||||
* (Corresponds to NPP_NewStream.)
|
||||
*
|
||||
* @param peer - the plugin stream peer, representing information about the
|
||||
* incoming stream, and stream-specific callbacks into the browser
|
||||
* @param result - the resulting plugin stream
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
NewStream(nsIPluginStreamPeer* peer, nsIPluginStream* *result) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Called to instruct the plugin instance to print itself to a printer.
|
||||
*
|
||||
* (Corresponds to NPP_Print.)
|
||||
*
|
||||
* @param platformPrint - platform-specific printing information
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
Print(nsPluginPrint* platformPrint) = 0;
|
||||
|
||||
#ifndef NEW_PLUGIN_STREAM_API
|
||||
/**
|
||||
* Called to notify the plugin instance that a URL request has been
|
||||
* completed. (See nsIPluginManager::GetURL and nsIPluginManager::PostURL).
|
||||
*
|
||||
* (Corresponds to NPP_URLNotify.)
|
||||
*
|
||||
* @param url - the requested URL
|
||||
* @param target - the target window name
|
||||
* @param reason - the reason for completion
|
||||
* @param notifyData - the notify data supplied to GetURL or PostURL
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
URLNotify(const char* url, const char* target,
|
||||
nsPluginReason reason, void* notifyData) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the value of a variable associated with the plugin instance.
|
||||
*
|
||||
* @param variable - the plugin instance variable to get
|
||||
* @param value - the address of where to store the resulting value
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginInstanceVariable variable, void *value) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGININSTANCE_IID \
|
||||
{ /* ebe00f40-0199-11d2-815b-006008119d7a */ \
|
||||
0xebe00f40, \
|
||||
0x0199, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginInstance_h___ */
|
||||
142
mozilla/modules/plugin/base/public/nsIPluginInstancePeer.h
Normal file
142
mozilla/modules/plugin/base/public/nsIPluginInstancePeer.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginInstancePeer_h___
|
||||
#define nsIPluginInstancePeer_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIOutputStream;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Instance Peer Interface
|
||||
|
||||
/**
|
||||
* The nsIPluginInstancePeer interface is the set of operations implemented
|
||||
* by the browser to support a plugin instance. When a plugin instance is
|
||||
* constructed, a nsIPluginInstancePeer is passed to its initializer
|
||||
* representing the instantiation of the plugin on the page.
|
||||
*
|
||||
* Other interfaces may be obtained from nsIPluginInstancePeer by calling
|
||||
* QueryInterface, e.g. nsIPluginTagInfo.
|
||||
*/
|
||||
class nsIPluginInstancePeer : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the value of a variable associated with the plugin manager.
|
||||
*
|
||||
* (Corresponds to NPN_GetValue.)
|
||||
*
|
||||
* @param variable - the plugin manager variable to get
|
||||
* @param value - the address of where to store the resulting value
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginInstancePeerVariable variable, void *value) = 0;
|
||||
|
||||
/**
|
||||
* Returns the MIME type of the plugin instance.
|
||||
*
|
||||
* (Corresponds to NPP_New's MIMEType argument.)
|
||||
*
|
||||
* @param result - resulting MIME type
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetMIMEType(nsMIMEType *result) = 0;
|
||||
|
||||
/**
|
||||
* Returns the mode of the plugin instance, i.e. whether the plugin is
|
||||
* embedded in the html, or full page.
|
||||
*
|
||||
* (Corresponds to NPP_New's mode argument.)
|
||||
*
|
||||
* @param result - the resulting mode
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetMode(nsPluginMode *result) = 0;
|
||||
|
||||
/**
|
||||
* This operation is called by the plugin instance when it wishes to send
|
||||
* a stream of data to the browser. It constructs a new output stream to which
|
||||
* the plugin may send the data. When complete, the Close and Release methods
|
||||
* should be called on the output stream.
|
||||
*
|
||||
* (Corresponds to NPN_NewStream.)
|
||||
*
|
||||
* @param type - type MIME type of the stream to create
|
||||
* @param target - the target window name to receive the data
|
||||
* @param result - the resulting output stream
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
NewStream(nsMIMEType type, const char* target, nsIOutputStream* *result) = 0;
|
||||
|
||||
/**
|
||||
* This operation causes status information to be displayed on the window
|
||||
* associated with the plugin instance.
|
||||
*
|
||||
* (Corresponds to NPN_Status.)
|
||||
*
|
||||
* @param message - the status message to display
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
ShowStatus(const char* message) = 0;
|
||||
|
||||
/**
|
||||
* Set the desired size of the window in which the plugin instance lives.
|
||||
*
|
||||
* @param width - new window width
|
||||
* @param height - new window height
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
SetWindowSize(PRUint32 width, PRUint32 height) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGININSTANCEPEER_IID \
|
||||
{ /* 4b7cea20-019b-11d2-815b-006008119d7a */ \
|
||||
0x4b7cea20, \
|
||||
0x019b, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginInstancePeer_h___ */
|
||||
191
mozilla/modules/plugin/base/public/nsIPluginManager.h
Normal file
191
mozilla/modules/plugin/base/public/nsIPluginManager.h
Normal file
@@ -0,0 +1,191 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginManager_h___
|
||||
#define nsIPluginManager_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIPluginStreamListener;
|
||||
|
||||
/**
|
||||
* The nsIPluginManager interface defines the minimum set of functionality that
|
||||
* the browser will support if it allows plugins. Plugins can call QueryInterface
|
||||
* to determine if a plugin manager implements more specific APIs or other
|
||||
* browser interfaces for the plugin to use (e.g. nsINetworkManager).
|
||||
*/
|
||||
class nsIPluginManager : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the value of a variable associated with the plugin manager.
|
||||
*
|
||||
* (Corresponds to NPN_GetValue.)
|
||||
*
|
||||
* @param variable - the plugin manager variable to get
|
||||
* @param value - the address of where to store the resulting value
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginManagerVariable variable, void *value) = 0;
|
||||
|
||||
/**
|
||||
* Causes the plugins directory to be searched again for new plugin
|
||||
* libraries.
|
||||
*
|
||||
* (Corresponds to NPN_ReloadPlugins.)
|
||||
*
|
||||
* @param reloadPages - indicates whether currently visible pages should
|
||||
* also be reloaded
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
ReloadPlugins(PRBool reloadPages) = 0;
|
||||
|
||||
/**
|
||||
* Returns the user agent string for the browser.
|
||||
*
|
||||
* (Corresponds to NPN_UserAgent.)
|
||||
*
|
||||
* @param resultingAgentString - the resulting user agent string
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
UserAgent(const char* *resultingAgentString) = 0;
|
||||
|
||||
#ifdef NEW_PLUGIN_STREAM_API
|
||||
|
||||
NS_IMETHOD
|
||||
GetURL(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
const char* target = NULL,
|
||||
nsIPluginStreamListener* streamListener = NULL,
|
||||
nsPluginStreamType streamType = nsPluginStreamType_Normal,
|
||||
const char* altHost = NULL,
|
||||
const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
PostURL(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
PRUint32 postDataLen,
|
||||
const char* postData,
|
||||
PRBool isFile = PR_FALSE,
|
||||
const char* target = NULL,
|
||||
nsIPluginStreamListener* streamListener = NULL,
|
||||
nsPluginStreamType streamType = nsPluginStreamType_Normal,
|
||||
const char* altHost = NULL,
|
||||
const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE,
|
||||
PRUint32 postHeadersLength = 0,
|
||||
const char* postHeaders = NULL) = 0;
|
||||
|
||||
#else // !NEW_PLUGIN_STREAM_API
|
||||
/**
|
||||
* Fetches a URL.
|
||||
*
|
||||
* (Corresponds to NPN_GetURL and NPN_GetURLNotify.)
|
||||
*
|
||||
* @param pluginInst - the plugin 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
|
||||
* @param notifyData - when present, URLNotify is called passing the
|
||||
* notifyData back to the client. When NULL, this call behaves like
|
||||
* NPN_GetURL.
|
||||
* @param altHost - an IP-address string that will be used instead of the
|
||||
* host specified in the URL. This is used to prevent DNS-spoofing
|
||||
* attacks. Can be defaulted to NULL meaning use the host in the URL.
|
||||
* @param referrer - the referring URL (may be NULL)
|
||||
* @param forceJSEnabled - forces JavaScript to be enabled for 'javascript:'
|
||||
* URLs, even if the user currently has JavaScript disabled (usually
|
||||
* specify PR_FALSE)
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetURL(nsISupports* pluginInst, const char* url, const char* target,
|
||||
void* notifyData = NULL, const char* altHost = NULL,
|
||||
const char* referrer = NULL, PRBool forceJSEnabled = PR_FALSE) = 0;
|
||||
|
||||
/**
|
||||
* Posts to a URL with post data and/or post headers.
|
||||
*
|
||||
* (Corresponds to NPN_PostURL and NPN_PostURLNotify.)
|
||||
*
|
||||
* @param pluginInst - the plugin 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
|
||||
* @param postDataLength - the length of postData (if non-NULL)
|
||||
* @param postData - the data to POST. NULL specifies that there is not post
|
||||
* data
|
||||
* @param isFile - whether the postData specifies the name of a file to
|
||||
* post instead of data. The file will be deleted afterwards.
|
||||
* @param notifyData - when present, URLNotify is called passing the
|
||||
* notifyData back to the client. When NULL, this call behaves like
|
||||
* NPN_GetURL.
|
||||
* @param altHost - an IP-address string that will be used instead of the
|
||||
* host specified in the URL. This is used to prevent DNS-spoofing
|
||||
* attacks. Can be defaulted to NULL meaning use the host in the URL.
|
||||
* @param referrer - the referring URL (may be NULL)
|
||||
* @param forceJSEnabled - forces JavaScript to be enabled for 'javascript:'
|
||||
* URLs, even if the user currently has JavaScript disabled (usually
|
||||
* specify PR_FALSE)
|
||||
* @param postHeadersLength - the length of postHeaders (if non-NULL)
|
||||
* @param postHeaders - the headers to POST. NULL specifies that there
|
||||
* are no post headers
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
PostURL(nsISupports* pluginInst, const char* url, const char* target,
|
||||
PRUint32 postDataLen, const char* postData,
|
||||
PRBool isFile = PR_FALSE, void* notifyData = NULL,
|
||||
const char* altHost = NULL, const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE,
|
||||
PRUint32 postHeadersLength = 0, const char* postHeaders = NULL) = 0;
|
||||
#endif // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGINMANAGER_IID \
|
||||
{ /* da58ad80-4eb6-11d2-8164-006008119d7a */ \
|
||||
0xda58ad80, \
|
||||
0x4eb6, \
|
||||
0x11d2, \
|
||||
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginManager_h___ */
|
||||
188
mozilla/modules/plugin/base/public/nsIPluginManager2.h
Normal file
188
mozilla/modules/plugin/base/public/nsIPluginManager2.h
Normal file
@@ -0,0 +1,188 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginManager2_h___
|
||||
#define nsIPluginManager2_h___
|
||||
|
||||
#include "nsIPluginManager.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Manager 2 Interface
|
||||
// These extensions to nsIPluginManager are only available in Communicator 5.0.
|
||||
|
||||
class nsIPluginManager2 : public nsIPluginManager {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Puts up a wait cursor.
|
||||
*
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
BeginWaitCursor(void) = 0;
|
||||
|
||||
/**
|
||||
* Restores the previous (non-wait) cursor.
|
||||
*
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
EndWaitCursor(void) = 0;
|
||||
|
||||
/**
|
||||
* Returns true if a URL protocol (e.g. "http") is supported.
|
||||
*
|
||||
* @param protocol - the protocol name
|
||||
* @param result - true if the protocol is supported
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
SupportsURLProtocol(const char* protocol, PRBool *result) = 0;
|
||||
|
||||
/**
|
||||
* This method may be called by the plugin to indicate that an error
|
||||
* has occurred, e.g. that the plugin has failed or is shutting down
|
||||
* spontaneously. This allows the browser to clean up any plugin-specific
|
||||
* state.
|
||||
*
|
||||
* @param plugin - the plugin whose status is changing
|
||||
* @param errorStatus - the the error status value
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
NotifyStatusChange(nsIPlugin* plugin, nsresult errorStatus) = 0;
|
||||
|
||||
/**
|
||||
* Returns the proxy info for a given URL. The caller is required to
|
||||
* free the resulting memory with nsIMalloc::Free. The result will be in the
|
||||
* following format
|
||||
*
|
||||
* i) "DIRECT" -- no proxy
|
||||
* ii) "PROXY xxx.xxx.xxx.xxx" -- use proxy
|
||||
* iii) "SOCKS xxx.xxx.xxx.xxx" -- use SOCKS
|
||||
* iv) Mixed. e.g. "PROXY 111.111.111.111;PROXY 112.112.112.112",
|
||||
* "PROXY 111.111.111.111;SOCKS 112.112.112.112"....
|
||||
*
|
||||
* Which proxy/SOCKS to use is determined by the plugin.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
FindProxyForURL(const char* url, char* *result) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// New top-level window handling calls for Mac:
|
||||
|
||||
/**
|
||||
* Registers a top-level window with the browser. Events received by that
|
||||
* window will be dispatched to the event handler specified.
|
||||
*
|
||||
* @param handler - the event handler for the window
|
||||
* @param window - the platform window reference
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
RegisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window) = 0;
|
||||
|
||||
/**
|
||||
* Unregisters a top-level window with the browser. The handler and window pair
|
||||
* should be the same as that specified to RegisterWindow.
|
||||
*
|
||||
* @param handler - the event handler for the window
|
||||
* @param window - the platform window reference
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
UnregisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window) = 0;
|
||||
|
||||
/**
|
||||
* Allocates a new menu ID (for the Mac).
|
||||
*
|
||||
* @param handler - the event handler for the window
|
||||
* @param isSubmenu - whether this is a sub-menu ID or not
|
||||
* @param result - the resulting menu ID
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
AllocateMenuID(nsIEventHandler* handler, PRBool isSubmenu, PRInt16 *result) = 0;
|
||||
|
||||
/**
|
||||
* Deallocates a menu ID (for the Mac).
|
||||
*
|
||||
* @param handler - the event handler for the window
|
||||
* @param menuID - the menu ID
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
DeallocateMenuID(nsIEventHandler* handler, PRInt16 menuID) = 0;
|
||||
|
||||
/**
|
||||
* Indicates whether this event handler has allocated the given menu ID.
|
||||
*
|
||||
* @param handler - the event handler for the window
|
||||
* @param menuID - the menu ID
|
||||
* @param result - returns PR_TRUE if the menu ID is allocated
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
HasAllocatedMenuID(nsIEventHandler* handler, PRInt16 menuID, PRBool *result) = 0;
|
||||
|
||||
#if 0 // problematic
|
||||
/**
|
||||
* This operation causes the next browser event to be processed. This is
|
||||
* handy for implement nested event loops where some other activity must
|
||||
* be performed each time around the loop.
|
||||
*
|
||||
* On the Mac (and most likely on Win16), network activity can only occur on
|
||||
* the main thread. Therefore, we provide a hook here for the case that the
|
||||
* main thread needs to process events while waiting for network activity to
|
||||
* complete.
|
||||
*
|
||||
* @param bEventHandled - a boolean indicating whether an event was processed on the
|
||||
* main thread. If not on the main browser thread, PR_FALSE is returned.
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
ProcessNextEvent(PRBool *bEventHandled) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define NS_IPLUGINMANAGER2_IID \
|
||||
{ /* d2962dc0-4eb6-11d2-8164-006008119d7a */ \
|
||||
0xd2962dc0, \
|
||||
0x4eb6, \
|
||||
0x11d2, \
|
||||
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginManager2_h___ */
|
||||
89
mozilla/modules/plugin/base/public/nsIPluginStream.h
Normal file
89
mozilla/modules/plugin/base/public/nsIPluginStream.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginStream_h___
|
||||
#define nsIPluginStream_h___
|
||||
|
||||
#ifndef NEW_PLUGIN_STREAM_API
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsIOutputStream.h"
|
||||
|
||||
/**
|
||||
* The nsIPluginStream interface specifies the minimal set of operations that
|
||||
* must be implemented by a plugin stream in order to receive data from the
|
||||
* browser. When a nsIPluginManager::GetURL request is made, a subsequent
|
||||
* nsIPluginInstance::NewStream request will be made to instruct the plugin
|
||||
* instance to construct a new stream to receive the data.
|
||||
*/
|
||||
class nsIPluginStream : public nsIOutputStream {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the stream type of a stream.
|
||||
*
|
||||
* (Corresponds to NPP_NewStream's stype return parameter.)
|
||||
*
|
||||
* @param result - the resulting stream type
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetStreamType(nsPluginStreamType *result) = 0;
|
||||
|
||||
/**
|
||||
* This operation passes to the plugin the name of the file which
|
||||
* contains the stream data.
|
||||
*
|
||||
* (Corresponds to NPP_StreamAsFile.)
|
||||
*
|
||||
* @param fname - the file name
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
NS_IMETHOD
|
||||
AsFile(const char* fname) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGINSTREAM_IID \
|
||||
{ /* f287dd50-0199-11d2-815b-006008119d7a */ \
|
||||
0xf287dd50, \
|
||||
0x0199, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
#endif // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginStream_h___ */
|
||||
110
mozilla/modules/plugin/base/public/nsIPluginStreamListener.h
Normal file
110
mozilla/modules/plugin/base/public/nsIPluginStreamListener.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginStreamListener_h___
|
||||
#define nsIPluginStreamListener_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIPluginInputStream;
|
||||
|
||||
struct nsPluginStreamInfo {
|
||||
nsMIMEType contentType;
|
||||
PRBool seekable;
|
||||
// more...
|
||||
};
|
||||
|
||||
/**
|
||||
* The nsIPluginStreamListener interface defines the minimum set of functionality that
|
||||
* the browser will support if it allows plugins. Plugins can call QueryInterface
|
||||
* to determine if a plugin manager implements more specific APIs or other
|
||||
* browser interfaces for the plugin to use (e.g. nsINetworkManager).
|
||||
*/
|
||||
class nsIPluginStreamListener : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Notify the observer that the URL has started to load. This method is
|
||||
* called only once, at the beginning of a URL load.<BR><BR>
|
||||
*
|
||||
* @return The return value is currently ignored. In the future it may be
|
||||
* used to cancel the URL load..
|
||||
*/
|
||||
NS_IMETHOD
|
||||
OnStartBinding(const char* url, const nsPluginStreamInfo* info) = 0;
|
||||
|
||||
/**
|
||||
* Notify the client that data is available in the input stream. This
|
||||
* method is called whenver data is written into the input stream by the
|
||||
* networking library...<BR><BR>
|
||||
*
|
||||
* @param aIStream The input stream containing the data. This stream can
|
||||
* be either a blocking or non-blocking stream.
|
||||
* @param length The amount of data that was just pushed into the stream.
|
||||
* @return The return value is currently ignored.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
OnDataAvailable(const char* url, nsIPluginInputStream* input,
|
||||
PRUint32 offset, PRUint32 length) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
OnFileAvailable(const char* url, const char* fileName) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that the URL has finished loading. This method is
|
||||
* called once when the networking library has finished processing the
|
||||
* URL transaction initiatied via the nsINetService::Open(...) call.<BR><BR>
|
||||
*
|
||||
* This method is called regardless of whether the URL loaded successfully.<BR><BR>
|
||||
*
|
||||
* @param status Status code for the URL load.
|
||||
* @param msg A text string describing the error.
|
||||
* @return The return value is currently ignored.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
OnStopBinding(const char* url, nsresult status) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGINSTREAMLISTENER_IID \
|
||||
{ /* df055770-5448-11d2-8164-006008119d7a */ \
|
||||
0xdf055770, \
|
||||
0x5448, \
|
||||
0x11d2, \
|
||||
{0x81, 0x64, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginStreamListener_h___ */
|
||||
89
mozilla/modules/plugin/base/public/nsIPluginStreamPeer.h
Normal file
89
mozilla/modules/plugin/base/public/nsIPluginStreamPeer.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginStreamPeer_h___
|
||||
#define nsIPluginStreamPeer_h___
|
||||
|
||||
#ifndef NEW_PLUGIN_STREAM_API
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Stream Peer Interface
|
||||
// A plugin stream peer is passed to a plugin instance's NewStream call in
|
||||
// order to indicate that a new stream is to be created and be read by the
|
||||
// plugin instance.
|
||||
|
||||
class nsIPluginStreamPeer : public nsISupports {
|
||||
public:
|
||||
|
||||
// (Corresponds to NPStream's url field.)
|
||||
NS_IMETHOD
|
||||
GetURL(const char* *result) = 0;
|
||||
|
||||
// (Corresponds to NPStream's end field.)
|
||||
NS_IMETHOD
|
||||
GetEnd(PRUint32 *result) = 0;
|
||||
|
||||
// (Corresponds to NPStream's lastmodified field.)
|
||||
NS_IMETHOD
|
||||
GetLastModified(PRUint32 *result) = 0;
|
||||
|
||||
// (Corresponds to NPStream's notifyData field.)
|
||||
NS_IMETHOD
|
||||
GetNotifyData(void* *result) = 0;
|
||||
|
||||
// (Corresponds to NPP_DestroyStream's reason argument.)
|
||||
NS_IMETHOD
|
||||
GetReason(nsPluginReason *result) = 0;
|
||||
|
||||
// (Corresponds to NPP_NewStream's MIMEType argument.)
|
||||
NS_IMETHOD
|
||||
GetMIMEType(nsMIMEType *result) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGINSTREAMPEER_IID \
|
||||
{ /* 717b1e90-019b-11d2-815b-006008119d7a */ \
|
||||
0x717b1e90, \
|
||||
0x019b, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
#endif // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginStreamPeer_h___ */
|
||||
74
mozilla/modules/plugin/base/public/nsIPluginStreamPeer2.h
Normal file
74
mozilla/modules/plugin/base/public/nsIPluginStreamPeer2.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginStreamPeer2_h___
|
||||
#define nsIPluginStreamPeer2_h___
|
||||
|
||||
#ifndef NEW_PLUGIN_STREAM_API
|
||||
|
||||
#include "nsIPluginStreamPeer.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Stream Peer Interface
|
||||
// These extensions to nsIPluginStreamPeer are only available in Communicator 5.0.
|
||||
|
||||
class nsIPluginStreamPeer2 : public nsIPluginStreamPeer {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
GetContentLength(PRUint32 *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetHeaderFieldCount(PRUint32 *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetHeaderFieldKey(PRUint32 index, const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetHeaderField(PRUint32 index, const char* *result) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGINSTREAMPEER2_IID \
|
||||
{ /* 77083af0-019b-11d2-815b-006008119d7a */ \
|
||||
0x77083af0, \
|
||||
0x019b, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
#endif // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginStreamPeer2_h___ */
|
||||
82
mozilla/modules/plugin/base/public/nsIPluginTagInfo.h
Normal file
82
mozilla/modules/plugin/base/public/nsIPluginTagInfo.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginTagInfo_h___
|
||||
#define nsIPluginTagInfo_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Tag Info Interface
|
||||
// This interface provides information about the HTML tag on the page.
|
||||
// Some day this might get superseded by a DOM API.
|
||||
|
||||
class nsIPluginTagInfo : public nsISupports {
|
||||
public:
|
||||
|
||||
// QueryInterface on nsIPluginInstancePeer to get this.
|
||||
|
||||
// (Corresponds to NPP_New's argc, argn, and argv arguments.)
|
||||
// Get a ptr to the paired list of attribute names and values,
|
||||
// returns the length of the array.
|
||||
//
|
||||
// Each name or value is a null-terminated string.
|
||||
NS_IMETHOD
|
||||
GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values) = 0;
|
||||
|
||||
/**
|
||||
* Gets the value for the named attribute.
|
||||
*
|
||||
* @param name - the name of the attribute to find
|
||||
* @param result - the resulting attribute
|
||||
* @result - NS_OK if this operation was successful, NS_ERROR_FAILURE if
|
||||
* this operation failed. result is set to NULL if the attribute is not found
|
||||
* else to the found value.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetAttribute(const char* name, const char* *result) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGINTAGINFO_IID \
|
||||
{ /* 5f1ec1d0-019b-11d2-815b-006008119d7a */ \
|
||||
0x5f1ec1d0, \
|
||||
0x019b, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginTagInfo_h___ */
|
||||
120
mozilla/modules/plugin/base/public/nsIPluginTagInfo2.h
Normal file
120
mozilla/modules/plugin/base/public/nsIPluginTagInfo2.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIPluginTagInfo2_h___
|
||||
#define nsIPluginTagInfo2_h___
|
||||
|
||||
#include "nsIPluginTagInfo.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Tag Info Interface
|
||||
// These extensions to nsIPluginTagInfo are only available in Communicator 5.0.
|
||||
|
||||
enum nsPluginTagType {
|
||||
nsPluginTagType_Unknown,
|
||||
nsPluginTagType_Embed,
|
||||
nsPluginTagType_Object,
|
||||
nsPluginTagType_Applet
|
||||
};
|
||||
|
||||
class nsIPluginTagInfo2 : public nsIPluginTagInfo {
|
||||
public:
|
||||
|
||||
// QueryInterface on nsIPluginInstancePeer to get this.
|
||||
|
||||
// Get the type of the HTML tag that was used ot instantiate this
|
||||
// plugin. Currently supported tags are EMBED, OBJECT and APPLET.
|
||||
NS_IMETHOD
|
||||
GetTagType(nsPluginTagType *result) = 0;
|
||||
|
||||
// Get the complete text of the HTML tag that was
|
||||
// used to instantiate this plugin
|
||||
NS_IMETHOD
|
||||
GetTagText(const char* *result) = 0;
|
||||
|
||||
// Get a ptr to the paired list of parameter names and values,
|
||||
// returns the length of the array.
|
||||
//
|
||||
// Each name or value is a null-terminated string.
|
||||
NS_IMETHOD
|
||||
GetParameters(PRUint16& n, const char*const*& names, const char*const*& values) = 0;
|
||||
|
||||
// Get the value for the named parameter. Returns null
|
||||
// if the parameter was not set.
|
||||
// @result - NS_OK if this operation was successful, NS_ERROR_FAILURE if
|
||||
// this operation failed. result is set to NULL if the attribute is not found
|
||||
// else to the found value.
|
||||
NS_IMETHOD
|
||||
GetParameter(const char* name, const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetDocumentBase(const char* *result) = 0;
|
||||
|
||||
// Return an encoding whose name is specified in:
|
||||
// http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303
|
||||
NS_IMETHOD
|
||||
GetDocumentEncoding(const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetAlignment(const char* *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetWidth(PRUint32 *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetHeight(PRUint32 *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetBorderVertSpace(PRUint32 *result) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
GetBorderHorizSpace(PRUint32 *result) = 0;
|
||||
|
||||
// Returns a unique id for the current document on which the
|
||||
// plugin is displayed.
|
||||
NS_IMETHOD
|
||||
GetUniqueID(PRUint32 *result) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IPLUGINTAGINFO2_IID \
|
||||
{ /* 6a49c9a0-019b-11d2-815b-006008119d7a */ \
|
||||
0x6a49c9a0, \
|
||||
0x019b, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIPluginTagInfo2_h___ */
|
||||
@@ -0,0 +1,72 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsISeekablePluginStreamPeer_h___
|
||||
#define nsISeekablePluginStreamPeer_h___
|
||||
|
||||
#ifndef NEW_PLUGIN_STREAM_API
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Seekable Plugin Stream Peer Interface
|
||||
// The browser implements this subclass of plugin stream peer if a stream
|
||||
// is seekable. Plugins can query interface for this type, and call the
|
||||
// RequestRead method to seek to a particular position in the stream.
|
||||
|
||||
class nsISeekablePluginStreamPeer : public nsISupports {
|
||||
public:
|
||||
|
||||
// QueryInterface for this class corresponds to NPP_NewStream's
|
||||
// seekable argument.
|
||||
|
||||
// (Corresponds to NPN_RequestRead.)
|
||||
NS_IMETHOD
|
||||
RequestRead(nsByteRange* rangeList) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ISEEKABLEPLUGINSTREAMPEER_IID \
|
||||
{ /* 7e028d20-019b-11d2-815b-006008119d7a */ \
|
||||
0x7e028d20, \
|
||||
0x019b, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
#endif // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsISeekablePluginStreamPeer_h___ */
|
||||
@@ -0,0 +1,70 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this interface fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsIWindowlessPluginInstancePeer_h___
|
||||
#define nsIWindowlessPluginInstancePeer_h___
|
||||
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Windowless Plugin Instance Peer Interface
|
||||
|
||||
class nsIWindowlessPluginInstancePeer : public nsISupports {
|
||||
public:
|
||||
|
||||
// (Corresponds to NPN_InvalidateRect.)
|
||||
NS_IMETHOD
|
||||
InvalidateRect(nsPluginRect *invalidRect) = 0;
|
||||
|
||||
// (Corresponds to NPN_InvalidateRegion.)
|
||||
NS_IMETHOD
|
||||
InvalidateRegion(nsPluginRegion invalidRegion) = 0;
|
||||
|
||||
// (Corresponds to NPN_ForceRedraw.)
|
||||
NS_IMETHOD
|
||||
ForceRedraw(void) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IWINDOWLESSPLUGININSTANCEPEER_IID \
|
||||
{ /* 57b4e2f0-019b-11d2-815b-006008119d7a */ \
|
||||
0x57b4e2f0, \
|
||||
0x019b, \
|
||||
0x11d2, \
|
||||
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIWindowlessPluginInstancePeer_h___ */
|
||||
264
mozilla/modules/plugin/base/public/nsplugin.h
Normal file
264
mozilla/modules/plugin/base/public/nsplugin.h
Normal file
@@ -0,0 +1,264 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>This is the master header file that includes most of the other headers
|
||||
* you'll need to write a plugin.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The following diagram depicts the relationships between various objects
|
||||
* implementing the new plugin interfaces. QueryInterface can be used to switch
|
||||
* between interfaces in the same box:
|
||||
*
|
||||
*
|
||||
* the plugin (only 1)
|
||||
* +----------------------+
|
||||
* | nsIPlugin or |<- - - - - -NSGetFactory()
|
||||
* | nsILiveConnectPlugin |
|
||||
* +----------------------+
|
||||
* |
|
||||
* |
|
||||
* | instances (many) streams to receive URL data (many)
|
||||
* | +-------------------+ +-----------------+
|
||||
* | | nsIPluginInstance |+ | nsIPluginStream |+
|
||||
* | | || | ||
|
||||
* | +-------------------+| +-----------------+|
|
||||
* | +------|-----------+ +------|---------+
|
||||
* | | |
|
||||
* | PLUGIN SIDE |peer |peer
|
||||
*~~~~|~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~
|
||||
* | BROWSER SIDE | |
|
||||
* | v v
|
||||
* | +---------------------------------+ +----------------------------+
|
||||
* | | nsIPluginInstancePeer |+ | nsIPluginStreamPeer |+
|
||||
* | | nsIWindowlessPluginInstancePeer || | nsISeekablePluginStreamPeer||
|
||||
* | | nsILiveConnectPluginInstancePeer|| | nsIPluginstreamPeer2 ||
|
||||
* | | nsIPluginTagInfo || +----------------------------+|
|
||||
* | | nsIPluginTagInfo2 || +---------------------------+
|
||||
* | +---------------------------------+|
|
||||
* | +--------------------------------+
|
||||
* |
|
||||
* |
|
||||
* v the browser (only 1)
|
||||
* +---------------------+
|
||||
* | nsIPluginManager |
|
||||
* | nsIPluginManager2 |
|
||||
* | nsIFileUtilities |
|
||||
* | nsIPref |
|
||||
* | nsICacheManager ... |
|
||||
* +---------------------+
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef nsplugins_h___
|
||||
#define nsplugins_h___
|
||||
|
||||
#include "nsRepository.h" // for NSGetFactory
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>Interfaces which must be implemented by a plugin</B>
|
||||
* These interfaces have NPP equivalents in pre-5.0 browsers (see npapi.h).
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* NSGetFactory is the main entry point to the plugin's DLL. The plugin manager
|
||||
* finds this symbol and calls it to create the plugin class. Once the plugin
|
||||
* object is returned to the plugin manager, instances on the page are created
|
||||
* by calling nsIPlugin::CreateInstance.
|
||||
*/
|
||||
// (Declared in nsRepository.h)
|
||||
//extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass,
|
||||
// nsIFactory **aFactory);
|
||||
|
||||
/**
|
||||
* A plugin object is used to create new plugin instances. It manages the
|
||||
* global state of all plugins with the same implementation.
|
||||
*/
|
||||
#include "nsIPlugin.h"
|
||||
|
||||
/**
|
||||
* A plugin instance represents a particular activation of a plugin on a page.
|
||||
*/
|
||||
#include "nsIPluginInstance.h"
|
||||
|
||||
#ifdef NEW_PLUGIN_STREAM_API
|
||||
|
||||
/**
|
||||
* A plugin stream listener ...
|
||||
*/
|
||||
#include "nsIPluginStreamListener.h"
|
||||
|
||||
#else // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
/**
|
||||
* A plugin stream gets instantiated when a plugin instance receives data from
|
||||
* the browser.
|
||||
*/
|
||||
#include "nsIPluginStream.h"
|
||||
|
||||
#endif // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
/**
|
||||
* The nsILiveConnectPlugin interface provides additional operations that a
|
||||
* plugin must implement if it is to be controlled by JavaScript through
|
||||
* LiveConnect.
|
||||
*
|
||||
* Note that this interface is part of a new JNI-based LiveConnect
|
||||
* implementation and superceeds that provided prior to Communicator 5.0.
|
||||
*/
|
||||
#include "nsILiveConnectPlugin.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>Interfaces implemented by the browser:
|
||||
* These interfaces have NPN equivalents in pre-5.0 browsers (see npapi.h).
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The plugin manager which is the main point of interaction with the browser
|
||||
* and provides general operations needed by a plugin.
|
||||
*/
|
||||
#include "nsIPluginManager.h"
|
||||
|
||||
/**
|
||||
* A plugin instance peer gets created by the browser and associated with each
|
||||
* plugin instance to represent tag information and other callbacks needed by
|
||||
* the plugin instance.
|
||||
*/
|
||||
#include "nsIPluginInstancePeer.h"
|
||||
|
||||
/**
|
||||
* The nsIPluginTagInfo interface provides information about the html tag
|
||||
* that was used to instantiate the plugin instance.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginInstancePeer
|
||||
*/
|
||||
#include "nsIPluginTagInfo.h"
|
||||
|
||||
/**
|
||||
* The nsIWindowlessPluginInstancePeer provides additional operations for
|
||||
* windowless plugins.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginInstancePeer
|
||||
*/
|
||||
#include "nsIWindowlessPlugInstPeer.h"
|
||||
|
||||
#ifdef NEW_PLUGIN_STREAM_API
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
#include "nsIPluginInputStream.h"
|
||||
|
||||
#else // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
/**
|
||||
* A plugin stream peer gets create by the browser and associated with each
|
||||
* plugin stream to represent stream and URL information, and provides
|
||||
* other callbacks needed by the plugin stream.
|
||||
*/
|
||||
#include "nsIPluginStreamPeer.h"
|
||||
|
||||
/**
|
||||
* The nsISeekablePluginStreamPeer provides additional operations for seekable
|
||||
* plugin streams.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginStreamPeer
|
||||
*/
|
||||
#include "nsISeekablePluginStreamPeer.h"
|
||||
|
||||
#endif // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>Interfaces implemented by the browser (new for 5.0):
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The nsIPluginManager2 interface provides additional plugin manager features
|
||||
* only available in Communicator 5.0.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginManager
|
||||
*/
|
||||
#include "nsIPluginManager2.h"
|
||||
|
||||
/**
|
||||
* The nsIFileUtilities interface provides operations to manage temporary
|
||||
* files and directories.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginManager
|
||||
*/
|
||||
#include "nsIFileUtilities.h"
|
||||
|
||||
/**
|
||||
* The nsILiveConnectPluginInstancePeer allows plugins to be manipulated
|
||||
* by JavaScript, providing basic scriptability.
|
||||
*
|
||||
* Note that this interface is part of a new JNI-based LiveConnect
|
||||
* implementation and superceeds that provided prior to Communicator 5.0.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginInstancePeer
|
||||
*/
|
||||
#include "nsILiveConnectPlugInstPeer.h"
|
||||
|
||||
#ifdef NEW_PLUGIN_STREAM_API
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
#include "nsIPluginInputStream2.h"
|
||||
|
||||
#else // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
/**
|
||||
* The nsIPluginStreamPeer2 interface provides additional plugin stream
|
||||
* peer features only available in Communicator 5.0.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginStreamPeer
|
||||
*/
|
||||
#include "nsIPluginStreamPeer2.h"
|
||||
|
||||
#endif // !NEW_PLUGIN_STREAM_API
|
||||
|
||||
/**
|
||||
* The nsIPluginTagInfo2 interface provides additional html tag information
|
||||
* only available in Communicator 5.0.
|
||||
*
|
||||
* To obtain: QueryInterface on nsIPluginTagInfo
|
||||
*/
|
||||
#include "nsIPluginTagInfo2.h"
|
||||
|
||||
#include "nsIOutputStream.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // nsplugins_h___
|
||||
383
mozilla/modules/plugin/base/public/nsplugindefs.h
Normal file
383
mozilla/modules/plugin/base/public/nsplugindefs.h
Normal file
@@ -0,0 +1,383 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* <B>INTERFACE TO NETSCAPE COMMUNICATOR PLUGINS (NEW C++ API).</B>
|
||||
*
|
||||
* <P>This superscedes the old plugin API (npapi.h, npupp.h), and
|
||||
* eliminates the need for glue files: npunix.c, npwin.cpp and npmac.cpp that
|
||||
* get linked with the plugin. You will however need to link with the "backward
|
||||
* adapter" (badapter.cpp) in order to allow your plugin to run in pre-5.0
|
||||
* browsers.
|
||||
*
|
||||
* <P>See nsplugin.h for an overview of how this fits with the
|
||||
* overall plugin architecture.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsplugindefs_h___
|
||||
#define nsplugindefs_h___
|
||||
|
||||
#ifndef prtypes_h___
|
||||
#include "prtypes.h"
|
||||
#endif
|
||||
|
||||
#ifdef __OS2__
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC
|
||||
# include <Quickdraw.h>
|
||||
# include <Events.h>
|
||||
# include <MacWindows.h>
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX) && !defined(NO_X11)
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
# include <windef.h>
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* The OS/2 version of Netscape uses RC_DATA to define the
|
||||
mime types, file extentions, etc that are required.
|
||||
Use a vertical bar to seperate types, end types with \0.
|
||||
FileVersion and ProductVersion are 32bit ints, all other
|
||||
entries are strings the MUST be terminated wwith a \0.
|
||||
|
||||
AN EXAMPLE:
|
||||
|
||||
RCDATA NS_INFO_ProductVersion { 1,0,0,1,}
|
||||
|
||||
RCDATA NS_INFO_MIMEType { "video/x-video|",
|
||||
"video/x-flick\0" }
|
||||
RCDATA NS_INFO_FileExtents { "avi|",
|
||||
"flc\0" }
|
||||
RCDATA NS_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
|
||||
"MMOS2 Flc/Fli player(*.flc)\0" }
|
||||
|
||||
RCDATA NS_INFO_FileVersion { 1,0,0,1 }
|
||||
RCDATA NS_INFO_CompanyName { "Netscape Communications\0" }
|
||||
RCDATA NS_INFO_FileDescription { "NPAVI32 Extension DLL\0"
|
||||
RCDATA NS_INFO_InternalName { "NPAVI32\0" )
|
||||
RCDATA NS_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
|
||||
RCDATA NS_INFO_OriginalFilename { "NVAPI32.DLL" }
|
||||
RCDATA NS_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* RC_DATA types for version info - required */
|
||||
#define NS_INFO_ProductVersion 1
|
||||
#define NS_INFO_MIMEType 2
|
||||
#define NS_INFO_FileOpenName 3
|
||||
#define NS_INFO_FileExtents 4
|
||||
|
||||
/* RC_DATA types for version info - used if found */
|
||||
#define NS_INFO_FileDescription 5
|
||||
#define NS_INFO_ProductName 6
|
||||
|
||||
/* RC_DATA types for version info - optional */
|
||||
#define NS_INFO_CompanyName 7
|
||||
#define NS_INFO_FileVersion 8
|
||||
#define NS_INFO_InternalName 9
|
||||
#define NS_INFO_LegalCopyright 10
|
||||
#define NS_INFO_OriginalFilename 11
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Structures and definitions
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma options align=mac68k
|
||||
#endif
|
||||
|
||||
typedef const char* nsMIMEType;
|
||||
|
||||
struct nsByteRange {
|
||||
PRInt32 offset; /* negative offset means from the end */
|
||||
PRUint32 length;
|
||||
struct nsByteRange* next;
|
||||
};
|
||||
|
||||
struct nsPluginRect {
|
||||
PRUint16 top;
|
||||
PRUint16 left;
|
||||
PRUint16 bottom;
|
||||
PRUint16 right;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Unix specific structures and definitions
|
||||
|
||||
#ifdef XP_UNIX
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* Callback Structures.
|
||||
*
|
||||
* These are used to pass additional platform specific information.
|
||||
*/
|
||||
enum nsPluginCallbackType {
|
||||
nsPluginCallbackType_SetWindow = 1,
|
||||
nsPluginCallbackType_Print
|
||||
};
|
||||
|
||||
struct nsPluginAnyCallbackStruct {
|
||||
PRInt32 type;
|
||||
};
|
||||
|
||||
#ifndef NO_X11
|
||||
struct nsPluginSetWindowCallbackStruct {
|
||||
PRInt32 type;
|
||||
Display* display;
|
||||
Visual* visual;
|
||||
Colormap colormap;
|
||||
PRUint32 depth;
|
||||
};
|
||||
#else
|
||||
struct nsPluginSetWindowCallbackStruct {
|
||||
PRInt32 type;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
struct nsPluginPrintCallbackStruct {
|
||||
PRInt32 type;
|
||||
FILE* fp;
|
||||
};
|
||||
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// List of variables which should be implmented by the plugin
|
||||
enum nsPluginVariable {
|
||||
nsPluginVariable_NameString = 1,
|
||||
nsPluginVariable_DescriptionString = 2
|
||||
};
|
||||
|
||||
enum nsPluginManagerVariable {
|
||||
nsPluginManagerVariable_XDisplay = 1,
|
||||
nsPluginManagerVariable_XtAppContext = 2
|
||||
};
|
||||
|
||||
enum nsPluginInstancePeerVariable {
|
||||
nsPluginInstancePeerVariable_NetscapeWindow = 3
|
||||
// nsPluginInstancePeerVariable_JavaClass = 5,
|
||||
// nsPluginInstancePeerVariable_TimerInterval = 7
|
||||
};
|
||||
|
||||
enum nsPluginInstanceVariable {
|
||||
nsPluginInstanceVariable_WindowlessBool = 3,
|
||||
nsPluginInstanceVariable_TransparentBool = 4
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum nsPluginMode {
|
||||
nsPluginMode_Embedded = 1,
|
||||
nsPluginMode_Full
|
||||
};
|
||||
|
||||
// XXX this can go away now
|
||||
enum nsPluginStreamType {
|
||||
nsPluginStreamType_Normal = 1,
|
||||
nsPluginStreamType_Seek,
|
||||
nsPluginStreamType_AsFile,
|
||||
nsPluginStreamType_AsFileOnly
|
||||
};
|
||||
|
||||
/*
|
||||
* The type of a nsPluginWindow - it specifies the type of the data structure
|
||||
* returned in the window field.
|
||||
*/
|
||||
enum nsPluginWindowType {
|
||||
nsPluginWindowType_Window = 1,
|
||||
nsPluginWindowType_Drawable
|
||||
};
|
||||
|
||||
#ifdef XP_MAC
|
||||
|
||||
struct nsPluginPort {
|
||||
CGrafPtr port; /* Grafport */
|
||||
PRInt32 portx; /* position inside the topmost window */
|
||||
PRInt32 porty;
|
||||
};
|
||||
typedef RgnHandle nsPluginRegion;
|
||||
typedef WindowRef nsPluginPlatformWindowRef;
|
||||
|
||||
#elif defined(XP_PC)
|
||||
|
||||
struct nsPluginPort;
|
||||
typedef HRGN nsPluginRegion;
|
||||
typedef HWND nsPluginPlatformWindowRef;
|
||||
|
||||
#elif defined(XP_UNIX) && !defined(NO_X11)
|
||||
|
||||
struct nsPluginPort;
|
||||
typedef Region nsPluginRegion;
|
||||
typedef Drawable nsPluginPlatformWindowRef;
|
||||
|
||||
#else
|
||||
|
||||
struct nsPluginPort;
|
||||
typedef void* nsPluginRegion;
|
||||
typedef void* nsPluginPlatformWindowRef;
|
||||
|
||||
#endif
|
||||
|
||||
struct nsPluginWindow {
|
||||
nsPluginPort* window; /* Platform specific window handle */
|
||||
/* OS/2: x - Position of bottom left corner */
|
||||
/* OS/2: y - relative to visible netscape window */
|
||||
PRUint32 x; /* Position of top left corner relative */
|
||||
PRUint32 y; /* to a netscape page. */
|
||||
PRUint32 width; /* Maximum window size */
|
||||
PRUint32 height;
|
||||
nsPluginRect clipRect; /* Clipping rectangle in port coordinates */
|
||||
/* Used by MAC only. */
|
||||
#ifdef XP_UNIX
|
||||
void* ws_info; /* Platform-dependent additonal data */
|
||||
#endif /* XP_UNIX */
|
||||
nsPluginWindowType type; /* Is this a window or a drawable? */
|
||||
};
|
||||
|
||||
struct nsPluginFullPrint {
|
||||
PRBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */
|
||||
/* printing */
|
||||
PRBool printOne; /* TRUE if plugin should print one copy */
|
||||
/* to default printer */
|
||||
void* platformPrint; /* Platform-specific printing info */
|
||||
};
|
||||
|
||||
struct nsPluginEmbedPrint {
|
||||
nsPluginWindow window;
|
||||
void* platformPrint; /* Platform-specific printing info */
|
||||
};
|
||||
|
||||
struct nsPluginPrint {
|
||||
nsPluginMode mode; /* nsPluginMode_Full or nsPluginMode_Embedded */
|
||||
union
|
||||
{
|
||||
nsPluginFullPrint fullPrint; /* if mode is nsPluginMode_Full */
|
||||
nsPluginEmbedPrint embedPrint; /* if mode is nsPluginMode_Embedded */
|
||||
} print;
|
||||
};
|
||||
|
||||
struct nsPluginEvent {
|
||||
|
||||
#if defined(XP_MAC)
|
||||
EventRecord* event;
|
||||
nsPluginPlatformWindowRef window;
|
||||
|
||||
#elif defined(XP_PC)
|
||||
uint16 event;
|
||||
uint32 wParam;
|
||||
uint32 lParam;
|
||||
|
||||
#elif defined(XP_OS2)
|
||||
uint32 event;
|
||||
uint32 wParam;
|
||||
uint32 lParam;
|
||||
|
||||
#elif defined(XP_UNIX) && !defined(NO_X11)
|
||||
XEvent event;
|
||||
#else
|
||||
void *event;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Non-standard event types that can be passed to HandleEvent
|
||||
*/
|
||||
enum nsPluginEventType {
|
||||
#ifdef XP_MAC
|
||||
nsPluginEventType_GetFocusEvent = (osEvt + 16),
|
||||
nsPluginEventType_LoseFocusEvent = (osEvt + 17),
|
||||
nsPluginEventType_AdjustCursorEvent = (osEvt + 18),
|
||||
nsPluginEventType_MenuCommandEvent = (osEvt + 19),
|
||||
#endif /* XP_MAC */
|
||||
nsPluginEventType_Idle = 0
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum nsPluginReason {
|
||||
nsPluginReason_Base = 0,
|
||||
nsPluginReason_Done = 0,
|
||||
nsPluginReason_NetworkErr,
|
||||
nsPluginReason_UserBreak,
|
||||
nsPluginReason_NoReason
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Version Numbers for Structs
|
||||
|
||||
// These version number are for structures whose fields may evolve over time.
|
||||
// When fields are added to the end of the struct, the minor version will be
|
||||
// incremented. When the struct changes in an incompatible way the major version
|
||||
// will be incremented.
|
||||
|
||||
#define nsMajorVersion(v) (((PRInt32)(v) >> 16) & 0xffff)
|
||||
#define nsMinorVersion(v) ((PRInt32)(v) & 0xffff)
|
||||
|
||||
#define nsVersionOK(suppliedV, requiredV) \
|
||||
(nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \
|
||||
&& nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV))
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Classes that must be implemented by the plugin DLL:
|
||||
struct nsIPlugin; // plugin class (MIME-type handler)
|
||||
class nsILiveConnectPlugin; // subclass of nsIPlugin
|
||||
class nsIEventHandler; // event handler interface
|
||||
class nsIPluginInstance; // plugin instance
|
||||
class nsIPluginStream; // stream to receive data from the browser
|
||||
|
||||
// Classes that are implemented by the browser:
|
||||
class nsIPluginManager; // minimum browser requirements
|
||||
class nsIFileUtilities; // file utilities (accessible from nsIPluginManager)
|
||||
class nsIPluginInstancePeer; // parts of nsIPluginInstance implemented by the browser
|
||||
class nsIWindowlessPluginInstancePeer; // subclass of nsIPluginInstancePeer for windowless plugins
|
||||
class nsIPluginTagInfo; // describes html tag (accessible from nsIPluginInstancePeer)
|
||||
class nsILiveConnectPluginInstancePeer; // subclass of nsIPluginInstancePeer
|
||||
class nsIPluginStreamPeer; // parts of nsIPluginStream implemented by the browser
|
||||
class nsISeekablePluginStreamPeer; // seekable subclass of nsIPluginStreamPeer
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma options align=reset
|
||||
#endif
|
||||
|
||||
#endif /* RC_INVOKED */
|
||||
#ifdef __OS2__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#endif // nsplugindefs_h___
|
||||
24
mozilla/modules/plugin/base/src/MANIFEST
Normal file
24
mozilla/modules/plugin/base/src/MANIFEST
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsPluginsCID.h
|
||||
nsIPluginHost.h
|
||||
nsIPluginInstanceOwner.h
|
||||
@@ -14,36 +14,37 @@
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
DEPTH=..\..
|
||||
|
||||
MAKE_OBJ_TYPE = EXE
|
||||
PROGRAM = .\$(OBJDIR)\xpinstall.exe
|
||||
DEPTH=../../..
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\standalone.obj \
|
||||
.\$(OBJDIR)\nsSimpleConsoleProgressNotifier.obj \
|
||||
$(NULL)
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
LLIBS = \
|
||||
$(DIST)\lib\xpinstall.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(LIBNSPR) \
|
||||
MODULE=raptor
|
||||
|
||||
LIBRARY_NAME=raptorplugin
|
||||
|
||||
EXPORTS = \
|
||||
nsPluginsCID.h \
|
||||
nsIPluginHost.h \
|
||||
nsIPluginInstanceOwner.h
|
||||
|
||||
CPPSRCS = \
|
||||
nsPluginHostImpl.cpp \
|
||||
nsPluginFactory.cpp \
|
||||
ns4xPlugin.cpp \
|
||||
ns4xPluginInstance.cpp \
|
||||
ns4xPluginStream.cpp \
|
||||
nsPluginInstancePeer.cpp \
|
||||
nsPluginStreamPeer.cpp \
|
||||
nsMalloc.cpp \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\xpinstall \
|
||||
-I$(PUBLIC)\raptor \
|
||||
$(NULL)
|
||||
REQUIRES = raptor plugin java xpcom netlib libplc21
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
LCFLAGS =-D_IMPL_NS_PLUGIN
|
||||
|
||||
export:: $(PROGRAM)
|
||||
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin
|
||||
TARGETS = $(LIBRARY)
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\xpinstall.exe
|
||||
|
||||
$(PROGRAM):: $(OBJS) $(LLIBS)
|
||||
INCLUDES += -I.
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
57
mozilla/modules/plugin/base/src/Makefile.in
Normal file
57
mozilla/modules/plugin/base/src/Makefile.in
Normal file
@@ -0,0 +1,57 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
LIBRARY_NAME=raptorplugin
|
||||
|
||||
EXPORTS = \
|
||||
nsPluginsCID.h \
|
||||
nsIPluginHost.h \
|
||||
nsIPluginInstanceOwner.h
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
CPPSRCS = \
|
||||
nsPluginHostImpl.cpp \
|
||||
nsPluginFactory.cpp \
|
||||
ns4xPlugin.cpp \
|
||||
ns4xPluginInstance.cpp \
|
||||
ns4xPluginStream.cpp \
|
||||
nsPluginInstancePeer.cpp \
|
||||
nsPluginStreamPeer.cpp \
|
||||
nsMalloc.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = raptor plugin java xpcom netlib libplc21
|
||||
|
||||
LCFLAGS =-D_IMPL_NS_PLUGIN
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
||||
INCLUDES += -I$(srcdir)/
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
80
mozilla/modules/plugin/base/src/makefile.win
Normal file
80
mozilla/modules/plugin/base/src/makefile.win
Normal file
@@ -0,0 +1,80 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..\..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
EXPORTS = \
|
||||
nsPluginsCID.h \
|
||||
nsIPluginHost.h \
|
||||
nsIPluginInstanceOwner.h
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
DLLNAME = raptorplugin
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
MISCDEP = $(OURLIBS)
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
DEFINES =-D_IMPL_NS_PLUGIN -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsPluginHostImpl.obj \
|
||||
.\$(OBJDIR)\nsPluginFactory.obj \
|
||||
.\$(OBJDIR)\ns4xPlugin.obj \
|
||||
.\$(OBJDIR)\ns4xPluginInstance.obj \
|
||||
.\$(OBJDIR)\ns4xPluginStream.obj \
|
||||
.\$(OBJDIR)\nsPluginInstancePeer.obj \
|
||||
.\$(OBJDIR)\nsPluginStreamPeer.obj \
|
||||
.\$(OBJDIR)\nsMalloc.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS= \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\plugin \
|
||||
-I$(PUBLIC)\java \
|
||||
-I$(PUBLIC)\netlib \
|
||||
$(NULL)
|
||||
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
-D_IMPL_NS_PLUGIN \
|
||||
$(NULL)
|
||||
|
||||
OURLIBS= \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\libplc21.lib \
|
||||
$(DIST)\lib\netlib.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
LLIBS= \
|
||||
$(OURLIBS) \
|
||||
version.lib
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
it:
|
||||
echo $(LLIBS)
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\$(DLLNAME).dll
|
||||
780
mozilla/modules/plugin/base/src/ns4xPlugin.cpp
Normal file
780
mozilla/modules/plugin/base/src/ns4xPlugin.cpp
Normal file
@@ -0,0 +1,780 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
// TODO: Implement Java callbacks
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "nsplugin.h"
|
||||
#include "ns4xPlugin.h"
|
||||
#include "nsIPluginStream.h"
|
||||
#include "ns4xPluginInstance.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NPNetscapeFuncs ns4xPlugin::CALLBACKS;
|
||||
nsIPluginManager * ns4xPlugin::mPluginManager;
|
||||
nsIMalloc * ns4xPlugin::mMalloc;
|
||||
|
||||
void
|
||||
ns4xPlugin::CheckClassInitialized(void)
|
||||
{
|
||||
static PRBool initialized = FALSE;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
mPluginManager = nsnull;
|
||||
mMalloc = nsnull;
|
||||
|
||||
// XXX It'd be nice to make this const and initialize it
|
||||
// statically...
|
||||
CALLBACKS.size = sizeof(CALLBACKS);
|
||||
CALLBACKS.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
|
||||
|
||||
CALLBACKS.geturl = NewNPN_GetURLProc(_geturl);
|
||||
CALLBACKS.posturl = NewNPN_PostURLProc(_posturl);
|
||||
CALLBACKS.requestread = NewNPN_RequestReadProc(_requestread);
|
||||
CALLBACKS.newstream = NewNPN_NewStreamProc(_newstream);
|
||||
CALLBACKS.write = NewNPN_WriteProc(_write);
|
||||
CALLBACKS.destroystream = NewNPN_DestroyStreamProc(_destroystream);
|
||||
CALLBACKS.status = NewNPN_StatusProc(_status);
|
||||
CALLBACKS.uagent = NewNPN_UserAgentProc(_useragent);
|
||||
CALLBACKS.memalloc = NewNPN_MemAllocProc(_memalloc);
|
||||
CALLBACKS.memfree = NewNPN_MemFreeProc(_memfree);
|
||||
CALLBACKS.memflush = NewNPN_MemFlushProc(_memflush);
|
||||
CALLBACKS.reloadplugins = NewNPN_ReloadPluginsProc(_reloadplugins);
|
||||
CALLBACKS.getJavaEnv = NewNPN_GetJavaEnvProc(_getJavaEnv);
|
||||
// CALLBACKS.getJavaPeer = NewNPN_GetJavaPeerProc(_getJavaPeer);
|
||||
CALLBACKS.geturlnotify = NewNPN_GetURLNotifyProc(_geturlnotify);
|
||||
CALLBACKS.posturlnotify = NewNPN_PostURLNotifyProc(_posturlnotify);
|
||||
CALLBACKS.getvalue = NewNPN_GetValueProc(_getvalue);
|
||||
CALLBACKS.setvalue = NewNPN_SetValueProc(_setvalue);
|
||||
CALLBACKS.invalidaterect = NewNPN_InvalidateRectProc(_invalidaterect);
|
||||
CALLBACKS.invalidateregion = NewNPN_InvalidateRegionProc(_invalidateregion);
|
||||
CALLBACKS.forceredraw = NewNPN_ForceRedrawProc(_forceredraw);
|
||||
|
||||
initialized = TRUE;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
|
||||
fShutdownEntry = aShutdown;
|
||||
}
|
||||
|
||||
|
||||
ns4xPlugin::~ns4xPlugin(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports stuff
|
||||
|
||||
NS_IMPL_ADDREF(ns4xPlugin);
|
||||
NS_IMPL_RELEASE(ns4xPlugin);
|
||||
|
||||
static NS_DEFINE_IID(kILiveConnectPluginIID, NS_ILIVECONNECTPLUGIN_IID);
|
||||
static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIWindowlessPluginInstancePeerIID, NS_IWINDOWLESSPLUGININSTANCEPEER_IID);
|
||||
static NS_DEFINE_IID(kISeekablePluginStreamPeerIID, NS_ISEEKABLEPLUGINSTREAMPEER_IID);
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(kIPluginIID))
|
||||
{
|
||||
*instance = (void *)(nsIPlugin *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kILiveConnectPluginIID))
|
||||
{
|
||||
// Check the 4.x plugin callbacks to see if it supports
|
||||
// LiveConnect...
|
||||
if (fCallbacks.javaClass == NULL)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
*instance = (void *)(nsILiveConnectPlugin *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Static factory method.
|
||||
//
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::CreatePlugin(PRLibrary *library,
|
||||
nsIPlugin **result)
|
||||
{
|
||||
CheckClassInitialized();
|
||||
|
||||
NP_GETENTRYPOINTS pfnGetEntryPoints =
|
||||
(NP_GETENTRYPOINTS)PR_FindSymbol(library, "NP_GetEntryPoints");
|
||||
|
||||
if (pfnGetEntryPoints == NULL)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NPPluginFuncs callbacks;
|
||||
memset((void*) &callbacks, 0, sizeof(callbacks));
|
||||
|
||||
callbacks.size = sizeof(callbacks);
|
||||
|
||||
if (pfnGetEntryPoints(&callbacks) != NS_OK)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
#ifdef XP_WIN // XXX This is really XP, but we need to figure out how to do HIBYTE()
|
||||
if (HIBYTE(callbacks.version) < NP_VERSION_MAJOR)
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
NP_PLUGINSHUTDOWN pfnShutdown =
|
||||
(NP_PLUGINSHUTDOWN)PR_FindSymbol(library, "NP_Shutdown");
|
||||
|
||||
// the NP_Initialize entry point was misnamed as NP_PluginInit,
|
||||
// early in plugin project development. Its correct name is
|
||||
// documented now, and new developers expect it to work. However,
|
||||
// I don't want to break the plugins already in the field, so
|
||||
// we'll accept either name
|
||||
NP_PLUGININIT pfnInitialize =
|
||||
(NP_PLUGININIT)PR_FindSymbol(library, "NP_Initialize");
|
||||
|
||||
if (!pfnInitialize) {
|
||||
pfnInitialize =
|
||||
(NP_PLUGININIT)PR_FindSymbol(library, "NP_PluginInit");
|
||||
}
|
||||
|
||||
if (pfnInitialize == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX Right error?
|
||||
|
||||
if (pfnInitialize(&ns4xPlugin::CALLBACKS) != NS_OK)
|
||||
return NS_ERROR_UNEXPECTED; // XXX shoudl convert the 4.x error...
|
||||
|
||||
*result = new ns4xPlugin(&callbacks, pfnShutdown);
|
||||
|
||||
NS_ADDREF(*result);
|
||||
|
||||
if (*result == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult ns4xPlugin :: CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst;
|
||||
|
||||
inst = nsnull;
|
||||
inst = (nsISupports *)(nsIPluginInstance *)new ns4xPluginInstance(&fCallbacks);
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult ns4xPlugin :: LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
|
||||
static NS_DEFINE_IID(kIMallocIID, NS_IMALLOC_IID);
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::Initialize(nsISupports* browserInterfaces)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (nsnull == mPluginManager)
|
||||
rv = browserInterfaces->QueryInterface(kIPluginManagerIID, (void **)&mPluginManager);
|
||||
|
||||
if (nsnull == mMalloc)
|
||||
rv = browserInterfaces->QueryInterface(kIMallocIID, (void **)&mMalloc);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::Shutdown(void)
|
||||
{
|
||||
if (nsnull != fShutdownEntry)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
printf("shutting down plugin %08x\n", this);
|
||||
#endif
|
||||
fShutdownEntry();
|
||||
fShutdownEntry = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mPluginManager);
|
||||
NS_IF_RELEASE(mMalloc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::GetMIMEDescription(const char* *resultingDesc)
|
||||
{
|
||||
printf("plugin getmimedescription called\n");
|
||||
*resultingDesc = "";
|
||||
return NS_OK; // XXX make a callback, etc.
|
||||
}
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::GetValue(nsPluginVariable variable, void *value)
|
||||
{
|
||||
printf("plugin getvalue %d called\n", variable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::GetJavaClass(jclass *resultingClass)
|
||||
{
|
||||
*resultingClass = (jclass)fCallbacks.javaClass;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Static callbacks that get routed back through the new C++ API
|
||||
//
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_geturl(NPP npp, const char* relativeURL, const char* target)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
return mPluginManager->GetURL(inst, relativeURL, target);
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_geturlnotify(NPP npp, const char* relativeURL, const char* target,
|
||||
void* notifyData)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
return mPluginManager->GetURL(inst, relativeURL, target,
|
||||
notifyData);
|
||||
}
|
||||
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_posturlnotify(NPP npp, const char* relativeURL, const char *target,
|
||||
uint32 len, const char *buf, NPBool file,
|
||||
void* notifyData)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
return mPluginManager->PostURL(inst, relativeURL, target,
|
||||
len, buf, file, notifyData);
|
||||
}
|
||||
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_posturl(NPP npp, const char* relativeURL, const char *target, uint32 len,
|
||||
const char *buf, NPBool file)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
return mPluginManager->PostURL(inst, relativeURL, target,
|
||||
len, buf, file);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A little helper class used to wrap up plugin manager streams (that is,
|
||||
* streams from the plugin to the browser).
|
||||
*/
|
||||
class ns4xStreamWrapper
|
||||
{
|
||||
protected:
|
||||
nsIOutputStream *fStream;
|
||||
NPStream fNPStream;
|
||||
|
||||
public:
|
||||
ns4xStreamWrapper(nsIOutputStream* stream);
|
||||
~ns4xStreamWrapper();
|
||||
|
||||
nsIOutputStream*
|
||||
GetStream(void);
|
||||
|
||||
NPStream*
|
||||
GetNPStream(void) {
|
||||
return &fNPStream;
|
||||
};
|
||||
};
|
||||
|
||||
ns4xStreamWrapper::ns4xStreamWrapper(nsIOutputStream* stream)
|
||||
: fStream(stream)
|
||||
{
|
||||
NS_ASSERTION(stream != NULL, "bad stream");
|
||||
|
||||
NS_ADDREF(fStream);
|
||||
|
||||
memset(&fNPStream, 0, sizeof(fNPStream));
|
||||
fNPStream.ndata = (void*) this;
|
||||
}
|
||||
|
||||
ns4xStreamWrapper::~ns4xStreamWrapper(void)
|
||||
{
|
||||
NS_IF_RELEASE(fStream);
|
||||
}
|
||||
|
||||
nsIOutputStream*
|
||||
ns4xStreamWrapper::GetStream(void)
|
||||
{
|
||||
NS_IF_ADDREF(fStream);
|
||||
|
||||
return fStream;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_newstream(NPP npp, NPMIMEType type, const char* window, NPStream* *result)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
nsresult error;
|
||||
nsIOutputStream* stream;
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
if ((error = peer->NewStream((const char*) type, window, &stream)) != NS_OK)
|
||||
{
|
||||
NS_RELEASE(peer);
|
||||
return error;
|
||||
}
|
||||
|
||||
ns4xStreamWrapper* wrapper = new ns4xStreamWrapper(stream);
|
||||
|
||||
if (wrapper == NULL)
|
||||
{
|
||||
NS_RELEASE(peer);
|
||||
NS_RELEASE(stream);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
(*result) = wrapper->GetNPStream();
|
||||
|
||||
NS_RELEASE(peer);
|
||||
|
||||
return error;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
int32 NP_EXPORT
|
||||
ns4xPlugin::_write(NPP npp, NPStream *pstream, int32 len, void *buffer)
|
||||
{
|
||||
ns4xStreamWrapper* wrapper = (ns4xStreamWrapper*) npp->ndata;
|
||||
|
||||
NS_ASSERTION(wrapper != NULL, "null wrapper");
|
||||
|
||||
if (wrapper == NULL)
|
||||
return 0;
|
||||
|
||||
nsIOutputStream* stream = wrapper->GetStream();
|
||||
|
||||
PRInt32 count = 0;
|
||||
nsresult rv = stream->Write((char *)buffer, 0, len, &count);
|
||||
|
||||
NS_RELEASE(stream);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_destroystream(NPP npp, NPStream *pstream, NPError reason)
|
||||
{
|
||||
ns4xStreamWrapper* wrapper = (ns4xStreamWrapper*) npp->ndata;
|
||||
|
||||
NS_ASSERTION(wrapper != NULL, "null wrapper");
|
||||
|
||||
if (wrapper == NULL)
|
||||
return 0;
|
||||
|
||||
// This will release the wrapped nsIOutputStream.
|
||||
delete wrapper;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_status(NPP npp, const char *message)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
peer->ShowStatus(message);
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_memfree (void *ptr)
|
||||
{
|
||||
mMalloc->Free(ptr);
|
||||
}
|
||||
|
||||
uint32 NP_EXPORT
|
||||
ns4xPlugin::_memflush(uint32 size)
|
||||
{
|
||||
mMalloc->HeapMinimize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_reloadplugins(NPBool reloadPages)
|
||||
{
|
||||
mPluginManager->ReloadPlugins(reloadPages);
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_invalidaterect(NPP npp, NPRect *invalidRect)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
nsIWindowlessPluginInstancePeer *wpeer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
||||
{
|
||||
// XXX nsRect & NPRect are structurally equivalent
|
||||
wpeer->InvalidateRect((nsPluginRect *)invalidRect);
|
||||
NS_RELEASE(wpeer);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_invalidateregion(NPP npp, NPRegion invalidRegion)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
nsIWindowlessPluginInstancePeer *wpeer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
||||
{
|
||||
// XXX nsRegion & NPRegion are typedef'd to the same thing
|
||||
wpeer->InvalidateRegion((nsPluginRegion)invalidRegion);
|
||||
NS_RELEASE(wpeer);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_forceredraw(NPP npp)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
nsIWindowlessPluginInstancePeer *wpeer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
||||
{
|
||||
wpeer->ForceRedraw();
|
||||
NS_RELEASE(wpeer);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// XXX Note that for backwards compatibility, the old NPNVariables
|
||||
// map correctly to NPPluginManagerVariables.
|
||||
rv = peer->GetValue((nsPluginInstancePeerVariable)variable, result);
|
||||
NS_RELEASE(peer);
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_setvalue(NPP npp, NPPVariable variable, void *result)
|
||||
{
|
||||
ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
switch (variable)
|
||||
{
|
||||
case NPPVpluginWindowBool:
|
||||
return inst->SetWindowless(*((NPBool *)result));
|
||||
|
||||
case NPPVpluginTransparentBool:
|
||||
return inst->SetTransparent(*((NPBool *)result));
|
||||
|
||||
default:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// XXX Note that for backwards compatibility, the old NPPVariables
|
||||
// map correctly to NPPluginVariables.
|
||||
rv = peer->SetValue((nsPluginInstancePeerVariable)variable, result);
|
||||
NS_RELEASE(peer);
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_requestread(NPStream *pstream, NPByteRange *rangeList)
|
||||
{
|
||||
nsIPluginStreamPeer* streamPeer = (nsIPluginStreamPeer*) pstream->ndata;
|
||||
|
||||
NS_ASSERTION(streamPeer != NULL, "null streampeer");
|
||||
|
||||
if (streamPeer == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
nsISeekablePluginStreamPeer* seekablePeer = NULL;
|
||||
|
||||
if (streamPeer->QueryInterface(kISeekablePluginStreamPeerIID,
|
||||
(void**)seekablePeer) == NS_OK)
|
||||
{
|
||||
nsresult error;
|
||||
|
||||
// XXX nsByteRange & NPByteRange are structurally equivalent.
|
||||
error = seekablePeer->RequestRead((nsByteRange *)rangeList);
|
||||
NS_RELEASE(seekablePeer);
|
||||
return error;
|
||||
}
|
||||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// On 68K Mac (XXX still supported?), we need to make sure that the
|
||||
// pointers are in D0 for the following functions that return pointers.
|
||||
//
|
||||
|
||||
#if defined(XP_MAC) && !defined(powerc)
|
||||
#pragma pointers_in_D0
|
||||
#endif
|
||||
|
||||
|
||||
JRIEnv* NP_EXPORT
|
||||
ns4xPlugin::_getJavaEnv(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * NP_EXPORT
|
||||
ns4xPlugin::_useragent(NPP npp)
|
||||
{
|
||||
NS_ASSERTION(mPluginManager != NULL, "null pluginmanager");
|
||||
|
||||
if (mPluginManager == NULL)
|
||||
return NULL;
|
||||
|
||||
char *retstr;
|
||||
|
||||
mPluginManager->UserAgent((const char **)&retstr);
|
||||
|
||||
return retstr;
|
||||
}
|
||||
|
||||
void * NP_EXPORT
|
||||
ns4xPlugin::_memalloc (uint32 size)
|
||||
{
|
||||
return mMalloc->Alloc(size);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
#ifdef JAVA
|
||||
java_lang_Class* NP_EXPORT
|
||||
ns4xPlugin::_getJavaClass(void* handle)
|
||||
{
|
||||
// Is this just a generic call into the Java VM?
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
jref NP_EXPORT
|
||||
ns4xPlugin::_getJavaPeer(NPP npp)
|
||||
{
|
||||
NPIPluginInstancePeer* peer = (NPIPluginInstancePeer*) npp->ndata;
|
||||
PR_ASSERT(peer != NULL);
|
||||
if (peer == NULL)
|
||||
return NULL;
|
||||
|
||||
static NS_DEFINE_IID(kILiveConnectPluginInstancePeerIID,
|
||||
NP_ILIVECONNECTPLUGININSTANCEPEER_IID);
|
||||
|
||||
NPILiveConnectPluginInstancePeer* lcPeer = NULL;
|
||||
if (peer->QueryInterface(kILiveConnectPluginInstancePeerIID,
|
||||
(void**) &lcPeer) == NS_OK) {
|
||||
jobject result = lcPeer->GetJavaPeer();
|
||||
lcPeer->Release();
|
||||
return result;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(XP_MAC) && !defined(powerc)
|
||||
#pragma pointers_in_A0
|
||||
#endif
|
||||
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
233
mozilla/modules/plugin/base/src/ns4xPlugin.h
Normal file
233
mozilla/modules/plugin/base/src/ns4xPlugin.h
Normal file
@@ -0,0 +1,233 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef ns4xPlugin_h__
|
||||
#define ns4xPlugin_h__
|
||||
|
||||
#include "nsplugin.h"
|
||||
#include "prlink.h" // for PRLibrary
|
||||
#include "npupp.h"
|
||||
#include "nsIMalloc.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
* Use this macro before each exported function
|
||||
* (between the return address and the function
|
||||
* itself), to ensure that the function has the
|
||||
* right calling conventions on Win16.
|
||||
*/
|
||||
|
||||
#ifdef XP_WIN16
|
||||
#define NP_EXPORT __export
|
||||
#elif defined(XP_OS2)
|
||||
#define NP_EXPORT _System
|
||||
#else
|
||||
#define NP_EXPORT
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// XXX These are defined in platform specific FE directories right now :-/
|
||||
|
||||
//BTW: this sucks rocks.
|
||||
#ifdef XP_WIN
|
||||
#define PLUGIN_ENTRYPOINT_CALL_TYPE __stdcall
|
||||
#else
|
||||
#define PLUGIN_ENTRYPOINT_CALL_TYPE
|
||||
#endif
|
||||
|
||||
typedef NPError (PLUGIN_ENTRYPOINT_CALL_TYPE *NP_GETENTRYPOINTS)(NPPluginFuncs* pCallbacks);
|
||||
typedef NPError (PLUGIN_ENTRYPOINT_CALL_TYPE *NP_PLUGININIT)(const NPNetscapeFuncs* pCallbacks);
|
||||
typedef NPError (PLUGIN_ENTRYPOINT_CALL_TYPE *NP_PLUGINSHUTDOWN)();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A 5.0 wrapper for a 4.x style plugin.
|
||||
*/
|
||||
class ns4xPlugin : public nsILiveConnectPlugin
|
||||
{
|
||||
public:
|
||||
ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown);
|
||||
~ns4xPlugin(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIFactory interface
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
//nsIPlugin interface
|
||||
|
||||
NS_IMETHOD
|
||||
Initialize(nsISupports* browserInterfaces);
|
||||
|
||||
NS_IMETHOD
|
||||
Shutdown(void);
|
||||
|
||||
NS_IMETHOD
|
||||
GetMIMEDescription(const char* *resultingDesc);
|
||||
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginVariable variable, void *value);
|
||||
|
||||
//nsILiveConnectPlugin interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetJavaClass(jclass *resultingClass);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// ns4xPlugin-specific methods
|
||||
|
||||
/**
|
||||
* A static factory method for constructing 4.x plugins. Constructs
|
||||
* and initializes an ns4xPlugin object, and returns it in
|
||||
* <b>result</b>.
|
||||
*/
|
||||
static nsresult
|
||||
CreatePlugin(PRLibrary *library,
|
||||
nsIPlugin **result);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Ensures that the static CALLBACKS is properly initialized
|
||||
*/
|
||||
static void CheckClassInitialized(void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Static stub functions that are exported to the 4.x plugin as entry
|
||||
// points via the CALLBACKS variable.
|
||||
//
|
||||
static nsresult NP_EXPORT
|
||||
_requestread(NPStream *pstream, NPByteRange *rangeList);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_geturlnotify(NPP npp, const char* relativeURL, const char* target, void* notifyData);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_getvalue(NPP npp, NPNVariable variable, void *r_value);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_setvalue(NPP npp, NPPVariable variable, void *r_value);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_geturl(NPP npp, const char* relativeURL, const char* target);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_posturlnotify(NPP npp, const char* relativeURL, const char *target,
|
||||
uint32 len, const char *buf, NPBool file, void* notifyData);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_posturl(NPP npp, const char* relativeURL, const char *target, uint32 len,
|
||||
const char *buf, NPBool file);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_newstream(NPP npp, NPMIMEType type, const char* window, NPStream** pstream);
|
||||
|
||||
static int32 NP_EXPORT
|
||||
_write(NPP npp, NPStream *pstream, int32 len, void *buffer);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_destroystream(NPP npp, NPStream *pstream, NPError reason);
|
||||
|
||||
static void NP_EXPORT
|
||||
_status(NPP npp, const char *message);
|
||||
|
||||
#if 0
|
||||
|
||||
static void NP_EXPORT
|
||||
_registerwindow(NPP npp, void* window);
|
||||
|
||||
static void NP_EXPORT
|
||||
_unregisterwindow(NPP npp, void* window);
|
||||
|
||||
static int16 NP_EXPORT
|
||||
_allocateMenuID(NPP npp, NPBool isSubmenu);
|
||||
|
||||
#endif
|
||||
|
||||
static void NP_EXPORT
|
||||
_memfree (void *ptr);
|
||||
|
||||
static uint32 NP_EXPORT
|
||||
_memflush(uint32 size);
|
||||
|
||||
static void NP_EXPORT
|
||||
_reloadplugins(NPBool reloadPages);
|
||||
|
||||
static void NP_EXPORT
|
||||
_invalidaterect(NPP npp, NPRect *invalidRect);
|
||||
|
||||
static void NP_EXPORT
|
||||
_invalidateregion(NPP npp, NPRegion invalidRegion);
|
||||
|
||||
static void NP_EXPORT
|
||||
_forceredraw(NPP npp);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Anything that returns a pointer needs to be _HERE_ for 68K Mac to
|
||||
// work.
|
||||
//
|
||||
|
||||
#if defined(XP_MAC) && !defined(powerc)
|
||||
#pragma pointers_in_D0
|
||||
#endif
|
||||
|
||||
static const char* NP_EXPORT
|
||||
_useragent(NPP npp);
|
||||
|
||||
static void* NP_EXPORT
|
||||
_memalloc (uint32 size);
|
||||
|
||||
static JRIEnv* NP_EXPORT
|
||||
_getJavaEnv(void);
|
||||
|
||||
#if 0
|
||||
|
||||
static jref NP_EXPORT
|
||||
_getJavaPeer(NPP npp);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(XP_MAC) && !defined(powerc)
|
||||
#pragma pointers_in_A0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The plugin-side callbacks that the browser calls. One set of
|
||||
* plugin callbacks for each plugin.
|
||||
*/
|
||||
NPPluginFuncs fCallbacks;
|
||||
|
||||
NP_PLUGINSHUTDOWN fShutdownEntry;
|
||||
|
||||
/**
|
||||
* The browser-side callbacks that a 4.x-style plugin calls.
|
||||
*/
|
||||
static NPNetscapeFuncs CALLBACKS;
|
||||
|
||||
static nsIPluginManager *mPluginManager;
|
||||
static nsIMalloc *mMalloc;
|
||||
};
|
||||
|
||||
#endif // ns4xPlugin_h__
|
||||
296
mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp
Normal file
296
mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "ns4xPluginInstance.h"
|
||||
#include "ns4xPluginStream.h"
|
||||
#include "prlog.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ns4xPluginInstance :: ns4xPluginInstance(NPPluginFuncs* callbacks)
|
||||
: fCallbacks(callbacks)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
NS_ASSERTION(fCallbacks != NULL, "null callbacks");
|
||||
|
||||
// Initialize the NPP structure.
|
||||
|
||||
fNPP.pdata = NULL;
|
||||
fNPP.ndata = this;
|
||||
|
||||
fPeer = nsnull;
|
||||
|
||||
mWindowless = PR_FALSE;
|
||||
mTransparent = PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
ns4xPluginInstance :: ~ns4xPluginInstance(void)
|
||||
{
|
||||
NS_RELEASE(fPeer);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ADDREF(ns4xPluginInstance);
|
||||
NS_IMPL_RELEASE(ns4xPluginInstance);
|
||||
|
||||
static NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID);
|
||||
static NS_DEFINE_IID(kIEventHandlerIID, NS_IEVENTHANDLER_IID);
|
||||
static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(kIPluginInstanceIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginInstance *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIEventHandlerIID))
|
||||
{
|
||||
*instance = (void *)(nsIEventHandler *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: Initialize(nsIPluginInstancePeer* peer)
|
||||
{
|
||||
PRUint16 count;
|
||||
const char* const* names;
|
||||
const char* const* values;
|
||||
|
||||
NS_ASSERTION(peer != NULL, "null peer");
|
||||
|
||||
fPeer = peer;
|
||||
|
||||
NS_ADDREF(fPeer);
|
||||
|
||||
nsresult error;
|
||||
nsIPluginTagInfo *taginfo;
|
||||
|
||||
error = fPeer->QueryInterface(kIPluginTagInfoIID, (void **)&taginfo);
|
||||
|
||||
if (NS_OK == error)
|
||||
{
|
||||
if ((error = taginfo->GetAttributes(count, names, values)) != NS_OK)
|
||||
return error;
|
||||
|
||||
if (fCallbacks->newp == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX right error?
|
||||
|
||||
// XXX Note that the NPPluginType_* enums were crafted to be
|
||||
// backward compatible...
|
||||
|
||||
nsPluginMode mode;
|
||||
nsMIMEType mimetype;
|
||||
|
||||
fPeer->GetMode(&mode);
|
||||
fPeer->GetMIMEType(&mimetype);
|
||||
|
||||
error = (nsresult)
|
||||
CallNPP_NewProc(fCallbacks->newp,
|
||||
(char *)mimetype,
|
||||
&fNPP,
|
||||
(PRUint16)mode,
|
||||
count,
|
||||
(char**)names,
|
||||
(char**)values,
|
||||
NULL); // saved data
|
||||
|
||||
NS_RELEASE(taginfo);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: GetPeer(nsIPluginInstancePeer* *resultingPeer)
|
||||
{
|
||||
NS_ADDREF(fPeer);
|
||||
*resultingPeer = fPeer;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::Start(void)
|
||||
{
|
||||
// XXX At some point, we maybe should implement start and stop to
|
||||
// load/unload the 4.x plugin, just in case there are some plugins
|
||||
// that rely on that behavior...
|
||||
printf("instance start called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::Stop(void)
|
||||
{
|
||||
printf("instance stop called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::Destroy(void)
|
||||
{
|
||||
nsresult error;
|
||||
|
||||
printf("instance destroy called\n");
|
||||
if (fCallbacks->destroy == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX right error?
|
||||
|
||||
NPSavedData *sdata;
|
||||
|
||||
error = (nsresult)CallNPP_DestroyProc(fCallbacks->destroy,
|
||||
&fNPP, &sdata); // saved data
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
{
|
||||
// XXX 4.x plugins don't want a SetWindow(NULL).
|
||||
|
||||
if (window == NULL)
|
||||
return NS_OK;
|
||||
|
||||
nsresult error = NS_OK;
|
||||
|
||||
if (fCallbacks->setwindow)
|
||||
{
|
||||
// XXX Turns out that NPPluginWindow and NPWindow are structurally
|
||||
// identical (on purpose!), so there's no need to make a copy.
|
||||
|
||||
error = (nsresult) CallNPP_SetWindowProc(fCallbacks->setwindow,
|
||||
&fNPP,
|
||||
(NPWindow*) window);
|
||||
|
||||
// XXX In the old code, we'd just ignore any errors coming
|
||||
// back from the plugin's SetWindow(). Is this the correct
|
||||
// behavior?!?
|
||||
|
||||
if (error != NS_OK)
|
||||
printf("error in setwindow %d\n", error);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::NewStream(nsIPluginStreamPeer* peer, nsIPluginStream* *result)
|
||||
{
|
||||
(*result) = NULL;
|
||||
|
||||
ns4xPluginStream* stream = new ns4xPluginStream();
|
||||
|
||||
if (stream == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(stream);
|
||||
|
||||
nsresult error;
|
||||
|
||||
// does it need the peer?
|
||||
|
||||
if ((error = stream->Initialize(this, peer)) != NS_OK)
|
||||
{
|
||||
NS_RELEASE(stream);
|
||||
return error;
|
||||
}
|
||||
|
||||
(*result) = stream;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::Print(nsPluginPrint* platformPrint)
|
||||
{
|
||||
printf("instance print called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* handled)
|
||||
{
|
||||
printf("instance handleevent called\n");
|
||||
*handled = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::URLNotify(const char* url, const char* target,
|
||||
nsPluginReason reason, void* notifyData)
|
||||
{
|
||||
if (fCallbacks->urlnotify != NULL)
|
||||
{
|
||||
CallNPP_URLNotifyProc(fCallbacks->urlnotify,
|
||||
&fNPP,
|
||||
url,
|
||||
reason,
|
||||
notifyData);
|
||||
}
|
||||
|
||||
return NS_OK; //XXX this seems bad...
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: GetValue(nsPluginInstanceVariable variable, void *value)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
switch (variable)
|
||||
{
|
||||
case nsPluginInstanceVariable_WindowlessBool:
|
||||
*(PRBool *)value = mWindowless;
|
||||
break;
|
||||
|
||||
case nsPluginInstanceVariable_TransparentBool:
|
||||
*(PRBool *)value = mTransparent;
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = NS_ERROR_FAILURE; //XXX this is bad
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: SetWindowless(PRBool aWindowless)
|
||||
{
|
||||
mWindowless = aWindowless;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: SetTransparent(PRBool aTransparent)
|
||||
{
|
||||
mTransparent = aTransparent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
145
mozilla/modules/plugin/base/src/ns4xPluginInstance.h
Normal file
145
mozilla/modules/plugin/base/src/ns4xPluginInstance.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef ns4xPluginInstance_h__
|
||||
#define ns4xPluginInstance_h__
|
||||
|
||||
#define _UINT32
|
||||
#define _INT32
|
||||
|
||||
#include "nsplugin.h"
|
||||
#include "npupp.h"
|
||||
#include "jri.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ns4xPluginInstance : public nsIPluginInstance
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct a new 4.x plugin instance with the specified peer
|
||||
* and callbacks.
|
||||
*/
|
||||
ns4xPluginInstance(NPPluginFuncs* callbacks);
|
||||
|
||||
// Use Release() to destroy this
|
||||
~ns4xPluginInstance(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIPluginInstance methods
|
||||
|
||||
/**
|
||||
* Actually initialize the plugin instance. This calls the 4.x <b>newp</b>
|
||||
* callback, and may return an error (which is why it is distinct from the
|
||||
* constructor.) If an error is returned, the caller should <i>not</i>
|
||||
* continue to use the <b>ns4xPluginInstance</b> object.
|
||||
*/
|
||||
NS_METHOD
|
||||
Initialize(nsIPluginInstancePeer* peer);
|
||||
|
||||
NS_IMETHOD
|
||||
GetPeer(nsIPluginInstancePeer* *resultingPeer);
|
||||
|
||||
NS_IMETHOD
|
||||
Start(void);
|
||||
|
||||
NS_IMETHOD
|
||||
Stop(void);
|
||||
|
||||
NS_IMETHOD
|
||||
Destroy(void);
|
||||
|
||||
NS_IMETHOD
|
||||
SetWindow(nsPluginWindow* window);
|
||||
|
||||
NS_IMETHOD
|
||||
NewStream(nsIPluginStreamPeer* peer, nsIPluginStream* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
Print(nsPluginPrint* platformPrint);
|
||||
|
||||
NS_IMETHOD
|
||||
HandleEvent(nsPluginEvent* event, PRBool* handled);
|
||||
|
||||
NS_IMETHOD
|
||||
URLNotify(const char* url, const char* target,
|
||||
nsPluginReason reason, void* notifyData);
|
||||
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginInstanceVariable variable, void *value);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// ns4xPluginInstance-specific methods
|
||||
|
||||
|
||||
/**
|
||||
* Return the 4.x-style interface object.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetNPP(NPP * aNPP) {
|
||||
*aNPP = &fNPP;
|
||||
return NS_OK;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the callbacks for the plugin instance.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetCallbacks(const NPPluginFuncs ** aCallbacks) {
|
||||
*aCallbacks = fCallbacks;
|
||||
return NS_OK;
|
||||
};
|
||||
|
||||
NS_IMETHOD
|
||||
SetWindowless(PRBool aWindowless);
|
||||
|
||||
NS_IMETHOD
|
||||
SetTransparent(PRBool aTransparent);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* The plugin instance peer for this instance.
|
||||
*/
|
||||
nsIPluginInstancePeer* fPeer;
|
||||
|
||||
/**
|
||||
* A pointer to the plugin's callback functions. This information
|
||||
* is actually stored in the plugin class (<b>nsPluginClass</b>),
|
||||
* and is common for all plugins of the class.
|
||||
*/
|
||||
NPPluginFuncs* fCallbacks;
|
||||
|
||||
/**
|
||||
* The 4.x-style structure used to communicate between the plugin
|
||||
* instance and the browser.
|
||||
*/
|
||||
NPP_t fNPP;
|
||||
|
||||
//these are used to store the windowless properties
|
||||
//which the browser will later query
|
||||
|
||||
PRBool mWindowless;
|
||||
PRBool mTransparent;
|
||||
};
|
||||
|
||||
|
||||
#endif // ns4xPluginInstance_h__
|
||||
262
mozilla/modules/plugin/base/src/ns4xPluginStream.cpp
Normal file
262
mozilla/modules/plugin/base/src/ns4xPluginStream.cpp
Normal file
@@ -0,0 +1,262 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "ns4xPluginStream.h"
|
||||
#include "prlog.h" // for PR_ASSERT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ns4xPluginStream::ns4xPluginStream(void)
|
||||
: fStreamType(nsPluginStreamType_Normal), fSeekable(PR_FALSE), fPosition(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
fPeer = nsnull;
|
||||
fInstance = nsnull;
|
||||
|
||||
// Initialize the 4.x interface structure
|
||||
memset(&fNPStream, 0, sizeof(fNPStream));
|
||||
}
|
||||
|
||||
|
||||
ns4xPluginStream::~ns4xPluginStream(void)
|
||||
{
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
nsPluginReason reason;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
fPeer->GetReason(&reason);
|
||||
|
||||
if (callbacks->destroystream != NULL)
|
||||
{
|
||||
CallNPP_DestroyStreamProc(callbacks->destroystream,
|
||||
npp,
|
||||
&fNPStream,
|
||||
reason);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(fPeer);
|
||||
NS_IF_RELEASE(fInstance);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ADDREF(ns4xPluginStream);
|
||||
NS_IMPL_RELEASE(ns4xPluginStream);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIPluginStreamIID, NS_IPLUGINSTREAM_IID);
|
||||
static NS_DEFINE_IID(kISeekablePluginStreamPeerIID, NS_ISEEKABLEPLUGINSTREAMPEER_IID);
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(kIPluginStreamIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginStream *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::Initialize(ns4xPluginInstance* instance,
|
||||
nsIPluginStreamPeer* peer)
|
||||
{
|
||||
fInstance = instance;
|
||||
fPeer = peer;
|
||||
|
||||
NS_ASSERTION(fInstance != NULL, "null instance");
|
||||
|
||||
NS_ADDREF(fInstance);
|
||||
|
||||
NS_ASSERTION(fPeer != NULL, "null peer");
|
||||
|
||||
NS_ADDREF(fPeer);
|
||||
|
||||
const char *url;
|
||||
PRUint32 length, modified;
|
||||
|
||||
fPeer->GetURL(&url);
|
||||
fPeer->GetEnd(&length);
|
||||
fPeer->GetLastModified(&modified);
|
||||
|
||||
fNPStream.ndata = (void*) fPeer;
|
||||
fNPStream.url = url;
|
||||
fNPStream.end = length;
|
||||
fNPStream.lastmodified = modified;
|
||||
|
||||
// Are we seekable?
|
||||
|
||||
nsISupports* seekablePeer;
|
||||
|
||||
if (fPeer->QueryInterface(kISeekablePluginStreamPeerIID,
|
||||
(void**) &seekablePeer) == NS_OK)
|
||||
{
|
||||
fSeekable = TRUE;
|
||||
NS_RELEASE(seekablePeer);
|
||||
}
|
||||
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
nsMIMEType mimetype;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
fPeer->GetMIMEType(&mimetype);
|
||||
|
||||
if (callbacks->newstream == NULL)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint16 streamType = (PRUint16) fStreamType;
|
||||
|
||||
nsresult error
|
||||
= (nsresult)CallNPP_NewStreamProc(callbacks->newstream,
|
||||
npp,
|
||||
(char *)mimetype,
|
||||
&fNPStream,
|
||||
fSeekable,
|
||||
&streamType);
|
||||
|
||||
fStreamType = (nsPluginStreamType) streamType;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::Write(const char* buffer, PRInt32 offset, PRInt32 len, PRInt32 *aWriteCount)
|
||||
{
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
PRInt32 remaining = len;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
|
||||
if (callbacks->write == NULL)
|
||||
return NS_OK;
|
||||
|
||||
while (remaining > 0)
|
||||
{
|
||||
PRInt32 numtowrite;
|
||||
|
||||
if (callbacks->writeready != NULL)
|
||||
{
|
||||
numtowrite = CallNPP_WriteReadyProc(callbacks->writeready,
|
||||
npp,
|
||||
&fNPStream);
|
||||
|
||||
if (numtowrite > remaining)
|
||||
numtowrite = remaining;
|
||||
}
|
||||
else
|
||||
numtowrite = len;
|
||||
|
||||
*aWriteCount = CallNPP_WriteProc(callbacks->write,
|
||||
npp,
|
||||
&fNPStream,
|
||||
fPosition,
|
||||
numtowrite,
|
||||
(void *)buffer);
|
||||
|
||||
remaining -= numtowrite;
|
||||
}
|
||||
|
||||
fPosition += len;
|
||||
|
||||
return NS_OK; //XXX this seems bad...
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::GetStreamType(nsPluginStreamType *result)
|
||||
{
|
||||
*result = fStreamType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::AsFile(const char* filename)
|
||||
{
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
|
||||
if (callbacks->asfile == NULL)
|
||||
return NS_OK;
|
||||
|
||||
CallNPP_StreamAsFileProc(callbacks->asfile,
|
||||
npp,
|
||||
&fNPStream,
|
||||
filename);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream :: Close(void)
|
||||
{
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
void *notifydata;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
|
||||
fPeer->GetNotifyData(¬ifydata);
|
||||
|
||||
nsPluginReason reason;
|
||||
|
||||
fPeer->GetReason(&reason);
|
||||
|
||||
if (nsnull != notifydata)
|
||||
{
|
||||
if (callbacks->urlnotify == NULL)
|
||||
return NS_OK;
|
||||
|
||||
const char *url;
|
||||
|
||||
fPeer->GetURL(&url);
|
||||
|
||||
CallNPP_URLNotifyProc(callbacks->urlnotify,
|
||||
npp,
|
||||
url,
|
||||
(NPReason)reason,
|
||||
notifydata);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
115
mozilla/modules/plugin/base/src/ns4xPluginStream.h
Normal file
115
mozilla/modules/plugin/base/src/ns4xPluginStream.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef ns4xPluginStream_h__
|
||||
#define ns4xPluginStream_h__
|
||||
|
||||
#define _UINT32
|
||||
#define _INT32
|
||||
|
||||
#include "jri.h" // XXX should be jni.h
|
||||
#include "nsplugin.h"
|
||||
#include "ns4xPluginInstance.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A 5.0 wrapper for a 4.x plugin stream.
|
||||
*/
|
||||
class ns4xPluginStream : public nsIPluginStream
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct a new 4.x plugin stream associated with the specified
|
||||
* instance and stream peer.
|
||||
*/
|
||||
ns4xPluginStream();
|
||||
~ns4xPluginStream();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/**
|
||||
* Do internal initialization. This actually calls into the 4.x plugin
|
||||
* to create the stream, and may fail (which is why it's separate from
|
||||
* the constructor).
|
||||
*/
|
||||
NS_METHOD
|
||||
Initialize(ns4xPluginInstance* instance, nsIPluginStreamPeer* peer);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIPluginStream methods
|
||||
|
||||
// (Corresponds to NPP_Write and NPN_Write.)
|
||||
NS_IMETHOD
|
||||
Write(const char* buffer, PRInt32 offset, PRInt32 len, PRInt32 *aWriteCount);
|
||||
|
||||
// (Corresponds to NPP_NewStream's stype return parameter.)
|
||||
NS_IMETHOD
|
||||
GetStreamType(nsPluginStreamType *result);
|
||||
|
||||
// (Corresponds to NPP_StreamAsFile.)
|
||||
NS_IMETHOD
|
||||
AsFile(const char* fname);
|
||||
|
||||
NS_IMETHOD
|
||||
Close(void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Methods specific to ns4xPluginStream
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* The plugin instance to which this stream belongs.
|
||||
*/
|
||||
ns4xPluginInstance* fInstance;
|
||||
|
||||
/**
|
||||
* The peer associated with this stream.
|
||||
*/
|
||||
nsIPluginStreamPeer* fPeer;
|
||||
|
||||
/**
|
||||
* The type of stream, for the peer's use.
|
||||
*/
|
||||
nsPluginStreamType fStreamType;
|
||||
|
||||
/**
|
||||
* The 4.x-style structure used to contain stream information.
|
||||
* This is what actually gets used to communicate with the plugin.
|
||||
*/
|
||||
NPStream fNPStream;
|
||||
|
||||
/**
|
||||
* Set to <b>TRUE</b> if the peer implements
|
||||
* <b>NPISeekablPluginStreamPeer</b>.
|
||||
*/
|
||||
PRBool fSeekable;
|
||||
|
||||
/**
|
||||
* Tracks the position in the content that is being
|
||||
* read. 4.x-style plugins expect to be told the offset in the
|
||||
* buffer that they should read <i>to</i>, even though it's always
|
||||
* done serially.
|
||||
*/
|
||||
PRUint32 fPosition;
|
||||
};
|
||||
|
||||
|
||||
#endif // ns4xPluginStream_h__
|
||||
67
mozilla/modules/plugin/base/src/nsIPluginHost.h
Normal file
67
mozilla/modules/plugin/base/src/nsIPluginHost.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIPluginHost_h___
|
||||
#define nsIPluginHost_h___
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
class nsIURL;
|
||||
|
||||
#define NS_IPLUGINHOST_IID \
|
||||
{ 0x264c0640, 0x1c31, 0x11d2, \
|
||||
{ 0xa8, 0x2e, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
||||
|
||||
struct nsIPluginHost : public nsIFactory
|
||||
{
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
Init(void) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
Destroy(void) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
LoadPlugins(void) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsIURL *aURL, nsIPluginInstanceOwner *aOwner) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsString& aURLSpec, nsIPluginInstanceOwner *aOwner) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsString& aURLSpec, nsIStreamListener *&aStreamListener, nsIPluginInstanceOwner *aOwner) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(const nsString& aURL, nsIPluginInstance *aInstance, void *aNotifyData) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(const nsString& aURL, nsIPluginInstanceOwner *aOwner, void *aNotifyData) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(nsIStreamListener *&aStreamListener, nsIPluginInstance *aInstance, void *aNotifyData) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
101
mozilla/modules/plugin/base/src/nsIPluginInstanceOwner.h
Normal file
101
mozilla/modules/plugin/base/src/nsIPluginInstanceOwner.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIPluginInstanceOwner_h___
|
||||
#define nsIPluginInstanceOwner_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsplugin.h"
|
||||
|
||||
#define NS_IPLUGININSTANCEOWNER_IID \
|
||||
{ 0x18270870, 0x32f1, 0x11d2, \
|
||||
{ 0xa8, 0x30, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
||||
|
||||
struct nsIPluginInstanceOwner : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Let the owner know that an instance has been created
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
SetInstance(nsIPluginInstance *aInstance) = 0;
|
||||
|
||||
/**
|
||||
* Get the instance associated with this owner.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetInstance(nsIPluginInstance *&aInstance) = 0;
|
||||
|
||||
/**
|
||||
* Get a handle to the window structure of the owner.
|
||||
* This pointer cannot be made persistant by the caller.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetWindow(nsPluginWindow *&aWindow) = 0;
|
||||
|
||||
/**
|
||||
* Get the display mode for the plugin instance.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetMode(nsPluginMode *aMode) = 0;
|
||||
|
||||
/**
|
||||
* Get a ptr to the paired list of attribute names and values,
|
||||
* returns the length of the array.
|
||||
*
|
||||
* Each name or value is a null-terminated string.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values) = 0;
|
||||
|
||||
/**
|
||||
* Gets the value for the named attribute.
|
||||
*
|
||||
* @param name - the name of the attribute to find
|
||||
* @param result - the resulting attribute
|
||||
* @result - NS_OK if this operation was successful, NS_ERROR_FAILURE if
|
||||
* this operation failed. result is set to NULL if the attribute is not found
|
||||
* else to the found value.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetAttribute(const char* name, const char* *result) = 0;
|
||||
|
||||
/**
|
||||
* Create a place for the plugin to live in the owner's
|
||||
* environment. this may or may not create a window
|
||||
* depending on the windowless state of the plugin instance.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
CreateWidget(void) = 0;
|
||||
|
||||
/**
|
||||
* Called when there is a valid target so that the proper
|
||||
* frame can be updated with new content. will not be called
|
||||
* with nsnull aTarget.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetURL(const char *aURL, const char *aTarget, void *aPostData) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
120
mozilla/modules/plugin/base/src/nsMalloc.cpp
Normal file
120
mozilla/modules/plugin/base/src/nsMalloc.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of nsIMalloc using NSPR
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsMalloc.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIMallocIID, NS_IMALLOC_IID);
|
||||
|
||||
nsMalloc::nsMalloc(nsISupports* outer)
|
||||
{
|
||||
NS_INIT_AGGREGATED(outer);
|
||||
}
|
||||
|
||||
nsMalloc::~nsMalloc(void)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_AGGREGATED(nsMalloc);
|
||||
|
||||
NS_METHOD
|
||||
nsMalloc::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIMallocIID) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsMalloc::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
if (outer && !aIID.Equals(kISupportsIID))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
nsMalloc* mm = new nsMalloc(outer);
|
||||
if (mm == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mm->AddRef();
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
*aInstancePtr = mm->GetInner();
|
||||
else
|
||||
*aInstancePtr = mm;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_METHOD_(void*)
|
||||
nsMalloc::Alloc(PRUint32 size)
|
||||
{
|
||||
return PR_Malloc(size);
|
||||
}
|
||||
|
||||
NS_METHOD_(void*)
|
||||
nsMalloc::Realloc(void* ptr, PRUint32 size)
|
||||
{
|
||||
return PR_Realloc(ptr, size);
|
||||
}
|
||||
|
||||
NS_METHOD_(void)
|
||||
nsMalloc::Free(void* ptr)
|
||||
{
|
||||
PR_Free(ptr);
|
||||
}
|
||||
|
||||
NS_METHOD_(PRInt32)
|
||||
nsMalloc::GetSize(void* ptr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
NS_METHOD_(PRBool)
|
||||
nsMalloc::DidAlloc(void* ptr)
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// For the definition of CallCacheFlushers()
|
||||
#ifdef XP_MAC
|
||||
# ifndef NSPR20
|
||||
# include "prmacos.h"
|
||||
# else
|
||||
# include "MacMemAllocator.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
NS_METHOD_(void)
|
||||
nsMalloc::HeapMinimize(void)
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
// something wonderful
|
||||
CallCacheFlushers(0x7fffffff);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
101
mozilla/modules/plugin/base/src/nsMalloc.h
Normal file
101
mozilla/modules/plugin/base/src/nsMalloc.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of nsIMalloc using NSPR
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsMalloc_h__
|
||||
#define nsMalloc_h__
|
||||
|
||||
#include "nsIMalloc.h"
|
||||
#include "prmem.h"
|
||||
#include "nsAgg.h"
|
||||
|
||||
class nsMalloc : nsIMalloc {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Allocates a block of memory of a particular size.
|
||||
*
|
||||
* @param size - the size of the block to allocate
|
||||
* @result the block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*)
|
||||
Alloc(PRUint32 size);
|
||||
|
||||
/**
|
||||
* Reallocates a block of memory to a new size.
|
||||
*
|
||||
* @param ptr - the block of memory to reallocate
|
||||
* @param size - the new size
|
||||
* @result the rellocated block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*)
|
||||
Realloc(void* ptr, PRUint32 size);
|
||||
|
||||
/**
|
||||
* Frees a block of memory.
|
||||
*
|
||||
* @param ptr - the block of memory to free
|
||||
*/
|
||||
NS_IMETHOD_(void)
|
||||
Free(void* ptr);
|
||||
|
||||
/**
|
||||
* Returns the size of a block of memory. Returns -1
|
||||
* if the size is not available.
|
||||
*
|
||||
* @param ptr - the block of memory
|
||||
* @result the size or -1 if not available
|
||||
*/
|
||||
NS_IMETHOD_(PRInt32)
|
||||
GetSize(void* ptr);
|
||||
|
||||
/**
|
||||
* Returns whether the block of memory was allocated by this
|
||||
* memory allocator. Returns PR_FALSE if this information is
|
||||
* not available.
|
||||
*
|
||||
* @param ptr - the block of memory
|
||||
* @result true if allocated by this nsIMalloc, false if not or
|
||||
* if it can't be determined
|
||||
*/
|
||||
NS_IMETHOD_(PRBool)
|
||||
DidAlloc(void* ptr);
|
||||
|
||||
/**
|
||||
* Attempts to shrink the heap.
|
||||
*/
|
||||
NS_IMETHOD_(void)
|
||||
HeapMinimize(void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsMalloc(nsISupports* outer);
|
||||
virtual ~nsMalloc(void);
|
||||
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // nsMalloc_h__
|
||||
156
mozilla/modules/plugin/base/src/nsPluginFactory.cpp
Normal file
156
mozilla/modules/plugin/base/src/nsPluginFactory.cpp
Normal file
@@ -0,0 +1,156 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
#include "nsPluginsCID.h"
|
||||
#include "nsPluginHostImpl.h"
|
||||
|
||||
static NS_DEFINE_IID(kCPluginHost, NS_PLUGIN_HOST_CID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
class nsPluginFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_IMETHOD QueryInterface(const nsIID &aIID,
|
||||
void **aResult);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
nsPluginFactory(const nsCID &aClass);
|
||||
|
||||
protected:
|
||||
virtual ~nsPluginFactory();
|
||||
|
||||
private:
|
||||
nsrefcnt mRefCnt;
|
||||
nsCID mClassID;
|
||||
};
|
||||
|
||||
nsPluginFactory :: nsPluginFactory(const nsCID &aClass)
|
||||
{
|
||||
mRefCnt = 0;
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
nsPluginFactory :: ~nsPluginFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
nsresult nsPluginFactory :: QueryInterface(const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
}
|
||||
|
||||
if (*aResult == NULL) {
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsrefcnt nsPluginFactory :: AddRef()
|
||||
{
|
||||
return ++mRefCnt;
|
||||
}
|
||||
|
||||
nsrefcnt nsPluginFactory :: Release()
|
||||
{
|
||||
if (--mRefCnt == 0) {
|
||||
delete this;
|
||||
return 0; // Don't access mRefCnt after deleting!
|
||||
}
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
nsresult nsPluginFactory :: CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
if (mClassID.Equals(kCPluginHost)) {
|
||||
inst = (nsISupports *)(nsIPluginManager *)new nsPluginHostImpl();
|
||||
}
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsPluginFactory :: LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_PLUGIN nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aFactory = new nsPluginFactory(aClass);
|
||||
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
||||
1364
mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp
Normal file
1364
mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
140
mozilla/modules/plugin/base/src/nsPluginHostImpl.h
Normal file
140
mozilla/modules/plugin/base/src/nsPluginHostImpl.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsPluginHostImpl_h__
|
||||
#define nsPluginHostImpl_h__
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "nsIPluginManager.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prlink.h"
|
||||
#include "nsIMalloc.h"
|
||||
|
||||
class ns4xPlugin;
|
||||
|
||||
class nsPluginTag
|
||||
{
|
||||
public:
|
||||
nsPluginTag();
|
||||
~nsPluginTag();
|
||||
|
||||
nsPluginTag *mNext;
|
||||
char *mName;
|
||||
char *mDescription;
|
||||
char *mMimeType;
|
||||
char *mMimeDescription;
|
||||
char *mExtensions;
|
||||
PRInt32 mVariants;
|
||||
char **mMimeTypeArray;
|
||||
char **mMimeDescriptionArray;
|
||||
char **mExtensionsArray;
|
||||
PRLibrary *mLibrary;
|
||||
nsIPlugin *mEntryPoint;
|
||||
PRUint32 mFlags;
|
||||
};
|
||||
|
||||
#define NS_PLUGIN_FLAG_ENABLED 0x0001 //is this plugin enabled?
|
||||
#define NS_PLUGIN_FLAG_OLDSCHOOL 0x0002 //is this a pre-xpcom plugin?
|
||||
|
||||
class nsPluginHostImpl : public nsIPluginManager, public nsIPluginHost
|
||||
{
|
||||
public:
|
||||
nsPluginHostImpl();
|
||||
~nsPluginHostImpl();
|
||||
|
||||
void* operator new(size_t sz) {
|
||||
void* rv = new char[sz];
|
||||
nsCRT::zero(rv, sz);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIPluginManager interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginManagerVariable variable, void *value);
|
||||
|
||||
NS_IMETHOD
|
||||
ReloadPlugins(PRBool reloadPages);
|
||||
|
||||
NS_IMETHOD
|
||||
UserAgent(const char* *resultingAgentString);
|
||||
|
||||
NS_IMETHOD
|
||||
GetURL(nsISupports* inst, const char* url, const char* target,
|
||||
void* notifyData = NULL, const char* altHost = NULL,
|
||||
const char* referrer = NULL, PRBool forceJSEnabled = PR_FALSE);
|
||||
|
||||
NS_IMETHOD
|
||||
PostURL(nsISupports* inst, const char* url, const char* target,
|
||||
PRUint32 postDataLen, const char* postData,
|
||||
PRBool isFile = PR_FALSE, void* notifyData = NULL,
|
||||
const char* altHost = NULL, const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE,
|
||||
PRUint32 postHeadersLength = 0, const char* postHeaders = NULL);
|
||||
|
||||
NS_IMETHOD
|
||||
FindProxyForURL(const char* url, char* *result);
|
||||
|
||||
//nsIPluginHost interface
|
||||
|
||||
NS_IMETHOD
|
||||
Init(void);
|
||||
|
||||
NS_IMETHOD
|
||||
Destroy(void);
|
||||
|
||||
NS_IMETHOD
|
||||
LoadPlugins(void);
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsIURL *aURL, nsIPluginInstanceOwner *aOwner);
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsString& aURLSpec, nsIPluginInstanceOwner *aOwner);
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsString& aURLSpec,
|
||||
nsIStreamListener *&aStreamListener, nsIPluginInstanceOwner *aOwner);
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(const nsString& aURL, nsIPluginInstance *aInstance, void *aNotifyData);
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(const nsString& aURL, nsIPluginInstanceOwner *aOwner, void *aNotifyData);
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(nsIStreamListener *&aStreamListener, nsIPluginInstance *aInstance, void *aNotifyData);
|
||||
|
||||
//nsIFactory interface
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
private:
|
||||
char *mPluginPath;
|
||||
nsPluginTag *mPlugins;
|
||||
nsIMalloc *mMalloc;
|
||||
};
|
||||
|
||||
#endif
|
||||
179
mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp
Normal file
179
mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp
Normal file
@@ -0,0 +1,179 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsPluginInstancePeer.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include <stdio.h>
|
||||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
|
||||
nsPluginInstancePeerImpl :: nsPluginInstancePeerImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mInstance = nsnull;
|
||||
mOwner = nsnull;
|
||||
mMIMEType = nsnull;
|
||||
}
|
||||
|
||||
nsPluginInstancePeerImpl :: ~nsPluginInstancePeerImpl()
|
||||
{
|
||||
mInstance = nsnull;
|
||||
mOwner = nsnull;
|
||||
|
||||
if (nsnull != mMIMEType)
|
||||
{
|
||||
PR_Free((void *)mMIMEType);
|
||||
mMIMEType = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsPluginInstancePeerImpl);
|
||||
NS_IMPL_RELEASE(nsPluginInstancePeerImpl);
|
||||
|
||||
static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
|
||||
static NS_DEFINE_IID(kIPluginInstancePeerIID, NS_IPLUGININSTANCEPEER_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
nsresult nsPluginInstancePeerImpl :: QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(kIPluginInstancePeerIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginInstancePeer *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIPluginTagInfoIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginTagInfo *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)(nsIPluginTagInfo *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetValue(nsPluginInstancePeerVariable variable, void *value)
|
||||
{
|
||||
printf("instance peer getvalue %d called\n", variable);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetMIMEType(nsMIMEType *result)
|
||||
{
|
||||
if (nsnull == mMIMEType)
|
||||
*result = "";
|
||||
else
|
||||
*result = mMIMEType;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetMode(nsPluginMode *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
return mOwner->GetMode(result);
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl :: NewStream(nsMIMEType type, const char* target, nsIOutputStream* *result)
|
||||
{
|
||||
printf("instance peer newstream called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl :: ShowStatus(const char* message)
|
||||
{
|
||||
printf("instance peer showstatus called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
return mOwner->GetAttributes(n, names, values);
|
||||
else
|
||||
{
|
||||
n = 0;
|
||||
names = nsnull;
|
||||
values = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetAttribute(const char* name, const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
return mOwner->GetAttribute(name, result);
|
||||
else
|
||||
{
|
||||
*result = "";
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl :: SetWindowSize(PRUint32 width, PRUint32 height)
|
||||
{
|
||||
printf("instance peer setwindowsize called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginInstancePeerImpl :: Initialize(nsIPluginInstanceOwner *aOwner,
|
||||
const nsMIMEType aMIMEType)
|
||||
{
|
||||
//don't add a ref to precent circular references... MMP
|
||||
mOwner = aOwner;
|
||||
|
||||
aOwner->GetInstance(mInstance);
|
||||
//release this one too... MMP
|
||||
NS_IF_RELEASE(mInstance);
|
||||
|
||||
if (nsnull != aMIMEType)
|
||||
{
|
||||
mMIMEType = (nsMIMEType)PR_Malloc(PL_strlen(aMIMEType) + 1);
|
||||
|
||||
if (nsnull != mMIMEType)
|
||||
PL_strcpy((char *)mMIMEType, aMIMEType);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginInstancePeerImpl :: GetOwner(nsIPluginInstanceOwner *&aOwner)
|
||||
{
|
||||
aOwner = mOwner;
|
||||
NS_IF_ADDREF(mOwner);
|
||||
|
||||
if (nsnull != mOwner)
|
||||
return NS_OK;
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
75
mozilla/modules/plugin/base/src/nsPluginInstancePeer.h
Normal file
75
mozilla/modules/plugin/base/src/nsPluginInstancePeer.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsPluginInstancePeer_h___
|
||||
#define nsPluginInstancePeer_h___
|
||||
|
||||
#include "nsIPluginInstancePeer.h"
|
||||
#include "nsIPluginTagInfo.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
|
||||
class nsPluginInstancePeerImpl : public nsIPluginInstancePeer, public nsIPluginTagInfo
|
||||
{
|
||||
public:
|
||||
nsPluginInstancePeerImpl();
|
||||
~nsPluginInstancePeerImpl();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIPluginInstancePeer interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginInstancePeerVariable variable, void *value);
|
||||
|
||||
NS_IMETHOD
|
||||
GetMIMEType(nsMIMEType *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetMode(nsPluginMode *result);
|
||||
|
||||
NS_IMETHOD
|
||||
NewStream(nsMIMEType type, const char* target, nsIOutputStream* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
ShowStatus(const char* message);
|
||||
|
||||
NS_IMETHOD
|
||||
SetWindowSize(PRUint32 width, PRUint32 height);
|
||||
|
||||
//nsIPluginTagInfo interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values);
|
||||
|
||||
NS_IMETHOD
|
||||
GetAttribute(const char* name, const char* *result);
|
||||
|
||||
//locals
|
||||
|
||||
nsresult Initialize(nsIPluginInstanceOwner *aInstance,
|
||||
const nsMIMEType aMimeType);
|
||||
|
||||
nsresult GetOwner(nsIPluginInstanceOwner *&aOwner);
|
||||
|
||||
private:
|
||||
nsIPluginInstance *mInstance; //we don't add a ref to this
|
||||
nsIPluginInstanceOwner *mOwner; //we don't add a ref to this
|
||||
nsMIMEType mMIMEType;
|
||||
};
|
||||
|
||||
#endif
|
||||
168
mozilla/modules/plugin/base/src/nsPluginStreamPeer.cpp
Normal file
168
mozilla/modules/plugin/base/src/nsPluginStreamPeer.cpp
Normal file
@@ -0,0 +1,168 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsPluginStreamPeer.h"
|
||||
#include "nsIURL.h"
|
||||
#include "prmem.h"
|
||||
#include "nsString.h"
|
||||
|
||||
nsPluginStreamPeer :: nsPluginStreamPeer()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mURL = nsnull;
|
||||
mLength = 0;
|
||||
mLastMod = 0;
|
||||
mNotifyData = nsnull;
|
||||
mMIMEType = nsnull;
|
||||
mURLSpec = nsnull;
|
||||
mReason = nsPluginReason_NoReason;
|
||||
}
|
||||
|
||||
nsPluginStreamPeer :: ~nsPluginStreamPeer()
|
||||
{
|
||||
NS_IF_RELEASE(mURL);
|
||||
|
||||
if (nsnull != mMIMEType)
|
||||
{
|
||||
PR_Free((void *)mMIMEType);
|
||||
mMIMEType = nsnull;
|
||||
}
|
||||
|
||||
if (nsnull != mURLSpec)
|
||||
{
|
||||
PR_Free((void *)mURLSpec);
|
||||
mURLSpec = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsPluginStreamPeer);
|
||||
NS_IMPL_RELEASE(nsPluginStreamPeer);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIPluginStreamPeerIID, NS_IPLUGINSTREAMPEER_IID);
|
||||
//static NS_DEFINE_IID(kISeekablePluginStreamPeerIID, NS_ISEEKABLEPLUGINSTREAMPEER_IID);
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamPeer :: QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(kIPluginStreamPeerIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginStreamPeer *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamPeer :: GetURL(const char* *result)
|
||||
{
|
||||
if (nsnull != mURL)
|
||||
{
|
||||
if (nsnull == mURLSpec)
|
||||
{
|
||||
nsString string;
|
||||
|
||||
mURL->ToString(string);
|
||||
|
||||
mURLSpec = (char *)PR_Malloc(string.Length() + 1);
|
||||
|
||||
if (nsnull != mURLSpec)
|
||||
string.ToCString(mURLSpec, string.Length() + 1);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
*result = mURLSpec;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamPeer :: GetEnd(PRUint32 *result)
|
||||
{
|
||||
*result = mLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamPeer :: GetLastModified(PRUint32 *result)
|
||||
{
|
||||
*result = mLastMod;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamPeer :: GetNotifyData(void* *result)
|
||||
{
|
||||
*result = mNotifyData;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamPeer :: GetReason(nsPluginReason *result)
|
||||
{
|
||||
*result = mReason;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginStreamPeer :: GetMIMEType(nsMIMEType *result)
|
||||
{
|
||||
*result = mMIMEType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginStreamPeer :: Initialize(nsIURL *aURL, PRUint32 aLength,
|
||||
PRUint32 aLastMod, nsMIMEType aMIMEType,
|
||||
void *aNotifyData)
|
||||
{
|
||||
mURL = aURL;
|
||||
NS_ADDREF(mURL);
|
||||
|
||||
mLength = aLength;
|
||||
mLastMod = aLastMod;
|
||||
|
||||
if (nsnull != aMIMEType)
|
||||
{
|
||||
PRInt32 len = strlen(aMIMEType);
|
||||
mMIMEType = (char *)PR_Malloc(len + 1);
|
||||
|
||||
if (nsnull != mMIMEType)
|
||||
strcpy((char *)mMIMEType, (char *)aMIMEType);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mNotifyData = aNotifyData;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginStreamPeer :: SetReason(nsPluginReason aReason)
|
||||
{
|
||||
mReason = aReason;
|
||||
return NS_OK;
|
||||
}
|
||||
71
mozilla/modules/plugin/base/src/nsPluginStreamPeer.h
Normal file
71
mozilla/modules/plugin/base/src/nsPluginStreamPeer.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsPluginStreamPeer_h___
|
||||
#define nsPluginStreamPeer_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIPluginStreamPeer.h"
|
||||
|
||||
class nsIURL;
|
||||
|
||||
class nsPluginStreamPeer : public nsIPluginStreamPeer
|
||||
{
|
||||
public:
|
||||
nsPluginStreamPeer();
|
||||
~nsPluginStreamPeer();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD
|
||||
GetURL(const char* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetEnd(PRUint32 *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetLastModified(PRUint32 *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetNotifyData(void* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetReason(nsPluginReason *result);
|
||||
|
||||
NS_IMETHOD
|
||||
GetMIMEType(nsMIMEType *result);
|
||||
|
||||
//locals
|
||||
|
||||
nsresult Initialize(nsIURL *aURL, PRUint32 aLength,
|
||||
PRUint32 aLastMod, nsMIMEType aMIMEType,
|
||||
void *aNotifyData);
|
||||
|
||||
nsresult SetReason(nsPluginReason aReason);
|
||||
|
||||
private:
|
||||
nsIURL *mURL;
|
||||
PRUint32 mLength;
|
||||
PRUint32 mLastMod;
|
||||
void *mNotifyData;
|
||||
nsMIMEType mMIMEType;
|
||||
char *mURLSpec;
|
||||
nsPluginReason mReason;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -16,10 +16,15 @@
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __NS_JSWINREG_H__
|
||||
#define __NS_JSWINREG_H__
|
||||
#ifndef nsPluginsCID_h__
|
||||
#define nsPluginsCID_h__
|
||||
|
||||
PRInt32
|
||||
InitWinRegPrototype(JSContext *jscontext, JSObject *global, JSObject **winRegPrototype);
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsRepository.h"
|
||||
|
||||
#endif
|
||||
#define NS_PLUGIN_HOST_CID \
|
||||
{ 0xadea1880, 0x1a8e, 0x11d2, \
|
||||
{ 0xa8, 0x2e, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
||||
|
||||
#endif // nsPluginsCID_h__
|
||||
33
mozilla/modules/plugin/makefile.win
Normal file
33
mozilla/modules/plugin/makefile.win
Normal file
@@ -0,0 +1,33 @@
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Makefile to build the MODULES\APPLET tree
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH=..\..
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
|
||||
#// (these must come before the common makefiles are included)
|
||||
#//
|
||||
#// DIRS - There are subdirectories to process
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
!if !defined(NGLAYOUT_PLUGINS)
|
||||
DIRS= public src
|
||||
!else
|
||||
DIRS= public nglsrc
|
||||
!endif
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
24
mozilla/modules/plugin/nglsrc/MANIFEST
Normal file
24
mozilla/modules/plugin/nglsrc/MANIFEST
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsPluginsCID.h
|
||||
nsIPluginHost.h
|
||||
nsIPluginInstanceOwner.h
|
||||
50
mozilla/modules/plugin/nglsrc/Makefile
Normal file
50
mozilla/modules/plugin/nglsrc/Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=../../..
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
LIBRARY_NAME=raptorplugin
|
||||
|
||||
EXPORTS = \
|
||||
nsPluginsCID.h \
|
||||
nsIPluginHost.h \
|
||||
nsIPluginInstanceOwner.h
|
||||
|
||||
CPPSRCS = \
|
||||
nsPluginHostImpl.cpp \
|
||||
nsPluginFactory.cpp \
|
||||
ns4xPlugin.cpp \
|
||||
ns4xPluginInstance.cpp \
|
||||
ns4xPluginStream.cpp \
|
||||
nsPluginInstancePeer.cpp \
|
||||
nsPluginStreamPeer.cpp \
|
||||
nsMalloc.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = raptor plugin java xpcom netlib libplc21
|
||||
|
||||
LCFLAGS =-D_IMPL_NS_PLUGIN
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
||||
INCLUDES += -I.
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
57
mozilla/modules/plugin/nglsrc/Makefile.in
Normal file
57
mozilla/modules/plugin/nglsrc/Makefile.in
Normal file
@@ -0,0 +1,57 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
LIBRARY_NAME=raptorplugin
|
||||
|
||||
EXPORTS = \
|
||||
nsPluginsCID.h \
|
||||
nsIPluginHost.h \
|
||||
nsIPluginInstanceOwner.h
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
CPPSRCS = \
|
||||
nsPluginHostImpl.cpp \
|
||||
nsPluginFactory.cpp \
|
||||
ns4xPlugin.cpp \
|
||||
ns4xPluginInstance.cpp \
|
||||
ns4xPluginStream.cpp \
|
||||
nsPluginInstancePeer.cpp \
|
||||
nsPluginStreamPeer.cpp \
|
||||
nsMalloc.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = raptor plugin java xpcom netlib libplc21
|
||||
|
||||
LCFLAGS =-D_IMPL_NS_PLUGIN
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
||||
INCLUDES += -I$(srcdir)/
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
80
mozilla/modules/plugin/nglsrc/makefile.win
Normal file
80
mozilla/modules/plugin/nglsrc/makefile.win
Normal file
@@ -0,0 +1,80 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..\..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
EXPORTS = \
|
||||
nsPluginsCID.h \
|
||||
nsIPluginHost.h \
|
||||
nsIPluginInstanceOwner.h
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
DLLNAME = raptorplugin
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
MISCDEP = $(OURLIBS)
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
DEFINES =-D_IMPL_NS_PLUGIN -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsPluginHostImpl.obj \
|
||||
.\$(OBJDIR)\nsPluginFactory.obj \
|
||||
.\$(OBJDIR)\ns4xPlugin.obj \
|
||||
.\$(OBJDIR)\ns4xPluginInstance.obj \
|
||||
.\$(OBJDIR)\ns4xPluginStream.obj \
|
||||
.\$(OBJDIR)\nsPluginInstancePeer.obj \
|
||||
.\$(OBJDIR)\nsPluginStreamPeer.obj \
|
||||
.\$(OBJDIR)\nsMalloc.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS= \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\plugin \
|
||||
-I$(PUBLIC)\java \
|
||||
-I$(PUBLIC)\netlib \
|
||||
$(NULL)
|
||||
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
-D_IMPL_NS_PLUGIN \
|
||||
$(NULL)
|
||||
|
||||
OURLIBS= \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\libplc21.lib \
|
||||
$(DIST)\lib\netlib.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
LLIBS= \
|
||||
$(OURLIBS) \
|
||||
version.lib
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
it:
|
||||
echo $(LLIBS)
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\$(DLLNAME).dll
|
||||
780
mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp
Normal file
780
mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp
Normal file
@@ -0,0 +1,780 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
// TODO: Implement Java callbacks
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "nsplugin.h"
|
||||
#include "ns4xPlugin.h"
|
||||
#include "nsIPluginStream.h"
|
||||
#include "ns4xPluginInstance.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NPNetscapeFuncs ns4xPlugin::CALLBACKS;
|
||||
nsIPluginManager * ns4xPlugin::mPluginManager;
|
||||
nsIMalloc * ns4xPlugin::mMalloc;
|
||||
|
||||
void
|
||||
ns4xPlugin::CheckClassInitialized(void)
|
||||
{
|
||||
static PRBool initialized = FALSE;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
mPluginManager = nsnull;
|
||||
mMalloc = nsnull;
|
||||
|
||||
// XXX It'd be nice to make this const and initialize it
|
||||
// statically...
|
||||
CALLBACKS.size = sizeof(CALLBACKS);
|
||||
CALLBACKS.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
|
||||
|
||||
CALLBACKS.geturl = NewNPN_GetURLProc(_geturl);
|
||||
CALLBACKS.posturl = NewNPN_PostURLProc(_posturl);
|
||||
CALLBACKS.requestread = NewNPN_RequestReadProc(_requestread);
|
||||
CALLBACKS.newstream = NewNPN_NewStreamProc(_newstream);
|
||||
CALLBACKS.write = NewNPN_WriteProc(_write);
|
||||
CALLBACKS.destroystream = NewNPN_DestroyStreamProc(_destroystream);
|
||||
CALLBACKS.status = NewNPN_StatusProc(_status);
|
||||
CALLBACKS.uagent = NewNPN_UserAgentProc(_useragent);
|
||||
CALLBACKS.memalloc = NewNPN_MemAllocProc(_memalloc);
|
||||
CALLBACKS.memfree = NewNPN_MemFreeProc(_memfree);
|
||||
CALLBACKS.memflush = NewNPN_MemFlushProc(_memflush);
|
||||
CALLBACKS.reloadplugins = NewNPN_ReloadPluginsProc(_reloadplugins);
|
||||
CALLBACKS.getJavaEnv = NewNPN_GetJavaEnvProc(_getJavaEnv);
|
||||
// CALLBACKS.getJavaPeer = NewNPN_GetJavaPeerProc(_getJavaPeer);
|
||||
CALLBACKS.geturlnotify = NewNPN_GetURLNotifyProc(_geturlnotify);
|
||||
CALLBACKS.posturlnotify = NewNPN_PostURLNotifyProc(_posturlnotify);
|
||||
CALLBACKS.getvalue = NewNPN_GetValueProc(_getvalue);
|
||||
CALLBACKS.setvalue = NewNPN_SetValueProc(_setvalue);
|
||||
CALLBACKS.invalidaterect = NewNPN_InvalidateRectProc(_invalidaterect);
|
||||
CALLBACKS.invalidateregion = NewNPN_InvalidateRegionProc(_invalidateregion);
|
||||
CALLBACKS.forceredraw = NewNPN_ForceRedrawProc(_forceredraw);
|
||||
|
||||
initialized = TRUE;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
|
||||
fShutdownEntry = aShutdown;
|
||||
}
|
||||
|
||||
|
||||
ns4xPlugin::~ns4xPlugin(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports stuff
|
||||
|
||||
NS_IMPL_ADDREF(ns4xPlugin);
|
||||
NS_IMPL_RELEASE(ns4xPlugin);
|
||||
|
||||
static NS_DEFINE_IID(kILiveConnectPluginIID, NS_ILIVECONNECTPLUGIN_IID);
|
||||
static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIWindowlessPluginInstancePeerIID, NS_IWINDOWLESSPLUGININSTANCEPEER_IID);
|
||||
static NS_DEFINE_IID(kISeekablePluginStreamPeerIID, NS_ISEEKABLEPLUGINSTREAMPEER_IID);
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(kIPluginIID))
|
||||
{
|
||||
*instance = (void *)(nsIPlugin *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kILiveConnectPluginIID))
|
||||
{
|
||||
// Check the 4.x plugin callbacks to see if it supports
|
||||
// LiveConnect...
|
||||
if (fCallbacks.javaClass == NULL)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
*instance = (void *)(nsILiveConnectPlugin *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Static factory method.
|
||||
//
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::CreatePlugin(PRLibrary *library,
|
||||
nsIPlugin **result)
|
||||
{
|
||||
CheckClassInitialized();
|
||||
|
||||
NP_GETENTRYPOINTS pfnGetEntryPoints =
|
||||
(NP_GETENTRYPOINTS)PR_FindSymbol(library, "NP_GetEntryPoints");
|
||||
|
||||
if (pfnGetEntryPoints == NULL)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NPPluginFuncs callbacks;
|
||||
memset((void*) &callbacks, 0, sizeof(callbacks));
|
||||
|
||||
callbacks.size = sizeof(callbacks);
|
||||
|
||||
if (pfnGetEntryPoints(&callbacks) != NS_OK)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
#ifdef XP_WIN // XXX This is really XP, but we need to figure out how to do HIBYTE()
|
||||
if (HIBYTE(callbacks.version) < NP_VERSION_MAJOR)
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
NP_PLUGINSHUTDOWN pfnShutdown =
|
||||
(NP_PLUGINSHUTDOWN)PR_FindSymbol(library, "NP_Shutdown");
|
||||
|
||||
// the NP_Initialize entry point was misnamed as NP_PluginInit,
|
||||
// early in plugin project development. Its correct name is
|
||||
// documented now, and new developers expect it to work. However,
|
||||
// I don't want to break the plugins already in the field, so
|
||||
// we'll accept either name
|
||||
NP_PLUGININIT pfnInitialize =
|
||||
(NP_PLUGININIT)PR_FindSymbol(library, "NP_Initialize");
|
||||
|
||||
if (!pfnInitialize) {
|
||||
pfnInitialize =
|
||||
(NP_PLUGININIT)PR_FindSymbol(library, "NP_PluginInit");
|
||||
}
|
||||
|
||||
if (pfnInitialize == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX Right error?
|
||||
|
||||
if (pfnInitialize(&ns4xPlugin::CALLBACKS) != NS_OK)
|
||||
return NS_ERROR_UNEXPECTED; // XXX shoudl convert the 4.x error...
|
||||
|
||||
*result = new ns4xPlugin(&callbacks, pfnShutdown);
|
||||
|
||||
NS_ADDREF(*result);
|
||||
|
||||
if (*result == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult ns4xPlugin :: CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst;
|
||||
|
||||
inst = nsnull;
|
||||
inst = (nsISupports *)(nsIPluginInstance *)new ns4xPluginInstance(&fCallbacks);
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult ns4xPlugin :: LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
|
||||
static NS_DEFINE_IID(kIMallocIID, NS_IMALLOC_IID);
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::Initialize(nsISupports* browserInterfaces)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (nsnull == mPluginManager)
|
||||
rv = browserInterfaces->QueryInterface(kIPluginManagerIID, (void **)&mPluginManager);
|
||||
|
||||
if (nsnull == mMalloc)
|
||||
rv = browserInterfaces->QueryInterface(kIMallocIID, (void **)&mMalloc);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::Shutdown(void)
|
||||
{
|
||||
if (nsnull != fShutdownEntry)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
printf("shutting down plugin %08x\n", this);
|
||||
#endif
|
||||
fShutdownEntry();
|
||||
fShutdownEntry = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mPluginManager);
|
||||
NS_IF_RELEASE(mMalloc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::GetMIMEDescription(const char* *resultingDesc)
|
||||
{
|
||||
printf("plugin getmimedescription called\n");
|
||||
*resultingDesc = "";
|
||||
return NS_OK; // XXX make a callback, etc.
|
||||
}
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::GetValue(nsPluginVariable variable, void *value)
|
||||
{
|
||||
printf("plugin getvalue %d called\n", variable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ns4xPlugin::GetJavaClass(jclass *resultingClass)
|
||||
{
|
||||
*resultingClass = (jclass)fCallbacks.javaClass;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Static callbacks that get routed back through the new C++ API
|
||||
//
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_geturl(NPP npp, const char* relativeURL, const char* target)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
return mPluginManager->GetURL(inst, relativeURL, target);
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_geturlnotify(NPP npp, const char* relativeURL, const char* target,
|
||||
void* notifyData)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
return mPluginManager->GetURL(inst, relativeURL, target,
|
||||
notifyData);
|
||||
}
|
||||
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_posturlnotify(NPP npp, const char* relativeURL, const char *target,
|
||||
uint32 len, const char *buf, NPBool file,
|
||||
void* notifyData)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
return mPluginManager->PostURL(inst, relativeURL, target,
|
||||
len, buf, file, notifyData);
|
||||
}
|
||||
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_posturl(NPP npp, const char* relativeURL, const char *target, uint32 len,
|
||||
const char *buf, NPBool file)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
return mPluginManager->PostURL(inst, relativeURL, target,
|
||||
len, buf, file);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A little helper class used to wrap up plugin manager streams (that is,
|
||||
* streams from the plugin to the browser).
|
||||
*/
|
||||
class ns4xStreamWrapper
|
||||
{
|
||||
protected:
|
||||
nsIOutputStream *fStream;
|
||||
NPStream fNPStream;
|
||||
|
||||
public:
|
||||
ns4xStreamWrapper(nsIOutputStream* stream);
|
||||
~ns4xStreamWrapper();
|
||||
|
||||
nsIOutputStream*
|
||||
GetStream(void);
|
||||
|
||||
NPStream*
|
||||
GetNPStream(void) {
|
||||
return &fNPStream;
|
||||
};
|
||||
};
|
||||
|
||||
ns4xStreamWrapper::ns4xStreamWrapper(nsIOutputStream* stream)
|
||||
: fStream(stream)
|
||||
{
|
||||
NS_ASSERTION(stream != NULL, "bad stream");
|
||||
|
||||
NS_ADDREF(fStream);
|
||||
|
||||
memset(&fNPStream, 0, sizeof(fNPStream));
|
||||
fNPStream.ndata = (void*) this;
|
||||
}
|
||||
|
||||
ns4xStreamWrapper::~ns4xStreamWrapper(void)
|
||||
{
|
||||
NS_IF_RELEASE(fStream);
|
||||
}
|
||||
|
||||
nsIOutputStream*
|
||||
ns4xStreamWrapper::GetStream(void)
|
||||
{
|
||||
NS_IF_ADDREF(fStream);
|
||||
|
||||
return fStream;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_newstream(NPP npp, NPMIMEType type, const char* window, NPStream* *result)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_UNEXPECTED; // XXX
|
||||
|
||||
nsresult error;
|
||||
nsIOutputStream* stream;
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
if ((error = peer->NewStream((const char*) type, window, &stream)) != NS_OK)
|
||||
{
|
||||
NS_RELEASE(peer);
|
||||
return error;
|
||||
}
|
||||
|
||||
ns4xStreamWrapper* wrapper = new ns4xStreamWrapper(stream);
|
||||
|
||||
if (wrapper == NULL)
|
||||
{
|
||||
NS_RELEASE(peer);
|
||||
NS_RELEASE(stream);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
(*result) = wrapper->GetNPStream();
|
||||
|
||||
NS_RELEASE(peer);
|
||||
|
||||
return error;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
int32 NP_EXPORT
|
||||
ns4xPlugin::_write(NPP npp, NPStream *pstream, int32 len, void *buffer)
|
||||
{
|
||||
ns4xStreamWrapper* wrapper = (ns4xStreamWrapper*) npp->ndata;
|
||||
|
||||
NS_ASSERTION(wrapper != NULL, "null wrapper");
|
||||
|
||||
if (wrapper == NULL)
|
||||
return 0;
|
||||
|
||||
nsIOutputStream* stream = wrapper->GetStream();
|
||||
|
||||
PRInt32 count = 0;
|
||||
nsresult rv = stream->Write((char *)buffer, 0, len, &count);
|
||||
|
||||
NS_RELEASE(stream);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_destroystream(NPP npp, NPStream *pstream, NPError reason)
|
||||
{
|
||||
ns4xStreamWrapper* wrapper = (ns4xStreamWrapper*) npp->ndata;
|
||||
|
||||
NS_ASSERTION(wrapper != NULL, "null wrapper");
|
||||
|
||||
if (wrapper == NULL)
|
||||
return 0;
|
||||
|
||||
// This will release the wrapped nsIOutputStream.
|
||||
delete wrapper;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_status(NPP npp, const char *message)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
peer->ShowStatus(message);
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_memfree (void *ptr)
|
||||
{
|
||||
mMalloc->Free(ptr);
|
||||
}
|
||||
|
||||
uint32 NP_EXPORT
|
||||
ns4xPlugin::_memflush(uint32 size)
|
||||
{
|
||||
mMalloc->HeapMinimize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_reloadplugins(NPBool reloadPages)
|
||||
{
|
||||
mPluginManager->ReloadPlugins(reloadPages);
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_invalidaterect(NPP npp, NPRect *invalidRect)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
nsIWindowlessPluginInstancePeer *wpeer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
||||
{
|
||||
// XXX nsRect & NPRect are structurally equivalent
|
||||
wpeer->InvalidateRect((nsPluginRect *)invalidRect);
|
||||
NS_RELEASE(wpeer);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_invalidateregion(NPP npp, NPRegion invalidRegion)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
nsIWindowlessPluginInstancePeer *wpeer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
||||
{
|
||||
// XXX nsRegion & NPRegion are typedef'd to the same thing
|
||||
wpeer->InvalidateRegion((nsPluginRegion)invalidRegion);
|
||||
NS_RELEASE(wpeer);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
void NP_EXPORT
|
||||
ns4xPlugin::_forceredraw(NPP npp)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return;
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
nsIWindowlessPluginInstancePeer *wpeer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
||||
{
|
||||
wpeer->ForceRedraw();
|
||||
NS_RELEASE(wpeer);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
{
|
||||
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// XXX Note that for backwards compatibility, the old NPNVariables
|
||||
// map correctly to NPPluginManagerVariables.
|
||||
rv = peer->GetValue((nsPluginInstancePeerVariable)variable, result);
|
||||
NS_RELEASE(peer);
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_setvalue(NPP npp, NPPVariable variable, void *result)
|
||||
{
|
||||
ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;
|
||||
|
||||
NS_ASSERTION(inst != NULL, "null instance");
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
switch (variable)
|
||||
{
|
||||
case NPPVpluginWindowBool:
|
||||
return inst->SetWindowless(*((NPBool *)result));
|
||||
|
||||
case NPPVpluginTransparentBool:
|
||||
return inst->SetTransparent(*((NPBool *)result));
|
||||
|
||||
default:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
if (NS_OK == inst->GetPeer(&peer))
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// XXX Note that for backwards compatibility, the old NPPVariables
|
||||
// map correctly to NPPluginVariables.
|
||||
rv = peer->SetValue((nsPluginInstancePeerVariable)variable, result);
|
||||
NS_RELEASE(peer);
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult NP_EXPORT
|
||||
ns4xPlugin::_requestread(NPStream *pstream, NPByteRange *rangeList)
|
||||
{
|
||||
nsIPluginStreamPeer* streamPeer = (nsIPluginStreamPeer*) pstream->ndata;
|
||||
|
||||
NS_ASSERTION(streamPeer != NULL, "null streampeer");
|
||||
|
||||
if (streamPeer == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
nsISeekablePluginStreamPeer* seekablePeer = NULL;
|
||||
|
||||
if (streamPeer->QueryInterface(kISeekablePluginStreamPeerIID,
|
||||
(void**)seekablePeer) == NS_OK)
|
||||
{
|
||||
nsresult error;
|
||||
|
||||
// XXX nsByteRange & NPByteRange are structurally equivalent.
|
||||
error = seekablePeer->RequestRead((nsByteRange *)rangeList);
|
||||
NS_RELEASE(seekablePeer);
|
||||
return error;
|
||||
}
|
||||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// On 68K Mac (XXX still supported?), we need to make sure that the
|
||||
// pointers are in D0 for the following functions that return pointers.
|
||||
//
|
||||
|
||||
#if defined(XP_MAC) && !defined(powerc)
|
||||
#pragma pointers_in_D0
|
||||
#endif
|
||||
|
||||
|
||||
JRIEnv* NP_EXPORT
|
||||
ns4xPlugin::_getJavaEnv(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * NP_EXPORT
|
||||
ns4xPlugin::_useragent(NPP npp)
|
||||
{
|
||||
NS_ASSERTION(mPluginManager != NULL, "null pluginmanager");
|
||||
|
||||
if (mPluginManager == NULL)
|
||||
return NULL;
|
||||
|
||||
char *retstr;
|
||||
|
||||
mPluginManager->UserAgent((const char **)&retstr);
|
||||
|
||||
return retstr;
|
||||
}
|
||||
|
||||
void * NP_EXPORT
|
||||
ns4xPlugin::_memalloc (uint32 size)
|
||||
{
|
||||
return mMalloc->Alloc(size);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
#ifdef JAVA
|
||||
java_lang_Class* NP_EXPORT
|
||||
ns4xPlugin::_getJavaClass(void* handle)
|
||||
{
|
||||
// Is this just a generic call into the Java VM?
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
jref NP_EXPORT
|
||||
ns4xPlugin::_getJavaPeer(NPP npp)
|
||||
{
|
||||
NPIPluginInstancePeer* peer = (NPIPluginInstancePeer*) npp->ndata;
|
||||
PR_ASSERT(peer != NULL);
|
||||
if (peer == NULL)
|
||||
return NULL;
|
||||
|
||||
static NS_DEFINE_IID(kILiveConnectPluginInstancePeerIID,
|
||||
NP_ILIVECONNECTPLUGININSTANCEPEER_IID);
|
||||
|
||||
NPILiveConnectPluginInstancePeer* lcPeer = NULL;
|
||||
if (peer->QueryInterface(kILiveConnectPluginInstancePeerIID,
|
||||
(void**) &lcPeer) == NS_OK) {
|
||||
jobject result = lcPeer->GetJavaPeer();
|
||||
lcPeer->Release();
|
||||
return result;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(XP_MAC) && !defined(powerc)
|
||||
#pragma pointers_in_A0
|
||||
#endif
|
||||
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
233
mozilla/modules/plugin/nglsrc/ns4xPlugin.h
Normal file
233
mozilla/modules/plugin/nglsrc/ns4xPlugin.h
Normal file
@@ -0,0 +1,233 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef ns4xPlugin_h__
|
||||
#define ns4xPlugin_h__
|
||||
|
||||
#include "nsplugin.h"
|
||||
#include "prlink.h" // for PRLibrary
|
||||
#include "npupp.h"
|
||||
#include "nsIMalloc.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
* Use this macro before each exported function
|
||||
* (between the return address and the function
|
||||
* itself), to ensure that the function has the
|
||||
* right calling conventions on Win16.
|
||||
*/
|
||||
|
||||
#ifdef XP_WIN16
|
||||
#define NP_EXPORT __export
|
||||
#elif defined(XP_OS2)
|
||||
#define NP_EXPORT _System
|
||||
#else
|
||||
#define NP_EXPORT
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// XXX These are defined in platform specific FE directories right now :-/
|
||||
|
||||
//BTW: this sucks rocks.
|
||||
#ifdef XP_WIN
|
||||
#define PLUGIN_ENTRYPOINT_CALL_TYPE __stdcall
|
||||
#else
|
||||
#define PLUGIN_ENTRYPOINT_CALL_TYPE
|
||||
#endif
|
||||
|
||||
typedef NPError (PLUGIN_ENTRYPOINT_CALL_TYPE *NP_GETENTRYPOINTS)(NPPluginFuncs* pCallbacks);
|
||||
typedef NPError (PLUGIN_ENTRYPOINT_CALL_TYPE *NP_PLUGININIT)(const NPNetscapeFuncs* pCallbacks);
|
||||
typedef NPError (PLUGIN_ENTRYPOINT_CALL_TYPE *NP_PLUGINSHUTDOWN)();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A 5.0 wrapper for a 4.x style plugin.
|
||||
*/
|
||||
class ns4xPlugin : public nsILiveConnectPlugin
|
||||
{
|
||||
public:
|
||||
ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown);
|
||||
~ns4xPlugin(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIFactory interface
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
//nsIPlugin interface
|
||||
|
||||
NS_IMETHOD
|
||||
Initialize(nsISupports* browserInterfaces);
|
||||
|
||||
NS_IMETHOD
|
||||
Shutdown(void);
|
||||
|
||||
NS_IMETHOD
|
||||
GetMIMEDescription(const char* *resultingDesc);
|
||||
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginVariable variable, void *value);
|
||||
|
||||
//nsILiveConnectPlugin interface
|
||||
|
||||
NS_IMETHOD
|
||||
GetJavaClass(jclass *resultingClass);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// ns4xPlugin-specific methods
|
||||
|
||||
/**
|
||||
* A static factory method for constructing 4.x plugins. Constructs
|
||||
* and initializes an ns4xPlugin object, and returns it in
|
||||
* <b>result</b>.
|
||||
*/
|
||||
static nsresult
|
||||
CreatePlugin(PRLibrary *library,
|
||||
nsIPlugin **result);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Ensures that the static CALLBACKS is properly initialized
|
||||
*/
|
||||
static void CheckClassInitialized(void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Static stub functions that are exported to the 4.x plugin as entry
|
||||
// points via the CALLBACKS variable.
|
||||
//
|
||||
static nsresult NP_EXPORT
|
||||
_requestread(NPStream *pstream, NPByteRange *rangeList);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_geturlnotify(NPP npp, const char* relativeURL, const char* target, void* notifyData);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_getvalue(NPP npp, NPNVariable variable, void *r_value);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_setvalue(NPP npp, NPPVariable variable, void *r_value);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_geturl(NPP npp, const char* relativeURL, const char* target);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_posturlnotify(NPP npp, const char* relativeURL, const char *target,
|
||||
uint32 len, const char *buf, NPBool file, void* notifyData);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_posturl(NPP npp, const char* relativeURL, const char *target, uint32 len,
|
||||
const char *buf, NPBool file);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_newstream(NPP npp, NPMIMEType type, const char* window, NPStream** pstream);
|
||||
|
||||
static int32 NP_EXPORT
|
||||
_write(NPP npp, NPStream *pstream, int32 len, void *buffer);
|
||||
|
||||
static nsresult NP_EXPORT
|
||||
_destroystream(NPP npp, NPStream *pstream, NPError reason);
|
||||
|
||||
static void NP_EXPORT
|
||||
_status(NPP npp, const char *message);
|
||||
|
||||
#if 0
|
||||
|
||||
static void NP_EXPORT
|
||||
_registerwindow(NPP npp, void* window);
|
||||
|
||||
static void NP_EXPORT
|
||||
_unregisterwindow(NPP npp, void* window);
|
||||
|
||||
static int16 NP_EXPORT
|
||||
_allocateMenuID(NPP npp, NPBool isSubmenu);
|
||||
|
||||
#endif
|
||||
|
||||
static void NP_EXPORT
|
||||
_memfree (void *ptr);
|
||||
|
||||
static uint32 NP_EXPORT
|
||||
_memflush(uint32 size);
|
||||
|
||||
static void NP_EXPORT
|
||||
_reloadplugins(NPBool reloadPages);
|
||||
|
||||
static void NP_EXPORT
|
||||
_invalidaterect(NPP npp, NPRect *invalidRect);
|
||||
|
||||
static void NP_EXPORT
|
||||
_invalidateregion(NPP npp, NPRegion invalidRegion);
|
||||
|
||||
static void NP_EXPORT
|
||||
_forceredraw(NPP npp);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Anything that returns a pointer needs to be _HERE_ for 68K Mac to
|
||||
// work.
|
||||
//
|
||||
|
||||
#if defined(XP_MAC) && !defined(powerc)
|
||||
#pragma pointers_in_D0
|
||||
#endif
|
||||
|
||||
static const char* NP_EXPORT
|
||||
_useragent(NPP npp);
|
||||
|
||||
static void* NP_EXPORT
|
||||
_memalloc (uint32 size);
|
||||
|
||||
static JRIEnv* NP_EXPORT
|
||||
_getJavaEnv(void);
|
||||
|
||||
#if 0
|
||||
|
||||
static jref NP_EXPORT
|
||||
_getJavaPeer(NPP npp);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(XP_MAC) && !defined(powerc)
|
||||
#pragma pointers_in_A0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The plugin-side callbacks that the browser calls. One set of
|
||||
* plugin callbacks for each plugin.
|
||||
*/
|
||||
NPPluginFuncs fCallbacks;
|
||||
|
||||
NP_PLUGINSHUTDOWN fShutdownEntry;
|
||||
|
||||
/**
|
||||
* The browser-side callbacks that a 4.x-style plugin calls.
|
||||
*/
|
||||
static NPNetscapeFuncs CALLBACKS;
|
||||
|
||||
static nsIPluginManager *mPluginManager;
|
||||
static nsIMalloc *mMalloc;
|
||||
};
|
||||
|
||||
#endif // ns4xPlugin_h__
|
||||
296
mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp
Normal file
296
mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "ns4xPluginInstance.h"
|
||||
#include "ns4xPluginStream.h"
|
||||
#include "prlog.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ns4xPluginInstance :: ns4xPluginInstance(NPPluginFuncs* callbacks)
|
||||
: fCallbacks(callbacks)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
NS_ASSERTION(fCallbacks != NULL, "null callbacks");
|
||||
|
||||
// Initialize the NPP structure.
|
||||
|
||||
fNPP.pdata = NULL;
|
||||
fNPP.ndata = this;
|
||||
|
||||
fPeer = nsnull;
|
||||
|
||||
mWindowless = PR_FALSE;
|
||||
mTransparent = PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
ns4xPluginInstance :: ~ns4xPluginInstance(void)
|
||||
{
|
||||
NS_RELEASE(fPeer);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ADDREF(ns4xPluginInstance);
|
||||
NS_IMPL_RELEASE(ns4xPluginInstance);
|
||||
|
||||
static NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID);
|
||||
static NS_DEFINE_IID(kIEventHandlerIID, NS_IEVENTHANDLER_IID);
|
||||
static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(kIPluginInstanceIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginInstance *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIEventHandlerIID))
|
||||
{
|
||||
*instance = (void *)(nsIEventHandler *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: Initialize(nsIPluginInstancePeer* peer)
|
||||
{
|
||||
PRUint16 count;
|
||||
const char* const* names;
|
||||
const char* const* values;
|
||||
|
||||
NS_ASSERTION(peer != NULL, "null peer");
|
||||
|
||||
fPeer = peer;
|
||||
|
||||
NS_ADDREF(fPeer);
|
||||
|
||||
nsresult error;
|
||||
nsIPluginTagInfo *taginfo;
|
||||
|
||||
error = fPeer->QueryInterface(kIPluginTagInfoIID, (void **)&taginfo);
|
||||
|
||||
if (NS_OK == error)
|
||||
{
|
||||
if ((error = taginfo->GetAttributes(count, names, values)) != NS_OK)
|
||||
return error;
|
||||
|
||||
if (fCallbacks->newp == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX right error?
|
||||
|
||||
// XXX Note that the NPPluginType_* enums were crafted to be
|
||||
// backward compatible...
|
||||
|
||||
nsPluginMode mode;
|
||||
nsMIMEType mimetype;
|
||||
|
||||
fPeer->GetMode(&mode);
|
||||
fPeer->GetMIMEType(&mimetype);
|
||||
|
||||
error = (nsresult)
|
||||
CallNPP_NewProc(fCallbacks->newp,
|
||||
(char *)mimetype,
|
||||
&fNPP,
|
||||
(PRUint16)mode,
|
||||
count,
|
||||
(char**)names,
|
||||
(char**)values,
|
||||
NULL); // saved data
|
||||
|
||||
NS_RELEASE(taginfo);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: GetPeer(nsIPluginInstancePeer* *resultingPeer)
|
||||
{
|
||||
NS_ADDREF(fPeer);
|
||||
*resultingPeer = fPeer;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::Start(void)
|
||||
{
|
||||
// XXX At some point, we maybe should implement start and stop to
|
||||
// load/unload the 4.x plugin, just in case there are some plugins
|
||||
// that rely on that behavior...
|
||||
printf("instance start called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::Stop(void)
|
||||
{
|
||||
printf("instance stop called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::Destroy(void)
|
||||
{
|
||||
nsresult error;
|
||||
|
||||
printf("instance destroy called\n");
|
||||
if (fCallbacks->destroy == NULL)
|
||||
return NS_ERROR_FAILURE; // XXX right error?
|
||||
|
||||
NPSavedData *sdata;
|
||||
|
||||
error = (nsresult)CallNPP_DestroyProc(fCallbacks->destroy,
|
||||
&fNPP, &sdata); // saved data
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
{
|
||||
// XXX 4.x plugins don't want a SetWindow(NULL).
|
||||
|
||||
if (window == NULL)
|
||||
return NS_OK;
|
||||
|
||||
nsresult error = NS_OK;
|
||||
|
||||
if (fCallbacks->setwindow)
|
||||
{
|
||||
// XXX Turns out that NPPluginWindow and NPWindow are structurally
|
||||
// identical (on purpose!), so there's no need to make a copy.
|
||||
|
||||
error = (nsresult) CallNPP_SetWindowProc(fCallbacks->setwindow,
|
||||
&fNPP,
|
||||
(NPWindow*) window);
|
||||
|
||||
// XXX In the old code, we'd just ignore any errors coming
|
||||
// back from the plugin's SetWindow(). Is this the correct
|
||||
// behavior?!?
|
||||
|
||||
if (error != NS_OK)
|
||||
printf("error in setwindow %d\n", error);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::NewStream(nsIPluginStreamPeer* peer, nsIPluginStream* *result)
|
||||
{
|
||||
(*result) = NULL;
|
||||
|
||||
ns4xPluginStream* stream = new ns4xPluginStream();
|
||||
|
||||
if (stream == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(stream);
|
||||
|
||||
nsresult error;
|
||||
|
||||
// does it need the peer?
|
||||
|
||||
if ((error = stream->Initialize(this, peer)) != NS_OK)
|
||||
{
|
||||
NS_RELEASE(stream);
|
||||
return error;
|
||||
}
|
||||
|
||||
(*result) = stream;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::Print(nsPluginPrint* platformPrint)
|
||||
{
|
||||
printf("instance print called\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* handled)
|
||||
{
|
||||
printf("instance handleevent called\n");
|
||||
*handled = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance::URLNotify(const char* url, const char* target,
|
||||
nsPluginReason reason, void* notifyData)
|
||||
{
|
||||
if (fCallbacks->urlnotify != NULL)
|
||||
{
|
||||
CallNPP_URLNotifyProc(fCallbacks->urlnotify,
|
||||
&fNPP,
|
||||
url,
|
||||
reason,
|
||||
notifyData);
|
||||
}
|
||||
|
||||
return NS_OK; //XXX this seems bad...
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: GetValue(nsPluginInstanceVariable variable, void *value)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
switch (variable)
|
||||
{
|
||||
case nsPluginInstanceVariable_WindowlessBool:
|
||||
*(PRBool *)value = mWindowless;
|
||||
break;
|
||||
|
||||
case nsPluginInstanceVariable_TransparentBool:
|
||||
*(PRBool *)value = mTransparent;
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = NS_ERROR_FAILURE; //XXX this is bad
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: SetWindowless(PRBool aWindowless)
|
||||
{
|
||||
mWindowless = aWindowless;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginInstance :: SetTransparent(PRBool aTransparent)
|
||||
{
|
||||
mTransparent = aTransparent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
145
mozilla/modules/plugin/nglsrc/ns4xPluginInstance.h
Normal file
145
mozilla/modules/plugin/nglsrc/ns4xPluginInstance.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef ns4xPluginInstance_h__
|
||||
#define ns4xPluginInstance_h__
|
||||
|
||||
#define _UINT32
|
||||
#define _INT32
|
||||
|
||||
#include "nsplugin.h"
|
||||
#include "npupp.h"
|
||||
#include "jri.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ns4xPluginInstance : public nsIPluginInstance
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct a new 4.x plugin instance with the specified peer
|
||||
* and callbacks.
|
||||
*/
|
||||
ns4xPluginInstance(NPPluginFuncs* callbacks);
|
||||
|
||||
// Use Release() to destroy this
|
||||
~ns4xPluginInstance(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIPluginInstance methods
|
||||
|
||||
/**
|
||||
* Actually initialize the plugin instance. This calls the 4.x <b>newp</b>
|
||||
* callback, and may return an error (which is why it is distinct from the
|
||||
* constructor.) If an error is returned, the caller should <i>not</i>
|
||||
* continue to use the <b>ns4xPluginInstance</b> object.
|
||||
*/
|
||||
NS_METHOD
|
||||
Initialize(nsIPluginInstancePeer* peer);
|
||||
|
||||
NS_IMETHOD
|
||||
GetPeer(nsIPluginInstancePeer* *resultingPeer);
|
||||
|
||||
NS_IMETHOD
|
||||
Start(void);
|
||||
|
||||
NS_IMETHOD
|
||||
Stop(void);
|
||||
|
||||
NS_IMETHOD
|
||||
Destroy(void);
|
||||
|
||||
NS_IMETHOD
|
||||
SetWindow(nsPluginWindow* window);
|
||||
|
||||
NS_IMETHOD
|
||||
NewStream(nsIPluginStreamPeer* peer, nsIPluginStream* *result);
|
||||
|
||||
NS_IMETHOD
|
||||
Print(nsPluginPrint* platformPrint);
|
||||
|
||||
NS_IMETHOD
|
||||
HandleEvent(nsPluginEvent* event, PRBool* handled);
|
||||
|
||||
NS_IMETHOD
|
||||
URLNotify(const char* url, const char* target,
|
||||
nsPluginReason reason, void* notifyData);
|
||||
|
||||
NS_IMETHOD
|
||||
GetValue(nsPluginInstanceVariable variable, void *value);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// ns4xPluginInstance-specific methods
|
||||
|
||||
|
||||
/**
|
||||
* Return the 4.x-style interface object.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetNPP(NPP * aNPP) {
|
||||
*aNPP = &fNPP;
|
||||
return NS_OK;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the callbacks for the plugin instance.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetCallbacks(const NPPluginFuncs ** aCallbacks) {
|
||||
*aCallbacks = fCallbacks;
|
||||
return NS_OK;
|
||||
};
|
||||
|
||||
NS_IMETHOD
|
||||
SetWindowless(PRBool aWindowless);
|
||||
|
||||
NS_IMETHOD
|
||||
SetTransparent(PRBool aTransparent);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* The plugin instance peer for this instance.
|
||||
*/
|
||||
nsIPluginInstancePeer* fPeer;
|
||||
|
||||
/**
|
||||
* A pointer to the plugin's callback functions. This information
|
||||
* is actually stored in the plugin class (<b>nsPluginClass</b>),
|
||||
* and is common for all plugins of the class.
|
||||
*/
|
||||
NPPluginFuncs* fCallbacks;
|
||||
|
||||
/**
|
||||
* The 4.x-style structure used to communicate between the plugin
|
||||
* instance and the browser.
|
||||
*/
|
||||
NPP_t fNPP;
|
||||
|
||||
//these are used to store the windowless properties
|
||||
//which the browser will later query
|
||||
|
||||
PRBool mWindowless;
|
||||
PRBool mTransparent;
|
||||
};
|
||||
|
||||
|
||||
#endif // ns4xPluginInstance_h__
|
||||
262
mozilla/modules/plugin/nglsrc/ns4xPluginStream.cpp
Normal file
262
mozilla/modules/plugin/nglsrc/ns4xPluginStream.cpp
Normal file
@@ -0,0 +1,262 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "ns4xPluginStream.h"
|
||||
#include "prlog.h" // for PR_ASSERT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ns4xPluginStream::ns4xPluginStream(void)
|
||||
: fStreamType(nsPluginStreamType_Normal), fSeekable(PR_FALSE), fPosition(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
fPeer = nsnull;
|
||||
fInstance = nsnull;
|
||||
|
||||
// Initialize the 4.x interface structure
|
||||
memset(&fNPStream, 0, sizeof(fNPStream));
|
||||
}
|
||||
|
||||
|
||||
ns4xPluginStream::~ns4xPluginStream(void)
|
||||
{
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
nsPluginReason reason;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
fPeer->GetReason(&reason);
|
||||
|
||||
if (callbacks->destroystream != NULL)
|
||||
{
|
||||
CallNPP_DestroyStreamProc(callbacks->destroystream,
|
||||
npp,
|
||||
&fNPStream,
|
||||
reason);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(fPeer);
|
||||
NS_IF_RELEASE(fInstance);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ADDREF(ns4xPluginStream);
|
||||
NS_IMPL_RELEASE(ns4xPluginStream);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIPluginStreamIID, NS_IPLUGINSTREAM_IID);
|
||||
static NS_DEFINE_IID(kISeekablePluginStreamPeerIID, NS_ISEEKABLEPLUGINSTREAMPEER_IID);
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(kIPluginStreamIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginStream *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::Initialize(ns4xPluginInstance* instance,
|
||||
nsIPluginStreamPeer* peer)
|
||||
{
|
||||
fInstance = instance;
|
||||
fPeer = peer;
|
||||
|
||||
NS_ASSERTION(fInstance != NULL, "null instance");
|
||||
|
||||
NS_ADDREF(fInstance);
|
||||
|
||||
NS_ASSERTION(fPeer != NULL, "null peer");
|
||||
|
||||
NS_ADDREF(fPeer);
|
||||
|
||||
const char *url;
|
||||
PRUint32 length, modified;
|
||||
|
||||
fPeer->GetURL(&url);
|
||||
fPeer->GetEnd(&length);
|
||||
fPeer->GetLastModified(&modified);
|
||||
|
||||
fNPStream.ndata = (void*) fPeer;
|
||||
fNPStream.url = url;
|
||||
fNPStream.end = length;
|
||||
fNPStream.lastmodified = modified;
|
||||
|
||||
// Are we seekable?
|
||||
|
||||
nsISupports* seekablePeer;
|
||||
|
||||
if (fPeer->QueryInterface(kISeekablePluginStreamPeerIID,
|
||||
(void**) &seekablePeer) == NS_OK)
|
||||
{
|
||||
fSeekable = TRUE;
|
||||
NS_RELEASE(seekablePeer);
|
||||
}
|
||||
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
nsMIMEType mimetype;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
fPeer->GetMIMEType(&mimetype);
|
||||
|
||||
if (callbacks->newstream == NULL)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint16 streamType = (PRUint16) fStreamType;
|
||||
|
||||
nsresult error
|
||||
= (nsresult)CallNPP_NewStreamProc(callbacks->newstream,
|
||||
npp,
|
||||
(char *)mimetype,
|
||||
&fNPStream,
|
||||
fSeekable,
|
||||
&streamType);
|
||||
|
||||
fStreamType = (nsPluginStreamType) streamType;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::Write(const char* buffer, PRInt32 offset, PRInt32 len, PRInt32 *aWriteCount)
|
||||
{
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
PRInt32 remaining = len;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
|
||||
if (callbacks->write == NULL)
|
||||
return NS_OK;
|
||||
|
||||
while (remaining > 0)
|
||||
{
|
||||
PRInt32 numtowrite;
|
||||
|
||||
if (callbacks->writeready != NULL)
|
||||
{
|
||||
numtowrite = CallNPP_WriteReadyProc(callbacks->writeready,
|
||||
npp,
|
||||
&fNPStream);
|
||||
|
||||
if (numtowrite > remaining)
|
||||
numtowrite = remaining;
|
||||
}
|
||||
else
|
||||
numtowrite = len;
|
||||
|
||||
*aWriteCount = CallNPP_WriteProc(callbacks->write,
|
||||
npp,
|
||||
&fNPStream,
|
||||
fPosition,
|
||||
numtowrite,
|
||||
(void *)buffer);
|
||||
|
||||
remaining -= numtowrite;
|
||||
}
|
||||
|
||||
fPosition += len;
|
||||
|
||||
return NS_OK; //XXX this seems bad...
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::GetStreamType(nsPluginStreamType *result)
|
||||
{
|
||||
*result = fStreamType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream::AsFile(const char* filename)
|
||||
{
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
|
||||
if (callbacks->asfile == NULL)
|
||||
return NS_OK;
|
||||
|
||||
CallNPP_StreamAsFileProc(callbacks->asfile,
|
||||
npp,
|
||||
&fNPStream,
|
||||
filename);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ns4xPluginStream :: Close(void)
|
||||
{
|
||||
const NPPluginFuncs *callbacks;
|
||||
NPP npp;
|
||||
void *notifydata;
|
||||
|
||||
fInstance->GetCallbacks(&callbacks);
|
||||
fInstance->GetNPP(&npp);
|
||||
|
||||
fPeer->GetNotifyData(¬ifydata);
|
||||
|
||||
nsPluginReason reason;
|
||||
|
||||
fPeer->GetReason(&reason);
|
||||
|
||||
if (nsnull != notifydata)
|
||||
{
|
||||
if (callbacks->urlnotify == NULL)
|
||||
return NS_OK;
|
||||
|
||||
const char *url;
|
||||
|
||||
fPeer->GetURL(&url);
|
||||
|
||||
CallNPP_URLNotifyProc(callbacks->urlnotify,
|
||||
npp,
|
||||
url,
|
||||
(NPReason)reason,
|
||||
notifydata);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
115
mozilla/modules/plugin/nglsrc/ns4xPluginStream.h
Normal file
115
mozilla/modules/plugin/nglsrc/ns4xPluginStream.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef ns4xPluginStream_h__
|
||||
#define ns4xPluginStream_h__
|
||||
|
||||
#define _UINT32
|
||||
#define _INT32
|
||||
|
||||
#include "jri.h" // XXX should be jni.h
|
||||
#include "nsplugin.h"
|
||||
#include "ns4xPluginInstance.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A 5.0 wrapper for a 4.x plugin stream.
|
||||
*/
|
||||
class ns4xPluginStream : public nsIPluginStream
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct a new 4.x plugin stream associated with the specified
|
||||
* instance and stream peer.
|
||||
*/
|
||||
ns4xPluginStream();
|
||||
~ns4xPluginStream();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/**
|
||||
* Do internal initialization. This actually calls into the 4.x plugin
|
||||
* to create the stream, and may fail (which is why it's separate from
|
||||
* the constructor).
|
||||
*/
|
||||
NS_METHOD
|
||||
Initialize(ns4xPluginInstance* instance, nsIPluginStreamPeer* peer);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIPluginStream methods
|
||||
|
||||
// (Corresponds to NPP_Write and NPN_Write.)
|
||||
NS_IMETHOD
|
||||
Write(const char* buffer, PRInt32 offset, PRInt32 len, PRInt32 *aWriteCount);
|
||||
|
||||
// (Corresponds to NPP_NewStream's stype return parameter.)
|
||||
NS_IMETHOD
|
||||
GetStreamType(nsPluginStreamType *result);
|
||||
|
||||
// (Corresponds to NPP_StreamAsFile.)
|
||||
NS_IMETHOD
|
||||
AsFile(const char* fname);
|
||||
|
||||
NS_IMETHOD
|
||||
Close(void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Methods specific to ns4xPluginStream
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* The plugin instance to which this stream belongs.
|
||||
*/
|
||||
ns4xPluginInstance* fInstance;
|
||||
|
||||
/**
|
||||
* The peer associated with this stream.
|
||||
*/
|
||||
nsIPluginStreamPeer* fPeer;
|
||||
|
||||
/**
|
||||
* The type of stream, for the peer's use.
|
||||
*/
|
||||
nsPluginStreamType fStreamType;
|
||||
|
||||
/**
|
||||
* The 4.x-style structure used to contain stream information.
|
||||
* This is what actually gets used to communicate with the plugin.
|
||||
*/
|
||||
NPStream fNPStream;
|
||||
|
||||
/**
|
||||
* Set to <b>TRUE</b> if the peer implements
|
||||
* <b>NPISeekablPluginStreamPeer</b>.
|
||||
*/
|
||||
PRBool fSeekable;
|
||||
|
||||
/**
|
||||
* Tracks the position in the content that is being
|
||||
* read. 4.x-style plugins expect to be told the offset in the
|
||||
* buffer that they should read <i>to</i>, even though it's always
|
||||
* done serially.
|
||||
*/
|
||||
PRUint32 fPosition;
|
||||
};
|
||||
|
||||
|
||||
#endif // ns4xPluginStream_h__
|
||||
67
mozilla/modules/plugin/nglsrc/nsIPluginHost.h
Normal file
67
mozilla/modules/plugin/nglsrc/nsIPluginHost.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIPluginHost_h___
|
||||
#define nsIPluginHost_h___
|
||||
|
||||
#include "xp_core.h"
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
class nsIURL;
|
||||
|
||||
#define NS_IPLUGINHOST_IID \
|
||||
{ 0x264c0640, 0x1c31, 0x11d2, \
|
||||
{ 0xa8, 0x2e, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
||||
|
||||
struct nsIPluginHost : public nsIFactory
|
||||
{
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
Init(void) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
Destroy(void) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
LoadPlugins(void) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsIURL *aURL, nsIPluginInstanceOwner *aOwner) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsString& aURLSpec, nsIPluginInstanceOwner *aOwner) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
InstantiatePlugin(const char *aMimeType, nsString& aURLSpec, nsIStreamListener *&aStreamListener, nsIPluginInstanceOwner *aOwner) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(const nsString& aURL, nsIPluginInstance *aInstance, void *aNotifyData) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(const nsString& aURL, nsIPluginInstanceOwner *aOwner, void *aNotifyData) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
NewPluginStream(nsIStreamListener *&aStreamListener, nsIPluginInstance *aInstance, void *aNotifyData) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
101
mozilla/modules/plugin/nglsrc/nsIPluginInstanceOwner.h
Normal file
101
mozilla/modules/plugin/nglsrc/nsIPluginInstanceOwner.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIPluginInstanceOwner_h___
|
||||
#define nsIPluginInstanceOwner_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsplugin.h"
|
||||
|
||||
#define NS_IPLUGININSTANCEOWNER_IID \
|
||||
{ 0x18270870, 0x32f1, 0x11d2, \
|
||||
{ 0xa8, 0x30, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
||||
|
||||
struct nsIPluginInstanceOwner : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Let the owner know that an instance has been created
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
SetInstance(nsIPluginInstance *aInstance) = 0;
|
||||
|
||||
/**
|
||||
* Get the instance associated with this owner.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetInstance(nsIPluginInstance *&aInstance) = 0;
|
||||
|
||||
/**
|
||||
* Get a handle to the window structure of the owner.
|
||||
* This pointer cannot be made persistant by the caller.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetWindow(nsPluginWindow *&aWindow) = 0;
|
||||
|
||||
/**
|
||||
* Get the display mode for the plugin instance.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetMode(nsPluginMode *aMode) = 0;
|
||||
|
||||
/**
|
||||
* Get a ptr to the paired list of attribute names and values,
|
||||
* returns the length of the array.
|
||||
*
|
||||
* Each name or value is a null-terminated string.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values) = 0;
|
||||
|
||||
/**
|
||||
* Gets the value for the named attribute.
|
||||
*
|
||||
* @param name - the name of the attribute to find
|
||||
* @param result - the resulting attribute
|
||||
* @result - NS_OK if this operation was successful, NS_ERROR_FAILURE if
|
||||
* this operation failed. result is set to NULL if the attribute is not found
|
||||
* else to the found value.
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetAttribute(const char* name, const char* *result) = 0;
|
||||
|
||||
/**
|
||||
* Create a place for the plugin to live in the owner's
|
||||
* environment. this may or may not create a window
|
||||
* depending on the windowless state of the plugin instance.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
CreateWidget(void) = 0;
|
||||
|
||||
/**
|
||||
* Called when there is a valid target so that the proper
|
||||
* frame can be updated with new content. will not be called
|
||||
* with nsnull aTarget.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetURL(const char *aURL, const char *aTarget, void *aPostData) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
120
mozilla/modules/plugin/nglsrc/nsMalloc.cpp
Normal file
120
mozilla/modules/plugin/nglsrc/nsMalloc.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of nsIMalloc using NSPR
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsMalloc.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIMallocIID, NS_IMALLOC_IID);
|
||||
|
||||
nsMalloc::nsMalloc(nsISupports* outer)
|
||||
{
|
||||
NS_INIT_AGGREGATED(outer);
|
||||
}
|
||||
|
||||
nsMalloc::~nsMalloc(void)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_AGGREGATED(nsMalloc);
|
||||
|
||||
NS_METHOD
|
||||
nsMalloc::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIMallocIID) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsMalloc::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
if (outer && !aIID.Equals(kISupportsIID))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
nsMalloc* mm = new nsMalloc(outer);
|
||||
if (mm == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mm->AddRef();
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
*aInstancePtr = mm->GetInner();
|
||||
else
|
||||
*aInstancePtr = mm;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_METHOD_(void*)
|
||||
nsMalloc::Alloc(PRUint32 size)
|
||||
{
|
||||
return PR_Malloc(size);
|
||||
}
|
||||
|
||||
NS_METHOD_(void*)
|
||||
nsMalloc::Realloc(void* ptr, PRUint32 size)
|
||||
{
|
||||
return PR_Realloc(ptr, size);
|
||||
}
|
||||
|
||||
NS_METHOD_(void)
|
||||
nsMalloc::Free(void* ptr)
|
||||
{
|
||||
PR_Free(ptr);
|
||||
}
|
||||
|
||||
NS_METHOD_(PRInt32)
|
||||
nsMalloc::GetSize(void* ptr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
NS_METHOD_(PRBool)
|
||||
nsMalloc::DidAlloc(void* ptr)
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// For the definition of CallCacheFlushers()
|
||||
#ifdef XP_MAC
|
||||
# ifndef NSPR20
|
||||
# include "prmacos.h"
|
||||
# else
|
||||
# include "MacMemAllocator.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
NS_METHOD_(void)
|
||||
nsMalloc::HeapMinimize(void)
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
// something wonderful
|
||||
CallCacheFlushers(0x7fffffff);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
101
mozilla/modules/plugin/nglsrc/nsMalloc.h
Normal file
101
mozilla/modules/plugin/nglsrc/nsMalloc.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of nsIMalloc using NSPR
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef nsMalloc_h__
|
||||
#define nsMalloc_h__
|
||||
|
||||
#include "nsIMalloc.h"
|
||||
#include "prmem.h"
|
||||
#include "nsAgg.h"
|
||||
|
||||
class nsMalloc : nsIMalloc {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Allocates a block of memory of a particular size.
|
||||
*
|
||||
* @param size - the size of the block to allocate
|
||||
* @result the block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*)
|
||||
Alloc(PRUint32 size);
|
||||
|
||||
/**
|
||||
* Reallocates a block of memory to a new size.
|
||||
*
|
||||
* @param ptr - the block of memory to reallocate
|
||||
* @param size - the new size
|
||||
* @result the rellocated block of memory
|
||||
*/
|
||||
NS_IMETHOD_(void*)
|
||||
Realloc(void* ptr, PRUint32 size);
|
||||
|
||||
/**
|
||||
* Frees a block of memory.
|
||||
*
|
||||
* @param ptr - the block of memory to free
|
||||
*/
|
||||
NS_IMETHOD_(void)
|
||||
Free(void* ptr);
|
||||
|
||||
/**
|
||||
* Returns the size of a block of memory. Returns -1
|
||||
* if the size is not available.
|
||||
*
|
||||
* @param ptr - the block of memory
|
||||
* @result the size or -1 if not available
|
||||
*/
|
||||
NS_IMETHOD_(PRInt32)
|
||||
GetSize(void* ptr);
|
||||
|
||||
/**
|
||||
* Returns whether the block of memory was allocated by this
|
||||
* memory allocator. Returns PR_FALSE if this information is
|
||||
* not available.
|
||||
*
|
||||
* @param ptr - the block of memory
|
||||
* @result true if allocated by this nsIMalloc, false if not or
|
||||
* if it can't be determined
|
||||
*/
|
||||
NS_IMETHOD_(PRBool)
|
||||
DidAlloc(void* ptr);
|
||||
|
||||
/**
|
||||
* Attempts to shrink the heap.
|
||||
*/
|
||||
NS_IMETHOD_(void)
|
||||
HeapMinimize(void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsMalloc(nsISupports* outer);
|
||||
virtual ~nsMalloc(void);
|
||||
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // nsMalloc_h__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user