Removing unused old plugin code. Not part of build. r=av, sr=cls.

This commit is contained in:
bryner%uiuc.edu 2000-12-27 00:22:36 +00:00
Родитель c9a063d452
Коммит a2bc722f32
25 изменённых файлов: 0 добавлений и 12412 удалений

Просмотреть файл

@ -327,7 +327,6 @@ MAKEFILES_plugin="
modules/plugin/Makefile
modules/plugin/nglsrc/Makefile
modules/plugin/public/Makefile
modules/plugin/src/Makefile
modules/plugin/test/Makefile
modules/plugin/SanePlugin/Makefile
modules/plugin/default/unix/Makefile

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1,29 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# This is a list of local files which get copied to the mozilla:dist directory
#
nppg.h
npglue.h
nppriv.h
nsMalloc.h

Просмотреть файл

@ -1,48 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = plugimpl
LIBRARY_NAME = plug
CSRCS = npassoc.c
CPPSRCS = nsplugin.cpp npglue.cpp nsMalloc.cpp
EXPORTS = nppg.h npglue.h nppriv.h nsMalloc.h
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
include $(topsrcdir)/config/rules.mk
ifeq ($(subst /,_,$(shell uname -s)),OS2)
CPPSRCS = npwplat.cpp
INCLUDES += -I$(DEPTH)/cmd/os2fe/nfc/include -I$(DEPTH)/cmd/os2fe -I$(DEPTH)/cmd/winfe
endif
INCLUDES += -I$(srcdir)

Просмотреть файл

@ -1,65 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH= ..\..\..
include <$(DEPTH)/config/config.mak>
MODULE = plugimpl
EXPORTS = \
nppg.h \
npglue.h \
nppriv.h \
nsMalloc.h
LIBRARY_NAME = plug
LINCS = -I$(DIST)\include \
-I$(DIST)\include\private \
-I$(PUBLIC)\plugin \
-I$(PUBLIC)\java \
-I$(PUBLIC)\pref \
-I$(PUBLIC)\js \
-I$(PUBLIC)\lay \
-I$(PUBLIC)\style \
-I$(PUBLIC)\xpcom \
-I$(PUBLIC)\raptor \
-I$(PUBLIC)\oji \
-I$(PUBLIC)\ojiimpl \
-I$(PUBLIC)\caps
OBJS = .\$(OBJDIR)\npassoc.obj \
.\$(OBJDIR)\nsplugin.obj \
.\$(OBJDIR)\npglue.obj \
.\$(OBJDIR)\nsMalloc.obj
!ifdef NEW_PLUGIN_STREAM_API
LCFLAGS = $(LCFLAGS) -DNEW_PLUGIN_STREAM_API
!endif
include <$(DEPTH)/config/rules.mak>
install:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib

Просмотреть файл

@ -1,243 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* npassoc.c $Revision: 1.2 $
* some xp mime-type file extension associations
*/
#include "npassoc.h"
#include "xp_mem.h"
#include "xp_mcom.h"
#include "net.h"
static NPFileTypeAssoc *np_fassoc_list=0; /* should use xp hash */
extern void NET_cdataAdd(NET_cdataStruct *cd);
#define NP_MAX_EXTS 64
static char *np_array[NP_MAX_EXTS];
/* allocate and fill a null-terminated array of extensions from
a comma and space delimited list */
static char **
np_parse_exts(const char *exts)
{
char *p, *e, **res;
int n=0;
if(!exts)
return 0;
/* p is the current position, e is the start of the nth extension */
for(e=p=(char *)exts; *p; p++)
{
if( (*p==' ') || (*p==',') )
{
if(*e == '.') e++;
if(p>e)
{
if(!(np_array[n] = (char *)XP_ALLOC(p-e+1)))
return 0;
XP_MEMCPY(np_array[n], e, (p-e));
*(np_array[n]+(p-e)) = 0;
n++;
e = p+1;
}
}
}
if(*e == '.') e++;
if(p>e)
{
if(!(np_array[n] = (char *)XP_ALLOC(p-e+1)))
return 0;
XP_MEMCPY(np_array[n], e, (p-e));
*(np_array[n]+(p-e)) = 0;
n++;
}
if(!(res = (char **)XP_ALLOC((n+1)*sizeof(char *))))
return 0;
XP_MEMCPY(res, np_array, n*sizeof(char *));
res[n] = 0;
return res;
}
/* construct a file association from a mime type.
* - extensions is a list of comma/space separated file extensions
* with or without leading .s
* - filetype is platform specific data for this list of extensions,
* currently creator on mac and open file dialog descriptions on win.
* filetype is callee owned data and must remain valid
*/
NPFileTypeAssoc *
NPL_NewFileAssociation(const char *MIMEType, const char *extensions, const char *description, void *fileType)
{
NPFileTypeAssoc *fassoc = 0;
/* make a file association struct */
if(!(fassoc=XP_NEW_ZAP(NPFileTypeAssoc)))
return 0;
StrAllocCopy((fassoc->type), MIMEType ? MIMEType : "");
StrAllocCopy((fassoc->description), description ? description : "");
StrAllocCopy((fassoc->extentstring), extensions ? extensions : "");
fassoc->fileType = fileType; /* caller owns this data */
fassoc->extentlist = np_parse_exts(extensions);
return fassoc;
}
/* deletes a file association. Returns the platform specific fileType
data that we dont know how to dispose of.
*/
void *
NPL_DeleteFileAssociation(NPFileTypeAssoc *fassoc)
{
void* fileType;
if (!fassoc)
return NULL;
fileType = fassoc->fileType;
NPL_RemoveFileAssociation(fassoc);
if (fassoc->type)
{
XP_FREE(fassoc->type);
fassoc->type = NULL;
}
if (fassoc->description)
{
XP_FREE(fassoc->description);
fassoc->description = NULL;
}
if (fassoc->extentstring)
{
XP_FREE(fassoc->extentstring);
fassoc->extentstring = NULL;
}
{
char** charPtrPtr;
for (charPtrPtr = &fassoc->extentlist[0]; *charPtrPtr; *charPtrPtr=0, charPtrPtr++)
XP_FREE(*charPtrPtr);
fassoc->extentlist = NULL;
}
XP_FREE(fassoc);
return fileType;
}
/* Register a file association with us and netlib.
*/
void
NPL_RegisterFileAssociation(NPFileTypeAssoc *fassoc)
{
if (fassoc)
{
fassoc->pNext = np_fassoc_list;
np_fassoc_list = fassoc;
NET_cdataCommit(fassoc->type, fassoc->extentstring);
/*
* We need to add the description, too, which unfortunately requires
* looking the cinfo up AGAIN and setting the desc field...
*/
if (fassoc->description)
{
NET_cdataStruct temp;
NET_cdataStruct* cdata;
XP_BZERO(&temp, sizeof(temp));
temp.ci.type = fassoc->type;
cdata = NET_cdataExist(&temp);
XP_ASSERT(cdata);
if (cdata)
StrAllocCopy(cdata->ci.desc, fassoc->description);
}
}
}
/* Unregister a file association.
*/
NPFileTypeAssoc *
NPL_RemoveFileAssociation(NPFileTypeAssoc *fassoc)
{
NPFileTypeAssoc *f = np_fassoc_list;
if(!fassoc)
return 0;
/* unregister with netlib */
if(fassoc == np_fassoc_list)
np_fassoc_list = np_fassoc_list->pNext;
else
{
for(; f; f=f->pNext)
if(f->pNext == fassoc)
{
NPFileTypeAssoc *ft;
ft = f->pNext;
f->pNext = f->pNext->pNext;
f = ft;
break;
}
}
return f;
}
/* returns a linked list of registered associations.
* if type is NULL you get the entire list else the association matching
* that MIME type
*/
NPFileTypeAssoc *
NPL_GetFileAssociation(const char *type)
{
NPFileTypeAssoc *f=NULL;
if(!np_fassoc_list)
return NULL;
if(type==NULL)
return np_fassoc_list;
for(f=np_fassoc_list; f; f=f->pNext)
if(!(XP_STRCMP(type, f->type)))
return f;
return NULL;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,908 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef npglue_h__
#define npglue_h__
#if defined(__cplusplus)
extern "C" {
#endif
#include "net.h"
#include "np.h"
#include "nppg.h"
#include "client.h"
#include "xpassert.h"
#include "ntypes.h"
#include "fe_proto.h"
#include "cvactive.h"
#include "gui.h" /* For XP_AppCodeName */
#include "merrors.h"
#include "xpgetstr.h"
#include "nsICapsManager.h"
#ifdef JAVA
#include "java.h"
#endif
#include "nppriv.h"
#include "shist.h"
#include "proto.h"
#include "libmocha.h"
#include "libevent.h"
#include "layout.h" /* XXX From ../layout */
#ifdef LAYERS
#include "layers.h"
#endif /* LAYERS */
#include "nsplugin.h"
#include "nsAgg.h" /* nsPluginManager aggregates nsJVMManager */
#ifdef OJI
#include "nsjvm.h"
#else /* OJI */
/* Just define a dummy struct for nsIJVMManager. In the
plugin code, it is never actually dereferenced outside of an
`#ifdef OJI'. */
struct nsIJVMManager;
class nsHashtable;
#endif /* OJI */
#include "plstr.h"
extern int XP_PLUGIN_LOADING_PLUGIN;
extern int MK_BAD_CONNECT;
extern int XP_PLUGIN_NOT_FOUND;
extern int XP_PLUGIN_CANT_LOAD_PLUGIN;
extern int XP_PROGRESS_STARTING_JAVA;
#define NP_LOCK 1
#define NP_UNLOCK 0
#define NPTRACE(n, msg) TRACEMSG(msg)
#define RANGE_EQUALS "bytes="
/* @@@@ steal the private call from netlib */
extern void NET_SetCallNetlibAllTheTime(MWContext *context, char *caller);
extern void NET_ClearCallNetlibAllTheTime(MWContext *context, char *caller);
#if defined(XP_WIN) || defined(XP_OS2)
/* Can't include FEEMBED.H because it's full of C++ */
extern NET_StreamClass *EmbedStream(int iFormatOut, void *pDataObj, URL_Struct *pUrlData, MWContext *pContext);
extern void EmbedUrlExit(URL_Struct *pUrl, int iStatus, MWContext *pContext);
#endif
extern void NET_RegisterAllEncodingConverters(char* format_in, FO_Present_Types format_out);
/* Internal prototypes */
void
NPL_EmbedURLExit(URL_Struct *urls, int status, MWContext *cx);
void
NPL_URLExit(URL_Struct *urls, int status, MWContext *cx);
void
np_streamAsFile(np_stream* stream);
NPError
np_switchHandlers(np_instance* instance,
np_handle* newHandle,
np_mimetype* newMimeType,
char* requestedType);
NET_StreamClass*
np_newstream(URL_Struct *urls, np_handle *handle, np_instance *instance);
void
np_findPluginType(NPMIMEType type, void* pdesc, np_handle** outHandle, np_mimetype** outMimetype);
void
np_enablePluginType(np_handle* handle, np_mimetype* mimetype, XP_Bool enabled);
void
np_bindContext(NPEmbeddedApp* app, MWContext* cx);
void
np_unbindContext(NPEmbeddedApp* app, MWContext* cx);
void
np_deleteapp(MWContext* cx, NPEmbeddedApp* app);
np_instance*
np_newinstance(np_handle *handle, MWContext *cx, NPEmbeddedApp *app,
np_mimetype *mimetype, char *requestedType);
void
np_delete_instance(np_instance *instance);
void
np_recover_mochaWindow(JRIEnv * env, np_instance * instance);
XP_Bool
np_FakeHTMLStream(URL_Struct* urls, MWContext* cx, char * fakehtml);
/* Navigator plug-in API function prototypes */
/*
* 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
NPError NP_EXPORT
npn_requestread(NPStream *pstream, NPByteRange *rangeList);
NPError NP_EXPORT
npn_geturlnotify(NPP npp, const char* relativeURL, const char* target, void* notifyData);
NPError NP_EXPORT
npn_getvalue(NPP npp, NPNVariable variable, void *r_value);
NPError NP_EXPORT
npn_setvalue(NPP npp, NPPVariable variable, void *r_value);
NPError NP_EXPORT
npn_geturl(NPP npp, const char* relativeURL, const char* target);
NPError NP_EXPORT
npn_posturlnotify(NPP npp, const char* relativeURL, const char *target,
uint32 len, const char *buf, NPBool file, void* notifyData);
NPError NP_EXPORT
npn_posturl(NPP npp, const char* relativeURL, const char *target, uint32 len,
const char *buf, NPBool file);
NPError
np_geturlinternal(NPP npp, const char* relativeURL, const char* target,
const char* altHost, const char* referer, PRBool forceJSEnabled,
NPBool notify, void* notifyData);
NPError
np_posturlinternal(NPP npp, const char* relativeURL, const char *target,
const char* altHost, const char* referer, PRBool forceJSEnabled,
uint32 len, const char *buf, NPBool file, NPBool notify, void* notifyData);
NPError NP_EXPORT
npn_newstream(NPP npp, NPMIMEType type, const char* window, NPStream** pstream);
int32 NP_EXPORT
npn_write(NPP npp, NPStream *pstream, int32 len, void *buffer);
NPError NP_EXPORT
npn_destroystream(NPP npp, NPStream *pstream, NPError reason);
void NP_EXPORT
npn_status(NPP npp, const char *message);
void NP_EXPORT
npn_registerwindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window);
void NP_EXPORT
npn_unregisterwindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window);
#if 0
int16 NP_EXPORT
npn_allocateMenuID(NPP npp, XP_Bool isSubmenu);
#endif
#if defined(XP_MAC) && !defined(powerc)
#pragma pointers_in_D0
#endif
const char* NP_EXPORT
npn_useragent(NPP npp);
#if defined(XP_MAC) && !defined(powerc)
#pragma pointers_in_A0
#endif
#if defined(XP_MAC) && !defined(powerc)
#pragma pointers_in_D0
#endif
void* NP_EXPORT
npn_memalloc (uint32 size);
#if defined(XP_MAC) && !defined(powerc)
#pragma pointers_in_A0
#endif
void NP_EXPORT
npn_memfree (void *ptr);
uint32 NP_EXPORT
npn_memflush(uint32 size);
void NP_EXPORT
npn_reloadplugins(NPBool reloadPages);
void NP_EXPORT
npn_invalidaterect(NPP npp, NPRect *invalidRect);
void NP_EXPORT
npn_invalidateregion(NPP npp, NPRegion invalidRegion);
void NP_EXPORT
npn_forceredraw(NPP npp);
#if defined(XP_MAC) && !defined(powerc)
#pragma pointers_in_D0
#endif
#if defined(OJI)
JNIEnv* NP_EXPORT
npn_getJavaEnv(void);
#else
JRIEnv* NP_EXPORT
npn_getJavaEnv(void);
#endif
#if defined(XP_MAC) && !defined(powerc)
#pragma pointers_in_A0
#endif
#if defined(XP_MAC) && !defined(powerc)
#pragma pointers_in_D0
#endif
jref NP_EXPORT
npn_getJavaPeer(NPP npp);
#if defined(XP_MAC) && !defined(powerc)
#pragma pointers_in_A0
#endif
extern NPError
npn_SetWindowSize(np_instance* instance, NPSize* pnpsz);
/* End of function prototypes */
/* this is a hack for now */
#define NP_MAXBUF (0xE000)
////////////////////////////////////////////////////////////////////////////////
class nsPluginManager : public nsIPluginManager2
{
public:
////////////////////////////////////////////////////////////////////////////
// from nsIPluginManager:
NS_IMETHOD
GetValue(nsPluginManagerVariable variable, void *value);
// (Corresponds to NPN_ReloadPlugins.)
NS_IMETHOD
ReloadPlugins(PRBool reloadPages);
// (Corresponds to NPN_UserAgent.)
NS_IMETHOD
UserAgent(const char* *result);
#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);
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);
#else // !NEW_PLUGIN_STREAM_API
NS_IMETHOD
GetURL(nsISupports* peer, 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* peer, 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);
#endif // !NEW_PLUGIN_STREAM_API
////////////////////////////////////////////////////////////////////////////
// from nsIPluginManager2:
NS_IMETHOD
BeginWaitCursor(void);
NS_IMETHOD
EndWaitCursor(void);
NS_IMETHOD
SupportsURLProtocol(const char* protocol, PRBool *result);
// 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.
NS_IMETHOD
NotifyStatusChange(nsIPlugin* plugin, nsresult errorStatus);
NS_IMETHOD
FindProxyForURL(const char* url, char* *result);
////////////////////////////////////////////////////////////////////////////
// New top-level window handling calls for Mac:
NS_IMETHOD
RegisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window);
NS_IMETHOD
UnregisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window);
// Menu ID allocation calls for Mac:
NS_IMETHOD
AllocateMenuID(nsIEventHandler* handler, PRBool isSubmenu, PRInt16 *result);
NS_IMETHOD
DeallocateMenuID(nsIEventHandler* handler, PRInt16 menuID);
/**
* Indicates whether this event handler has allocated the given menu ID.
*/
NS_IMETHOD
HasAllocatedMenuID(nsIEventHandler* handler, PRInt16 menuID, PRBool *result);
#if 0
// On the mac (and most likely 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 tickle itself.
// In this case, we make sure that we give up the monitor so that
// the tickle code can notify it without freezing.
NS_IMETHOD
ProcessNextEvent(PRBool *bEventHandled);
#endif
////////////////////////////////////////////////////////////////////////////
// nsPluginManager specific methods:
NS_DECL_AGGREGATED
static NS_METHOD
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
protected:
nsPluginManager(nsISupports* outer);
virtual ~nsPluginManager(void);
// aggregated interfaces:
nsIJVMManager* GetJVMMgr(const nsIID& aIID);
nsICapsManager* GetCapsManager(const nsIID& aIID);
#ifdef OJI
nsILiveconnect* GetLiveconnect(const nsIID& aIID);
#endif /* OJI */
nsISupports* fJVMMgr;
nsISupports* fMalloc;
nsISupports* fFileUtils;
PRUint16 fWaiting;
void* fOldCursor;
nsHashtable* fAllocatedMenuIDs;
nsISupports* fCapsManager;
nsISupports* fLiveconnect;
};
extern nsPluginManager* thePluginManager;
////////////////////////////////////////////////////////////////////////////////
class nsFileUtilities : public nsIFileUtilities {
public:
////////////////////////////////////////////////////////////////////////////
// from nsIFileUtilities:
NS_IMETHOD
GetProgramPath(const char* *result);
NS_IMETHOD
GetTempDirPath(const char* *result);
NS_IMETHOD
NewTempFileName(const char* prefix, PRUint32 bufLen, char* resultBuf);
////////////////////////////////////////////////////////////////////////////
// nsFileUtilities specific methods:
nsFileUtilities(nsISupports* outer);
virtual ~nsFileUtilities(void);
NS_DECL_AGGREGATED
static NS_METHOD
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
void SetProgramPath(const char* path) { fProgramPath = path; }
protected:
const char* fProgramPath;
};
////////////////////////////////////////////////////////////////////////////////
typedef struct JSContext JSContext;
class nsPluginTagInfo;
class nsPluginInstancePeer : public nsIPluginInstancePeer,
public nsILiveConnectPluginInstancePeer,
public nsIWindowlessPluginInstancePeer
{
public:
////////////////////////////////////////////////////////////////////////////
// from nsIPluginInstancePeer:
NS_IMETHOD
GetValue(nsPluginInstancePeerVariable variable, void *value);
// (Corresponds to NPP_New's MIMEType argument.)
NS_IMETHOD
GetMIMEType(nsMIMEType *result);
// (Corresponds to NPP_New's mode argument.)
NS_IMETHOD
GetMode(nsPluginMode *result);
// (Corresponds to NPN_NewStream.)
NS_IMETHOD
NewStream(nsMIMEType type, const char* target, nsIOutputStream* *result);
// (Corresponds to NPN_Status.)
NS_IMETHOD
ShowStatus(const char* message);
NS_IMETHOD
SetWindowSize(PRUint32 width, PRUint32 height);
////////////////////////////////////////////////////////////////////////////
// from nsIJRILiveConnectPluginInstancePeer:
// (Corresponds to NPN_GetJavaPeer.)
NS_IMETHOD
GetJavaPeer(jobject *result);
////////////////////////////////////////////////////////////////////////////
// from nsIWindowlessPluginInstancePeer:
// (Corresponds to NPN_InvalidateRect.)
NS_IMETHOD
InvalidateRect(nsPluginRect *invalidRect);
// (Corresponds to NPN_InvalidateRegion.)
NS_IMETHOD
InvalidateRegion(nsPluginRegion invalidRegion);
// (Corresponds to NPN_ForceRedraw.)
NS_IMETHOD
ForceRedraw(void);
////////////////////////////////////////////////////////////////////////////
// nsPluginInstancePeer specific methods:
nsPluginInstancePeer(NPP npp);
virtual ~nsPluginInstancePeer(void);
NS_DECL_ISUPPORTS
void SetPluginInstance(nsIPluginInstance* inst);
nsIPluginInstance* GetPluginInstance(void);
NPP GetNPP(void);
JSContext *GetJSContext(void);
MWContext *GetMWContext(void);
protected:
// NPP is the old plugin structure. If we were implementing this
// from scratch we wouldn't use it, but for now we're calling the old
// npglue.c routines wherever possible.
NPP fNPP;
nsIPluginInstance* fPluginInst;
nsPluginTagInfo* fTagInfo;
};
#define NS_PLUGININSTANCEPEER_CID \
{ /* 766432d0-01ba-11d2-815b-006008119d7a */ \
0x766432d0, \
0x01ba, \
0x11d2, \
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
////////////////////////////////////////////////////////////////////////////////
class nsPluginTagInfo : public nsIPluginTagInfo2 {
public:
////////////////////////////////////////////////////////////////////////////
// from nsIPluginTagInfo:
// 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);
// Get the value for the named attribute. Returns null
// if the attribute was not set.
NS_IMETHOD
GetAttribute(const char* name, const char* *result);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginTagInfo2:
// 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);
// Get the complete text of the HTML tag that was
// used to instantiate this plugin
NS_IMETHOD
GetTagText(const char * *result);
// 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);
// Get the value for the named parameter. Returns null
// if the parameter was not set.
NS_IMETHOD
GetParameter(const char* name, const char* *result);
NS_IMETHOD
GetDocumentBase(char* *result);
// 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);
NS_IMETHOD
GetAlignment(const char* *result);
NS_IMETHOD
GetWidth(PRUint32 *result);
NS_IMETHOD
GetHeight(PRUint32 *result);
NS_IMETHOD
GetBorderVertSpace(PRUint32 *result);
NS_IMETHOD
GetBorderHorizSpace(PRUint32 *result);
// Returns a unique id for the current document on which the
// plugin is displayed.
NS_IMETHOD
GetUniqueID(PRUint32 *result);
////////////////////////////////////////////////////////////////////////////
// nsPluginTagInfo specific methods:
nsPluginTagInfo(NPP npp);
virtual ~nsPluginTagInfo(void);
NS_DECL_AGGREGATED
protected:
LO_CommonPluginStruct* GetLayoutElement(void)
{
np_instance* instance = (np_instance*) npp->ndata;
NPEmbeddedApp* app = instance->app;
np_data* ndata = (np_data*) app->np_data;
return (LO_CommonPluginStruct*)ndata->lo_struct;
}
// aggregated interfaces:
nsISupports* fJVMPluginTagInfo;
NPP npp;
PRUint32 fUniqueID;
};
////////////////////////////////////////////////////////////////////////////////
class nsPluginManagerStream : public nsIOutputStream {
public:
////////////////////////////////////////////////////////////////////////////
// from nsIBaseStream:
NS_DECL_NSIBASESTREAM
NS_IMETHOD
Close(void);
////////////////////////////////////////////////////////////////////////////
// from nsIOutputStream:
/** Write data into the stream.
* @param aBuf the buffer into which the data is read
* @param aOffset the start offset of the data
* @param aCount the maximum number of bytes to read
* @return number of bytes read or an error if < 0
*/
NS_IMETHOD
Write(const char* aBuf, PRInt32 aCount, PRInt32 *resultingCount);
NS_IMETHOD Flush() {
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////
// nsPluginManagerStream specific methods:
nsPluginManagerStream(NPP npp, NPStream* pstr);
virtual ~nsPluginManagerStream(void);
NS_DECL_ISUPPORTS
protected:
NPP npp;
NPStream* pstream;
};
////////////////////////////////////////////////////////////////////////////////
#ifdef NEW_PLUGIN_STREAM_API
#include "nsIPluginInputStream2.h"
class nsPluginInputStream;
// stored in the fe_data of the URL_Struct:
struct nsPluginURLData {
NPEmbeddedApp* app;
nsIPluginStreamListener* listener;
nsPluginInputStream* inStr;
};
class nsPluginInputStream : public nsIPluginInputStream2 {
public:
NS_DECL_ISUPPORTS
////////////////////////////////////////////////////////////////////////////
// from nsIBaseStream:
/** Close the stream. */
NS_IMETHOD
Close(void);
////////////////////////////////////////////////////////////////////////////
// from nsIInputStream:
/** Return the number of bytes in the stream
* @param aLength out parameter to hold the length
* of the stream. if an error occurs, the length
* will be undefined
* @return error status
*/
NS_IMETHOD
GetLength(PRInt32 *aLength);
/** Read data from the stream.
* @param aErrorCode the error code if an error occurs
* @param aBuf the buffer into which the data is read
* @param aOffset the start offset of the data
* @param aCount the maximum number of bytes to read
* @param aReadCount out parameter to hold the number of
* bytes read, eof if 0. if an error occurs, the
* read count will be undefined
* @return error status
*/
NS_IMETHOD
Read(char* aBuf, PRInt32 aOffset, PRInt32 aCount, PRInt32 *aReadCount);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginInputStream:
// (Corresponds to NPStream's lastmodified field.)
NS_IMETHOD
GetLastModified(PRUint32 *result);
NS_IMETHOD
RequestRead(nsByteRange* rangeList);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginInputStream2:
NS_IMETHOD
GetContentLength(PRUint32 *result);
NS_IMETHOD
GetHeaderFields(PRUint16& n, const char*const*& names, const char*const*& values);
NS_IMETHOD
GetHeaderField(const char* name, const char* *result);
////////////////////////////////////////////////////////////////////////////
// nsPluginInputStream specific methods:
nsPluginInputStream(nsIPluginStreamListener* listener,
nsPluginStreamType streamType);
virtual ~nsPluginInputStream(void);
nsIPluginStreamListener* GetListener(void) { return mListener; }
nsPluginStreamType GetStreamType(void) { return mStreamType; }
PRBool IsClosed(void) { return mClosed; }
void SetStreamInfo(URL_Struct* urls, np_stream* stream) {
mUrls = urls;
mStream = stream;
}
nsresult ReceiveData(const char* buffer, PRUint32 offset, PRUint32 len);
void Cleanup(void);
protected:
nsIPluginStreamListener* mListener;
nsPluginStreamType mStreamType;
URL_Struct* mUrls;
np_stream* mStream;
struct BufferElement {
BufferElement* next;
char* segment;
PRUint32 offset;
PRUint32 length;
};
BufferElement* mBuffer;
PRBool mClosed;
// PRUint32 mReadCursor;
// PRUint32 mBufferLength;
// PRUint32 mAmountRead;
};
#else // !NEW_PLUGIN_STREAM_API
class nsPluginStreamPeer : public nsIPluginStreamPeer2,
public nsISeekablePluginStreamPeer
{
public:
////////////////////////////////////////////////////////////////////////////
// from nsIPluginStreamPeer:
// (Corresponds to NPStream's url field.)
NS_IMETHOD
GetURL(const char* *result);
// (Corresponds to NPStream's end field.)
NS_IMETHOD
GetEnd(PRUint32 *result);
// (Corresponds to NPStream's lastmodified field.)
NS_IMETHOD
GetLastModified(PRUint32 *result);
// (Corresponds to NPStream's notifyData field.)
NS_IMETHOD
GetNotifyData(void* *result);
// (Corresponds to NPP_DestroyStream's reason argument.)
NS_IMETHOD
GetReason(nsPluginReason *result);
// (Corresponds to NPP_NewStream's MIMEType argument.)
NS_IMETHOD
GetMIMEType(nsMIMEType *result);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginStreamPeer2:
NS_IMETHOD
GetContentLength(PRUint32 *result);
NS_IMETHOD
GetHeaderFieldCount(PRUint32 *result);
NS_IMETHOD
GetHeaderFieldKey(PRUint32 index, const char* *result);
NS_IMETHOD
GetHeaderField(PRUint32 index, const char* *result);
////////////////////////////////////////////////////////////////////////////
// from nsISeekablePluginStreamPeer:
// (Corresponds to NPN_RequestRead.)
NS_IMETHOD
RequestRead(nsByteRange* rangeList);
////////////////////////////////////////////////////////////////////////////
// nsPluginStreamPeer specific methods:
nsPluginStreamPeer(URL_Struct *urls, np_stream *stream);
virtual ~nsPluginStreamPeer(void);
NS_DECL_ISUPPORTS
nsIPluginStream* GetUserStream(void) {
return userStream;
}
void SetUserStream(nsIPluginStream* str) {
userStream = str;
}
void SetReason(nsPluginReason r) {
reason = r;
}
protected:
nsIPluginStream* userStream;
URL_Struct *urls;
np_stream *stream;
nsPluginReason reason;
};
#endif // !NEW_PLUGIN_STREAM_API
////////////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus)
} /* extern "C" */
#endif
#endif /* npglue_h__ */

Просмотреть файл

@ -1,68 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Prototypes for functions exported by the FEs and called by libplugin.
* Some (perhaps all) of these prototypes could be moved to fe_proto.h.
* Protypes for functions exported by libplugin are in np.h.
*/
#ifndef _NPPG_H
#define _NPPG_H
#include "npapi.h"
#include "npupp.h"
struct _np_handle;
XP_BEGIN_PROTOS
extern void FE_RegisterPlugins(void);
extern NPPluginFuncs* FE_LoadPlugin(void *plugin, NPNetscapeFuncs *, struct _np_handle* handle);
extern void FE_UnloadPlugin(void *plugin, struct _np_handle* handle);
extern void FE_EmbedURLExit(URL_Struct *urls, int status, MWContext *cx);
extern void FE_ShowScrollBars(MWContext *context, XP_Bool show);
#if defined (XP_WIN) || defined(XP_OS2)
extern void FE_FreeEmbedSessionData(MWContext *context, NPEmbeddedApp* pApp);
#endif
#ifdef XP_MAC
extern void FE_PluginProgress(MWContext *context, const char *message);
extern void FE_ResetRefreshURLTimer(MWContext *context);
extern void FE_RegisterWindow(struct nsIEventHandler* handler, void* window);
extern void FE_UnregisterWindow(struct nsIEventHandler*, void* window);
// extern SInt16 FE_AllocateMenuID(void *plugin, XP_Bool isSubmenu);
#endif
#ifdef XP_UNIX
extern NPError FE_PluginGetValue(void *pdesc, NPNVariable variable, void *r_value);
#else
extern NPError FE_PluginGetValue(MWContext *context, NPEmbeddedApp *app, NPNVariable variable, void *r_value);
#endif /* XP_UNIX */
#ifdef XP_WIN32
void* WFE_BeginSetModuleState();
void WFE_EndSetModuleState(void*);
#endif
XP_END_PROTOS
#endif /* _NPPG_H */

Просмотреть файл

@ -1,157 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef _NPPRIV_H_
#define _NPPRIV_H_
#include "xp_core.h"
#include "xp_mem.h"
#include "xp_trace.h"
#include "xp_mcom.h"
#include "lo_ele.h"
#include "npupp.h"
#include "npassoc.h"
#include "npapi.h"
#define ISFUNCPTR(x) (x != NULL)
#define PLUGIN_TIMER_EVENT
typedef struct _np_handle np_handle;
typedef struct _np_mimetype np_mimetype;
typedef struct _np_instance np_instance;
typedef struct _np_stream np_stream;
typedef struct _np_data np_data;
typedef struct _np_urlsnode np_urlsnode;
typedef struct _np_reconnect np_reconnect;
struct nsIPlugin;
typedef enum {
NPDataNormal = 0, /* URL_Struct.fe_data -> NPEmbeddedApp.np_data -> np_data */
NPDataCache = 1, /* LO_EmbedStruct.session_data -> np_data */
NPDataCached = 2, /* LO_EmbedStruct.session_data -> np_data */
NPDataSaved = 3 /* LO_EmbedStruct.session_data -> np_data */
} NPDataState;
struct _np_data {
NPDataState state;
np_handle *handle;
NPEmbeddedApp *app;
NPSavedData *sdata;
/* Not valid in state NPDataSaved! */
np_instance *instance;
LO_EmbedStruct *lo_struct;
int32 refs;
XP_Bool streamStarted;
};
struct _np_handle {
np_handle *next;
NPPluginFuncs *f;
void *pdesc; /* pd glue description */
int32 refs;
np_instance *instances;
np_mimetype *mimetypes;
char *name;
char *filename;
char *description;
struct nsIPlugin* userPlugin;
};
struct _np_mimetype {
np_mimetype* next;
NPMIMEType type;
NPFileTypeAssoc *fassoc;
np_handle* handle;
XP_Bool enabled;
};
struct _np_instance {
np_handle *handle;
np_mimetype *mimetype;
char *typeString;
np_instance *next;
NPEmbeddedApp *app;
NPP npp;
MWContext *cx;
np_stream *streams;
uint16 type;
int reentrant;
URL_Struct *delayedload;
XP_List *url_list;
JRIEnv* javaEnv;
#ifdef OJI
jobject javaInstance;
#else
JRIGlobalRef javaInstance;
#endif /* OJI */
XP_Bool windowed; /* TRUE = has its own window, FALSE = windowless */
XP_Bool transparent; /* TRUE = transparent, FALSE = opaque */
XP_Bool calling_netlib_all_the_time;
JRIGlobalRef mochaWindow;
#ifdef PLUGIN_TIMER_EVENT
void* timeout;
uint32 interval;
#endif
#ifdef LAYERS
CL_Layer *layer;
#endif /* LAYERS */
};
struct _np_stream {
np_instance *instance;
np_handle *handle;
np_stream *next;
NPStream *pstream;
char *url; /* convenience */
URL_Struct *initial_urls;
NET_StreamClass *nstream;
int32 len;
int init;
int seek; /* 0 normal, -1 turn, 1 seek, 2 discard */
int seekable;
int dontclose;
int asfile;
int islocked;
int32 offset;
NPByteRange *deferred;
NET_StreamClass *prev_stream;
};
struct _np_urlsnode {
URL_Struct *urls;
void* notifyData;
XP_Bool cached;
XP_Bool notify;
};
/* MWContext.pluginReconnect -> np_reconnect */
struct _np_reconnect {
np_mimetype* mimetype;
char* requestedtype;
NPEmbeddedApp* app;
};
#endif /* _NPPRIV_H_ */

Просмотреть файл

@ -1,129 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsFileUtilities.h"
#include "nsIComponentManager.h"
#include "xp.h"
////////////////////////////////////////////////////////////////////////////////
// File Utilities Interface
nsFileUtilities::nsFileUtilities(nsISupports* outer)
: fProgramPath(NULL)
{
NS_INIT_AGGREGATED(outer);
}
nsFileUtilities::~nsFileUtilities(void)
{
}
NS_IMPL_AGGREGATED(nsFileUtilities);
static NS_DEFINE_IID(kIFileUtilitiesIID, NS_IFILEUTILITIES_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
NS_METHOD
nsFileUtilities::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kIFileUtilitiesIID) ||
aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_METHOD
nsFileUtilities::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
{
if (outer && !aIID.Equals(kISupportsIID))
return NS_NOINTERFACE; // XXX right error?
nsFileUtilities* fu = new nsFileUtilities(outer);
if (fu == NULL)
return NS_ERROR_OUT_OF_MEMORY;
fu->AddRef();
*aInstancePtr = fu->GetInner();
return NS_OK;
}
NS_METHOD
nsFileUtilities::GetProgramPath(const char* *result)
{
*result = fProgramPath;
return NS_OK;
}
NS_METHOD
nsFileUtilities::GetTempDirPath(const char* *result)
{
// XXX I don't need a static really, the browser holds the tempDir name
// as a static string -- it's just the XP_TempDirName that strdups it.
static const char* tempDirName = NULL;
if (tempDirName == NULL)
tempDirName = XP_TempDirName();
*result = tempDirName;
return NS_OK;
}
#if 0
NS_METHOD
nsFileUtilities::GetFileName(const char* fn, FileNameType type,
char* resultBuf, PRUint32 bufLen)
{
// XXX This should be rewritten so that we don't have to malloc the name.
XP_FileType filetype;
if (type == SIGNED_APPLET_DBNAME)
filetype = xpSignedAppletDB;
else if (type == TEMP_FILENAME)
filetype = xpTemporary;
else
return NS_ERROR_ILLEGAL_VALUE;
char* tempName = WH_FileName(fn, filetype);
if (tempName == NULL)
return NS_ERROR_OUT_OF_MEMORY;
XP_STRNCPY_SAFE(resultBuf, tempName, bufLen);
XP_FREE(tempName);
return NS_OK;
}
#endif
NS_METHOD
nsFileUtilities::NewTempFileName(const char* prefix, PRUint32 bufLen, char* resultBuf)
{
// XXX This should be rewritten so that we don't have to malloc the name.
char* tempName = WH_TempName(xpTemporary, prefix);
if (tempName == NULL)
return NS_ERROR_OUT_OF_MEMORY;
XP_STRNCPY_SAFE(resultBuf, tempName, bufLen);
XP_FREE(tempName);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -1,64 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsFileUtilities_h__
#define nsFileUtilities_h__
#include "nsIFileUtilities.h"
#include "nsAgg.h"
////////////////////////////////////////////////////////////////////////////////
class nsFileUtilities : public nsIFileUtilities {
public:
////////////////////////////////////////////////////////////////////////////
// from nsIFileUtilities:
NS_IMETHOD
GetProgramPath(const char* *result);
NS_IMETHOD
GetTempDirPath(const char* *result);
NS_IMETHOD
NewTempFileName(const char* prefix, PRUint32 bufLen, char* resultBuf);
////////////////////////////////////////////////////////////////////////////
// nsFileUtilities specific methods:
nsFileUtilities(nsISupports* outer);
virtual ~nsFileUtilities(void);
NS_DECL_AGGREGATED
static NS_METHOD
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
void SetProgramPath(const char* path) { fProgramPath = path; }
protected:
const char* fProgramPath;
};
#endif // nsFileUtilities_h__

Просмотреть файл

@ -1,116 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
////////////////////////////////////////////////////////////////////////////////
// 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;
}
NS_METHOD_(void)
nsMalloc::HeapMinimize(void)
{
#ifdef XP_MAC
// This used to live in the memory allocators no Mac, but does no more
// Needs to be hooked up in the new world.
// CallCacheFlushers(0x7fffffff);
#endif
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -1,105 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
////////////////////////////////////////////////////////////////////////////////
// Implementation of nsIMalloc using NSPR
////////////////////////////////////////////////////////////////////////////////
#ifndef nsMalloc_h__
#define nsMalloc_h__
#include "nsIMalloc.h"
#include "prmem.h"
#include "nsAgg.h"
class nsMalloc : public 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__

Просмотреть файл

@ -1,369 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsPluginInputStream.h"
#include "plstr.h"
#include "npglue.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
#ifdef NEW_PLUGIN_STREAM_API
static NS_DEFINE_IID(kIPluginInputStreamIID, NS_IPLUGININPUTSTREAM_IID);
static NS_DEFINE_IID(kIPluginInputStream2IID, NS_IPLUGININPUTSTREAM2_IID);
static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
#else // !NEW_PLUGIN_STREAM_API
static NS_DEFINE_IID(kISeekablePluginStreamPeerIID, NS_ISEEKABLEPLUGINSTREAMPEER_IID);
static NS_DEFINE_IID(kIPluginStreamPeerIID, NS_IPLUGINSTREAMPEER_IID);
static NS_DEFINE_IID(kIPluginStreamPeer2IID, NS_IPLUGINSTREAMPEER2_IID);
#endif // !NEW_PLUGIN_STREAM_API
#ifdef NEW_PLUGIN_STREAM_API
////////////////////////////////////////////////////////////////////////////////
// Plugin Input Stream Interface
nsPluginInputStream::nsPluginInputStream(nsIPluginStreamListener* listener,
nsPluginStreamType streamType)
: mListener(listener), mStreamType(streamType),
mUrls(NULL), mStream(NULL),
mBuffer(NULL), mClosed(PR_FALSE)
// mBuffer(NULL), mBufferLength(0), mAmountRead(0)
{
NS_INIT_REFCNT();
listener->AddRef();
}
nsPluginInputStream::~nsPluginInputStream(void)
{
Cleanup();
mListener->Release();
}
NS_IMPL_ADDREF(nsPluginInputStream);
NS_IMPL_RELEASE(nsPluginInputStream);
NS_METHOD
nsPluginInputStream::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kIPluginInputStream2IID) ||
aIID.Equals(kIPluginInputStreamIID) ||
aIID.Equals(kISupportsIID)) {
*aInstancePtr = (nsIPluginInputStream2*)this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
void
nsPluginInputStream::Cleanup(void)
{
if (mBuffer) {
// free the buffered data
BufferElement* element = mBuffer;
while (element != NULL) {
BufferElement* next = element->next;
PL_strfree(element->segment);
delete element;
element = next;
}
mBuffer = NULL;
}
mClosed = PR_TRUE;
}
NS_METHOD
nsPluginInputStream::Close(void)
{
NPError err = NPERR_NO_ERROR;
Cleanup();
#if 0 /* According to the plugin documentation, this would seem to be the
* right thing to do here, but it's not (and calling NPN_DestroyStream
* in the 4.0 browser during an NPP_Write call will crash the browser).
*/
err = npn_destroystream(mStream->instance->npp, mStream->pstream,
nsPluginReason_UserBreak);
#endif
return fromNPError[err];
}
NS_METHOD
nsPluginInputStream::GetLength(PRInt32 *aLength)
{
*aLength = mStream->pstream->end;
return NS_OK;
#if 0
*aLength = mBufferLength;
return NS_OK;
#endif
}
nsresult
nsPluginInputStream::ReceiveData(const char* buffer, PRUint32 offset, PRUint32 len)
{
BufferElement* element = new BufferElement;
if (element == NULL)
return NS_ERROR_OUT_OF_MEMORY;
element->segment = PL_strdup(buffer);
element->offset = offset;
element->length = len;
element->next = mBuffer;
mBuffer = element;
return NS_OK;
}
NS_METHOD
nsPluginInputStream::Read(char* aBuf, PRInt32 aOffset, PRInt32 aCount,
PRInt32 *aReadCount)
{
BufferElement* element;
for (element = mBuffer; element != NULL; element = element->next) {
if ((PRInt32)element->offset <= aOffset
&& aOffset < (PRInt32)(element->offset + element->length)) {
// found our segment
PRUint32 segmentIndex = aOffset - element->offset;
PRUint32 segmentAmount = element->length - segmentIndex;
if (aCount > (PRInt32)segmentAmount) {
return NS_ERROR_FAILURE;
}
memcpy(aBuf, &element->segment[segmentIndex], aCount);
// mReadCursor = segmentIndex + aCount;
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
NS_METHOD
nsPluginInputStream::GetLastModified(PRUint32 *result)
{
*result = mStream->pstream->lastmodified;
return NS_OK;
}
NS_METHOD
nsPluginInputStream::RequestRead(nsByteRange* rangeList)
{
NPError err = npn_requestread(mStream->pstream,
(NPByteRange*)rangeList);
return fromNPError[err];
}
NS_METHOD
nsPluginInputStream::GetContentLength(PRUint32 *result)
{
*result = mUrls->content_length;
return NS_OK;
}
NS_METHOD
nsPluginInputStream::GetHeaderFields(PRUint16& n, const char*const*& names,
const char*const*& values)
{
n = (PRUint16)mUrls->all_headers.empty_index;
names = (const char*const*)mUrls->all_headers.key;
values = (const char*const*)mUrls->all_headers.value;
return NS_OK;
}
NS_METHOD
nsPluginInputStream::GetHeaderField(const char* name, const char* *result)
{
PRUint16 i;
for (i = 0; i < mUrls->all_headers.empty_index; i++) {
if (PL_strcmp(mUrls->all_headers.key[i], name) == 0) {
*result = mUrls->all_headers.value[i];
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
#else // !NEW_PLUGIN_STREAM_API
////////////////////////////////////////////////////////////////////////////////
// Plugin Stream Peer Interface
nsPluginStreamPeer::nsPluginStreamPeer(URL_Struct *urls, np_stream *stream)
: userStream(NULL), urls(urls), stream(stream),
reason(nsPluginReason_NoReason)
{
NS_INIT_REFCNT();
}
nsPluginStreamPeer::~nsPluginStreamPeer(void)
{
#if 0
NPError err = npn_destroystream(stream->instance->npp, stream->pstream, reason);
PR_ASSERT(err == nsPluginError_NoError);
#endif
}
NS_METHOD
nsPluginStreamPeer::GetURL(const char* *result)
{
*result = stream->pstream->url;
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::GetEnd(PRUint32 *result)
{
*result = stream->pstream->end;
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::GetLastModified(PRUint32 *result)
{
*result = stream->pstream->lastmodified;
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::GetNotifyData(void* *result)
{
*result = stream->pstream->notifyData;
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::GetReason(nsPluginReason *result)
{
*result = reason;
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::GetMIMEType(nsMIMEType *result)
{
*result = (nsMIMEType)urls->content_type;
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::GetContentLength(PRUint32 *result)
{
*result = urls->content_length;
return NS_OK;
}
#if 0
NS_METHOD_(const char*)
nsPluginStreamPeer::GetContentEncoding(void)
{
return urls->content_encoding;
}
NS_METHOD_(const char*)
nsPluginStreamPeer::GetCharSet(void)
{
return urls->charset;
}
NS_METHOD_(const char*)
nsPluginStreamPeer::GetBoundary(void)
{
return urls->boundary;
}
NS_METHOD_(const char*)
nsPluginStreamPeer::GetContentName(void)
{
return urls->content_name;
}
NS_METHOD_(time_t)
nsPluginStreamPeer::GetExpires(void)
{
return urls->expires;
}
NS_METHOD_(time_t)
nsPluginStreamPeer::GetLastModified(void)
{
return urls->last_modified;
}
NS_METHOD_(time_t)
nsPluginStreamPeer::GetServerDate(void)
{
return urls->server_date;
}
NS_METHOD_(NPServerStatus)
nsPluginStreamPeer::GetServerStatus(void)
{
return urls->server_status;
}
#endif
NS_METHOD
nsPluginStreamPeer::GetHeaderFieldCount(PRUint32 *result)
{
*result = urls->all_headers.empty_index;
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::GetHeaderFieldKey(PRUint32 index, const char* *result)
{
*result = urls->all_headers.key[index];
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::GetHeaderField(PRUint32 index, const char* *result)
{
*result = urls->all_headers.value[index];
return NS_OK;
}
NS_METHOD
nsPluginStreamPeer::RequestRead(nsByteRange* rangeList)
{
NPError err = npn_requestread(stream->pstream,
(NPByteRange*)rangeList);
return fromNPError[err];
}
NS_IMPL_ADDREF(nsPluginStreamPeer);
NS_IMPL_RELEASE(nsPluginStreamPeer);
NS_METHOD
nsPluginStreamPeer::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if ((stream->seekable && aIID.Equals(kISeekablePluginStreamPeerIID)) ||
aIID.Equals(kIPluginStreamPeer2IID) ||
aIID.Equals(kIPluginStreamPeerIID) ||
aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*)(nsISupports*)(nsIPluginStreamPeer2*)this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
#endif // !NEW_PLUGIN_STREAM_API
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -1,201 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsPluginInputStream_h__
#define nsPluginInputStream_h__
#include "net.h"
#include "nppriv.h"
#ifdef NEW_PLUGIN_STREAM_API
#include "nsIPluginInputStream2.h"
#include "nsIPluginStreamListener.h"
class nsPluginInputStream;
// stored in the fe_data of the URL_Struct:
struct nsPluginURLData {
struct _NPEmbeddedApp* app;
nsIPluginStreamListener* listener;
nsPluginInputStream* inStr;
};
class nsPluginInputStream : public nsIPluginInputStream2 {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIBASESTREAM
NS_DECL_NSIINPUTSTREAM
////////////////////////////////////////////////////////////////////////////
// from nsIPluginInputStream:
// (Corresponds to NPStream's lastmodified field.)
NS_IMETHOD
GetLastModified(PRUint32 *result);
NS_IMETHOD
RequestRead(nsByteRange* rangeList);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginInputStream2:
NS_IMETHOD
GetContentLength(PRUint32 *result);
NS_IMETHOD
GetHeaderFields(PRUint16& n, const char*const*& names, const char*const*& values);
NS_IMETHOD
GetHeaderField(const char* name, const char* *result);
////////////////////////////////////////////////////////////////////////////
// nsPluginInputStream specific methods:
nsPluginInputStream(nsIPluginStreamListener* listener,
nsPluginStreamType streamType);
virtual ~nsPluginInputStream(void);
nsIPluginStreamListener* GetListener(void) { return mListener; }
nsPluginStreamType GetStreamType(void) { return mStreamType; }
PRBool IsClosed(void) { return mClosed; }
void SetStreamInfo(URL_Struct* urls, np_stream* stream) {
mUrls = urls;
mStream = stream;
}
nsresult ReceiveData(const char* buffer, PRUint32 offset, PRUint32 len);
void Cleanup(void);
protected:
nsIPluginStreamListener* mListener;
nsPluginStreamType mStreamType;
URL_Struct* mUrls;
np_stream* mStream;
struct BufferElement {
BufferElement* next;
char* segment;
PRUint32 offset;
PRUint32 length;
};
BufferElement* mBuffer;
PRBool mClosed;
// PRUint32 mReadCursor;
// PRUint32 mBufferLength;
// PRUint32 mAmountRead;
};
#else // !NEW_PLUGIN_STREAM_API
class nsPluginStreamPeer : public nsIPluginStreamPeer2,
public nsISeekablePluginStreamPeer
{
public:
////////////////////////////////////////////////////////////////////////////
// from nsIPluginStreamPeer:
// (Corresponds to NPStream's url field.)
NS_IMETHOD
GetURL(const char* *result);
// (Corresponds to NPStream's end field.)
NS_IMETHOD
GetEnd(PRUint32 *result);
// (Corresponds to NPStream's lastmodified field.)
NS_IMETHOD
GetLastModified(PRUint32 *result);
// (Corresponds to NPStream's notifyData field.)
NS_IMETHOD
GetNotifyData(void* *result);
// (Corresponds to NPP_DestroyStream's reason argument.)
NS_IMETHOD
GetReason(nsPluginReason *result);
// (Corresponds to NPP_NewStream's MIMEType argument.)
NS_IMETHOD
GetMIMEType(nsMIMEType *result);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginStreamPeer2:
NS_IMETHOD
GetContentLength(PRUint32 *result);
NS_IMETHOD
GetHeaderFieldCount(PRUint32 *result);
NS_IMETHOD
GetHeaderFieldKey(PRUint32 index, const char* *result);
NS_IMETHOD
GetHeaderField(PRUint32 index, const char* *result);
////////////////////////////////////////////////////////////////////////////
// from nsISeekablePluginStreamPeer:
// (Corresponds to NPN_RequestRead.)
NS_IMETHOD
RequestRead(nsByteRange* rangeList);
////////////////////////////////////////////////////////////////////////////
// nsPluginStreamPeer specific methods:
nsPluginStreamPeer(URL_Struct *urls, np_stream *stream);
virtual ~nsPluginStreamPeer(void);
NS_DECL_ISUPPORTS
nsIPluginStream* GetUserStream(void) {
return userStream;
}
void SetUserStream(nsIPluginStream* str) {
userStream = str;
}
void SetReason(nsPluginReason r) {
reason = r;
}
protected:
nsIPluginStream* userStream;
URL_Struct *urls;
np_stream *stream;
nsPluginReason reason;
};
#endif // !NEW_PLUGIN_STREAM_API
#endif // nsPluginInputStream_h__

Просмотреть файл

@ -1,238 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsPluginInstancePeer.h"
#include "nsPluginTagInfo.h"
#include "nsPluginManagerStream.h"
#include "nsIPluginInstance.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kPluginInstancePeerCID, NS_PLUGININSTANCEPEER_CID);
static NS_DEFINE_IID(kIPluginInstancePeerIID, NS_IPLUGININSTANCEPEER_IID);
static NS_DEFINE_IID(kILiveConnectPluginInstancePeerIID, NS_ILIVECONNECTPLUGININSTANCEPEER_IID);
static NS_DEFINE_IID(kIWindowlessPluginInstancePeerIID, NS_IWINDOWLESSPLUGININSTANCEPEER_IID);
////////////////////////////////////////////////////////////////////////////////
// Plugin Instance Peer Interface
nsPluginInstancePeer::nsPluginInstancePeer(NPP npp)
: fNPP(npp), fPluginInst(NULL), fTagInfo(NULL)
{
// NS_INIT_AGGREGATED(NULL);
NS_INIT_REFCNT();
fTagInfo = new nsPluginTagInfo(npp);
fTagInfo->AddRef();
}
nsPluginInstancePeer::~nsPluginInstancePeer(void)
{
if (fTagInfo != NULL) {
fTagInfo->Release();
fTagInfo = NULL;
}
}
NS_IMPL_ADDREF(nsPluginInstancePeer);
NS_IMPL_RELEASE(nsPluginInstancePeer);
NS_METHOD
nsPluginInstancePeer::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kIPluginInstancePeerIID) ||
aIID.Equals(kPluginInstancePeerCID) ||
aIID.Equals(kISupportsIID)) {
// *aInstancePtr = (void*) (nsISupports*) (nsIPluginInstancePeer*)this;
*aInstancePtr = (nsIPluginInstancePeer*) this;
AddRef();
return NS_OK;
}
// beard: check for interfaces that aren't on the left edge of the inheritance graph.
// this is required so that the proper offsets are applied to this, and so the proper
// vtable is used.
if (aIID.Equals(kILiveConnectPluginInstancePeerIID)) {
*aInstancePtr = (nsILiveConnectPluginInstancePeer*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kIWindowlessPluginInstancePeerIID)) {
*aInstancePtr = (nsIWindowlessPluginInstancePeer*) this;
AddRef();
return NS_OK;
}
return fTagInfo->QueryInterface(aIID, aInstancePtr);
}
NS_METHOD
nsPluginInstancePeer::GetValue(nsPluginInstancePeerVariable variable, void *value)
{
NPError err = npn_getvalue(fNPP, (NPNVariable)variable, value);
return fromNPError[err];
}
#if 0
NS_METHOD
nsPluginInstancePeer::SetValue(nsPluginInstancePeerVariable variable, void *value)
{
NPError err = npn_setvalue(fNPP, (NPPVariable)variable, value);
return fromNPError[err];
}
#endif
NS_METHOD
nsPluginInstancePeer::GetMIMEType(nsMIMEType *result)
{
np_instance* instance = (np_instance*)fNPP->ndata;
*result = instance->typeString;
return NS_OK;
}
NS_METHOD
nsPluginInstancePeer::GetMode(nsPluginMode *result)
{
np_instance* instance = (np_instance*)fNPP->ndata;
*result = (nsPluginMode)instance->type;
return NS_OK;
}
NS_METHOD
nsPluginInstancePeer::NewStream(nsMIMEType type, const char* target, nsIOutputStream* *result)
{
NPStream* pstream;
NPError err = npn_newstream(fNPP, (char*)type, (char*)target, &pstream);
if (err != NPERR_NO_ERROR)
return err;
*result = new nsPluginManagerStream(fNPP, pstream);
return NS_OK;
}
NS_METHOD
nsPluginInstancePeer::ShowStatus(const char* message)
{
npn_status(fNPP, message);
return NS_OK;
}
NS_METHOD
nsPluginInstancePeer::SetWindowSize(PRUint32 width, PRUint32 height)
{
NPError err;
NPSize size;
size.width = width;
size.height = height;
err = npn_SetWindowSize((np_instance*)fNPP->ndata, &size);
return fromNPError[err];
}
NS_METHOD
nsPluginInstancePeer::InvalidateRect(nsPluginRect *invalidRect)
{
npn_invalidaterect(fNPP, (NPRect*)invalidRect);
return NS_OK;
}
NS_METHOD
nsPluginInstancePeer::InvalidateRegion(nsPluginRegion invalidRegion)
{
npn_invalidateregion(fNPP, invalidRegion);
return NS_OK;
}
NS_METHOD
nsPluginInstancePeer::ForceRedraw(void)
{
npn_forceredraw(fNPP);
return NS_OK;
}
NS_METHOD
nsPluginInstancePeer::GetJavaPeer(jref *peer)
{
*peer = npn_getJavaPeer(fNPP);
return NS_OK;
}
void nsPluginInstancePeer::SetPluginInstance(nsIPluginInstance* inst)
{
// We're now maintaining our reference to plugin instance in the
// npp->ndata->sdata (saved data) field, and we access the peer
// from there. This method should be totally unnecessary.
#if 0
if (fPluginInst != NULL) {
fPluginInst->Release();
}
#endif
fPluginInst = inst;
#if 0
if (fPluginInst != NULL) {
fPluginInst->AddRef();
}
#endif
}
nsIPluginInstance* nsPluginInstancePeer::GetPluginInstance(void)
{
if (fPluginInst != NULL) {
fPluginInst->AddRef();
return fPluginInst;
}
return NULL;
}
NPP
nsPluginInstancePeer::GetNPP(void)
{
return fNPP;
}
JSContext *
nsPluginInstancePeer::GetJSContext(void)
{
MWContext *pMWCX = GetMWContext();
JSContext *pJSCX = NULL;
if (!pMWCX || (pMWCX->type != MWContextBrowser && pMWCX->type != MWContextPane))
{
return 0;
}
if( pMWCX->mocha_context != NULL)
{
pJSCX = pMWCX->mocha_context;
}
else
{
pJSCX = LM_GetCrippledContext();
}
return pJSCX;
}
MWContext *
nsPluginInstancePeer::GetMWContext(void)
{
np_instance* instance = (np_instance*) fNPP->ndata;
MWContext *pMWCX = instance->cx;
return pMWCX;
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -1,121 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsPluginInstancePeer_h__
#define nsPluginInstancePeer_h__
#include "nsIPluginInstancePeer.h"
#include "nsILiveConnectPlugInstPeer.h"
#include "nsIWindowlessPlugInstPeer.h"
#include "npglue.h"
typedef struct JSContext JSContext;
class nsPluginTagInfo;
class nsPluginInstancePeer : public nsIPluginInstancePeer,
public nsILiveConnectPluginInstancePeer,
public nsIWindowlessPluginInstancePeer
{
public:
////////////////////////////////////////////////////////////////////////////
// from nsIPluginInstancePeer:
NS_IMETHOD
GetValue(nsPluginInstancePeerVariable variable, void *value);
// (Corresponds to NPP_New's MIMEType argument.)
NS_IMETHOD
GetMIMEType(nsMIMEType *result);
// (Corresponds to NPP_New's mode argument.)
NS_IMETHOD
GetMode(nsPluginMode *result);
// (Corresponds to NPN_NewStream.)
NS_IMETHOD
NewStream(nsMIMEType type, const char* target, nsIOutputStream* *result);
// (Corresponds to NPN_Status.)
NS_IMETHOD
ShowStatus(const char* message);
NS_IMETHOD
SetWindowSize(PRUint32 width, PRUint32 height);
////////////////////////////////////////////////////////////////////////////
// from nsIJRILiveConnectPluginInstancePeer:
// (Corresponds to NPN_GetJavaPeer.)
NS_IMETHOD
GetJavaPeer(jobject *result);
////////////////////////////////////////////////////////////////////////////
// from nsIWindowlessPluginInstancePeer:
// (Corresponds to NPN_InvalidateRect.)
NS_IMETHOD
InvalidateRect(nsPluginRect *invalidRect);
// (Corresponds to NPN_InvalidateRegion.)
NS_IMETHOD
InvalidateRegion(nsPluginRegion invalidRegion);
// (Corresponds to NPN_ForceRedraw.)
NS_IMETHOD
ForceRedraw(void);
////////////////////////////////////////////////////////////////////////////
// nsPluginInstancePeer specific methods:
nsPluginInstancePeer(NPP npp);
virtual ~nsPluginInstancePeer(void);
NS_DECL_ISUPPORTS
void SetPluginInstance(nsIPluginInstance* inst);
nsIPluginInstance* GetPluginInstance(void);
NPP GetNPP(void);
JSContext *GetJSContext(void);
MWContext *GetMWContext(void);
protected:
// NPP is the old plugin structure. If we were implementing this
// from scratch we wouldn't use it, but for now we're calling the old
// npglue.cpp routines wherever possible.
NPP fNPP;
nsIPluginInstance* fPluginInst;
nsPluginTagInfo* fTagInfo;
};
#define NS_PLUGININSTANCEPEER_CID \
{ /* 766432d0-01ba-11d2-815b-006008119d7a */ \
0x766432d0, \
0x01ba, \
0x11d2, \
{0x81, 0x5b, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
#endif // nsPluginInstancePeer_h__

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,180 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsPluginManager_h__
#define nsPluginManager_h__
#include "nsIPluginManager2.h"
#include "nsAgg.h"
#include "nsHashtable.h"
class nsPluginManager : public nsIPluginManager2
{
public:
////////////////////////////////////////////////////////////////////////////
// from nsIPluginManager:
NS_IMETHOD
GetValue(nsPluginManagerVariable variable, void *value);
// (Corresponds to NPN_ReloadPlugins.)
NS_IMETHOD
ReloadPlugins(PRBool reloadPages);
// (Corresponds to NPN_UserAgent.)
NS_IMETHOD
UserAgent(const char* *result);
#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);
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);
#else // !NEW_PLUGIN_STREAM_API
NS_IMETHOD
GetURL(nsISupports* peer, 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* peer, 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);
#endif // !NEW_PLUGIN_STREAM_API
////////////////////////////////////////////////////////////////////////////
// from nsIPluginManager2:
NS_IMETHOD
BeginWaitCursor(void);
NS_IMETHOD
EndWaitCursor(void);
NS_IMETHOD
SupportsURLProtocol(const char* protocol, PRBool *result);
// 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.
NS_IMETHOD
NotifyStatusChange(nsIPlugin* plugin, nsresult errorStatus);
NS_IMETHOD
FindProxyForURL(const char* url, char* *result);
////////////////////////////////////////////////////////////////////////////
// New top-level window handling calls for Mac:
NS_IMETHOD
RegisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window);
NS_IMETHOD
UnregisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window);
// Menu ID allocation calls for Mac:
NS_IMETHOD
AllocateMenuID(nsIEventHandler* handler, PRBool isSubmenu, PRInt16 *result);
NS_IMETHOD
DeallocateMenuID(nsIEventHandler* handler, PRInt16 menuID);
/**
* Indicates whether this event handler has allocated the given menu ID.
*/
NS_IMETHOD
HasAllocatedMenuID(nsIEventHandler* handler, PRInt16 menuID, PRBool *result);
#if 0
// On the mac (and most likely 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 tickle itself.
// In this case, we make sure that we give up the monitor so that
// the tickle code can notify it without freezing.
NS_IMETHOD
ProcessNextEvent(PRBool *bEventHandled);
#endif
////////////////////////////////////////////////////////////////////////////
// nsPluginManager specific methods:
NS_DECL_AGGREGATED
static NS_METHOD
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
protected:
nsPluginManager(nsISupports* outer);
virtual ~nsPluginManager(void);
#ifdef PRE_SERVICE_MANAGER
// aggregated interfaces:
nsIJVMManager* GetJVMMgr(const nsIID& aIID);
nsICapsManager* GetCapsManager(const nsIID& aIID);
#ifdef OJI
nsILiveconnect* GetLiveconnect(const nsIID& aIID);
#endif /* OJI */
nsISupports* fJVMMgr;
nsISupports* fMalloc;
nsISupports* fFileUtils;
nsISupports* fCapsManager;
nsISupports* fLiveconnect;
#endif // PRE_SERVICE_MANAGER
PRUint16 fWaiting;
void* fOldCursor;
nsHashtable* fAllocatedMenuIDs;
};
#ifdef PRE_SERVICE_MANAGER
extern nsPluginManager* thePluginManager;
#endif // PRE_SERVICE_MANAGER
#endif // nsPluginManager_h__

Просмотреть файл

@ -1,63 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsPluginManagerStream.h"
#include "npglue.h"
////////////////////////////////////////////////////////////////////////////////
// Plugin Manager Stream Interface
nsPluginManagerStream::nsPluginManagerStream(NPP npp, NPStream* pstr)
: npp(npp), pstream(pstr)
{
NS_INIT_REFCNT();
// XXX get rid of the npp instance variable if this is true
PR_ASSERT(npp == ((np_stream*)pstr->ndata)->instance->npp);
}
nsPluginManagerStream::~nsPluginManagerStream(void)
{
}
static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
NS_IMPL_ISUPPORTS(nsPluginManagerStream, kIOutputStreamIID);
NS_METHOD
nsPluginManagerStream::Close(void)
{
NPError err = npn_destroystream(npp, pstream, nsPluginReason_Done);
return (nsresult)err;
}
NS_METHOD
nsPluginManagerStream::Write(const char* aBuf, PRInt32 aOffset, PRInt32 aCount,
PRInt32 *resultingCount)
{
PR_ASSERT(aOffset == 0); // XXX need to handle the non-sequential write case
PRInt32 rslt = npn_write(npp, pstream, aCount, (void*)aBuf);
if (rslt == -1)
return NS_ERROR_FAILURE; // XXX what should this be?
*resultingCount = rslt;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -1,66 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsPluginManagerStream_h__
#define nsPluginManagerStream_h__
#include "nsIOutputStream.h"
#include "npglue.h"
class nsPluginManagerStream : public nsIOutputStream {
public:
////////////////////////////////////////////////////////////////////////////
// from nsIBaseStream:
NS_DECL_NSIBASESTREAM
////////////////////////////////////////////////////////////////////////////
// from nsIOutputStream:
/** Write data into the stream.
* @param aBuf the buffer into which the data is read
* @param aOffset the start offset of the data
* @param aCount the maximum number of bytes to read
* @return number of bytes read or an error if < 0
*/
NS_IMETHOD
Write(const char* aBuf, PRInt32 aCount, PRInt32 *resultingCount);
NS_IMETHOD Flush() {
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////
// nsPluginManagerStream specific methods:
nsPluginManagerStream(NPP npp, NPStream* pstr);
virtual ~nsPluginManagerStream(void);
NS_DECL_ISUPPORTS
protected:
NPP npp;
NPStream* pstream;
};
#endif // nsPluginManagerStream_h__

Просмотреть файл

@ -1,330 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsPluginTagInfo.h"
#ifdef OJI
#include "nsJVMPluginTagInfo.h"
#endif
#include "intl_csi.h"
#include "plstr.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
static NS_DEFINE_IID(kIJVMPluginTagInfoIID, NS_IJVMPLUGINTAGINFO_IID);
////////////////////////////////////////////////////////////////////////////////
// Plugin Tag Info Interface
nsPluginTagInfo::nsPluginTagInfo(NPP npp)
: fJVMPluginTagInfo(NULL), npp(npp), fUniqueID(0)
{
NS_INIT_AGGREGATED(NULL);
}
nsPluginTagInfo::~nsPluginTagInfo(void)
{
}
NS_IMPL_AGGREGATED(nsPluginTagInfo);
NS_METHOD
nsPluginTagInfo::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kIPluginTagInfo2IID) ||
aIID.Equals(kIPluginTagInfoIID) ||
aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*)(nsISupports*)this;
AddRef();
return NS_OK;
}
#ifdef OJI
// Aggregates...
if (fJVMPluginTagInfo == NULL)
nsJVMPluginTagInfo::Create((nsISupports*)this, kISupportsIID,
(void**)&fJVMPluginTagInfo, this);
if (fJVMPluginTagInfo &&
fJVMPluginTagInfo->QueryInterface(aIID, aInstancePtr) == NS_OK)
return NS_OK;
#endif
return NS_NOINTERFACE;
}
static char* empty_list[] = { "", NULL };
NS_METHOD
nsPluginTagInfo::GetAttributes(PRUint16& n,
const char*const*& names,
const char*const*& values)
{
np_instance* instance = (np_instance*)npp->ndata;
#if 0
// defense
PR_ASSERT( 0 != names );
PR_ASSERT( 0 != values );
if( 0 == names || 0 == values )
return 0;
#endif
if (instance->type == NP_EMBED) {
np_data* ndata = (np_data*)instance->app->np_data;
names = (const char*const*)ndata->lo_struct->attributes.names;
values = (const char*const*)ndata->lo_struct->attributes.values;
n = (PRUint16)ndata->lo_struct->attributes.n;
return NS_OK;
} else {
static char _name[] = "PALETTE";
static char* _names[1];
static char _value[] = "foreground";
static char* _values[1];
_names[0] = _name;
_values[0] = _value;
names = (const char*const*) _names;
values = (const char*const*) _values;
n = 1;
return NS_OK;
}
// random, sun-spot induced error
PR_ASSERT( 0 );
n = 0;
// const char* const* empty_list = { { '\0' } };
names = values = (const char*const*)empty_list;
return NS_ERROR_FAILURE;
}
NS_METHOD
nsPluginTagInfo::GetAttribute(const char* name, const char* *result)
{
PRUint16 nAttrs, i;
const char*const* names;
const char*const* values;
nsresult rslt = GetAttributes(nAttrs, names, values);
if (rslt != NS_OK)
return rslt;
*result = NULL;
for( i = 0; i < nAttrs; i++ ) {
if (PL_strcasecmp(name, names[i]) == 0) {
*result = values[i];
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
NS_METHOD
nsPluginTagInfo::GetTagType(nsPluginTagType *result)
{
*result = nsPluginTagType_Unknown;
switch (GetLayoutElement()->type) {
case LO_JAVA:
*result = nsPluginTagType_Applet;
return NS_OK;
case LO_EMBED:
*result = nsPluginTagType_Embed;
return NS_OK;
case LO_OBJECT:
*result = nsPluginTagType_Object;
return NS_OK;
default:
return NS_OK;
}
}
NS_METHOD
nsPluginTagInfo::GetTagText(const char* *result)
{
return NS_ERROR_NOT_IMPLEMENTED; // XXX
}
NS_METHOD
nsPluginTagInfo::GetParameters(PRUint16& n,
const char*const*& names,
const char*const*& values)
{
np_instance* instance = (np_instance*)npp->ndata;
if (instance->type == NP_EMBED) {
np_data* ndata = (np_data*)instance->app->np_data;
names = (const char*const*)ndata->lo_struct->parameters.names;
values = (const char*const*)ndata->lo_struct->parameters.values;
n = (PRUint16)ndata->lo_struct->parameters.n;
return NS_OK;
} else {
static char _name[] = "PALETTE";
static char* _names[1];
static char _value[] = "foreground";
static char* _values[1];
_names[0] = _name;
_values[0] = _value;
names = (const char*const*) _names;
values = (const char*const*) _values;
n = 1;
return NS_OK;
}
// random, sun-spot induced error
PR_ASSERT( 0 );
n = 0;
// static const char* const* empty_list = { { '\0' } };
names = values = (const char*const*)empty_list;
return NS_ERROR_FAILURE;
}
NS_METHOD
nsPluginTagInfo::GetParameter(const char* name, const char* *result)
{
PRUint16 nParams, i;
const char*const* names;
const char*const* values;
nsresult rslt = GetParameters(nParams, names, values);
if (rslt != NS_OK)
return rslt;
*result = NULL;
for( i = 0; i < nParams; i++ ) {
if (PL_strcasecmp(name, names[i]) == 0) {
*result = values[i];
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
NS_METHOD
nsPluginTagInfo::GetDocumentBase(char* *result)
{
*result = nsCRT::strdup(GetLayoutElement()->base_url);
return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_METHOD
nsPluginTagInfo::GetDocumentEncoding(const char* *result)
{
np_instance* instance = (np_instance*) npp->ndata;
MWContext* cx = instance->cx;
INTL_CharSetInfo info = LO_GetDocumentCharacterSetInfo(cx);
int16 doc_csid = INTL_GetCSIWinCSID(info);
*result = INTL_CharSetIDToJavaCharSetName(doc_csid);
return NS_OK;
}
NS_METHOD
nsPluginTagInfo::GetAlignment(const char* *result)
{
int alignment = GetLayoutElement()->alignment;
const char* cp;
switch (alignment) {
case LO_ALIGN_CENTER: cp = "abscenter"; break;
case LO_ALIGN_LEFT: cp = "left"; break;
case LO_ALIGN_RIGHT: cp = "right"; break;
case LO_ALIGN_TOP: cp = "texttop"; break;
case LO_ALIGN_BOTTOM: cp = "absbottom"; break;
case LO_ALIGN_NCSA_CENTER: cp = "center"; break;
case LO_ALIGN_NCSA_BOTTOM: cp = "bottom"; break;
case LO_ALIGN_NCSA_TOP: cp = "top"; break;
default: cp = "baseline"; break;
}
*result = cp;
return NS_OK;
}
NS_METHOD
nsPluginTagInfo::GetWidth(PRUint32 *result)
{
LO_CommonPluginStruct* lo = GetLayoutElement();
*result = lo->width ? lo->width : 50;
return NS_OK;
}
NS_METHOD
nsPluginTagInfo::GetHeight(PRUint32 *result)
{
LO_CommonPluginStruct* lo = GetLayoutElement();
*result = lo->height ? lo->height : 50;
return NS_OK;
}
NS_METHOD
nsPluginTagInfo::GetBorderVertSpace(PRUint32 *result)
{
*result = GetLayoutElement()->border_vert_space;
return NS_OK;
}
NS_METHOD
nsPluginTagInfo::GetBorderHorizSpace(PRUint32 *result)
{
*result = GetLayoutElement()->border_horiz_space;
return NS_OK;
}
NS_METHOD
nsPluginTagInfo::GetUniqueID(PRUint32 *result)
{
if (fUniqueID == 0) {
np_instance* instance = (np_instance*) npp->ndata;
MWContext* cx = instance->cx;
History_entry* history_element = SHIST_GetCurrent(&cx->hist);
if (history_element) {
fUniqueID = history_element->unique_id;
} else {
/*
** XXX What to do? This can happen for instance when printing a
** mail message that contains an applet.
*/
static int32 unique_number;
fUniqueID = --unique_number;
}
PR_ASSERT(fUniqueID != 0);
}
*result = fUniqueID;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -1,126 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsPluginTagInfo_h__
#define nsPluginTagInfo_h__
#include "nsIPluginTagInfo2.h"
#include "nsAgg.h"
#include "npglue.h"
class nsPluginTagInfo : public nsIPluginTagInfo2 {
public:
////////////////////////////////////////////////////////////////////////////
// from nsIPluginTagInfo:
// 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);
// Get the value for the named attribute. Returns null
// if the attribute was not set.
NS_IMETHOD
GetAttribute(const char* name, const char* *result);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginTagInfo2:
// 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);
// Get the complete text of the HTML tag that was
// used to instantiate this plugin
NS_IMETHOD
GetTagText(const char * *result);
// 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);
// Get the value for the named parameter. Returns null
// if the parameter was not set.
NS_IMETHOD
GetParameter(const char* name, const char* *result);
NS_IMETHOD
GetDocumentBase(char* *result);
// 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);
NS_IMETHOD
GetAlignment(const char* *result);
NS_IMETHOD
GetWidth(PRUint32 *result);
NS_IMETHOD
GetHeight(PRUint32 *result);
NS_IMETHOD
GetBorderVertSpace(PRUint32 *result);
NS_IMETHOD
GetBorderHorizSpace(PRUint32 *result);
// Returns a unique id for the current document on which the
// plugin is displayed.
NS_IMETHOD
GetUniqueID(PRUint32 *result);
////////////////////////////////////////////////////////////////////////////
// nsPluginTagInfo specific methods:
nsPluginTagInfo(NPP npp);
virtual ~nsPluginTagInfo(void);
NS_DECL_AGGREGATED
protected:
LO_CommonPluginStruct* GetLayoutElement(void)
{
np_instance* instance = (np_instance*) npp->ndata;
NPEmbeddedApp* app = instance->app;
np_data* ndata = (np_data*) app->np_data;
return (LO_CommonPluginStruct*)ndata->lo_struct;
}
// aggregated interfaces:
nsISupports* fJVMPluginTagInfo;
NPP npp;
PRUint32 fUniqueID;
};
#endif // nsPluginTagInfo_h__

Разница между файлами не показана из-за своего большого размера Загрузить разницу