Back to index

lightning-sunbird  0.9+nobinonly
Functions
npp_gate.cpp File Reference
#include "plugin.h"

Go to the source code of this file.

Functions

NPError NPP_Initialize (void)
void NPP_Shutdown (void)
NPError NPP_New (NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
NPError NPP_Destroy (NPP instance, NPSavedData **save)
NPError NPP_SetWindow (NPP instance, NPWindow *pNPWindow)
NPError NPP_GetValue (NPP instance, NPPVariable variable, void *value)
NPError NPP_NewStream (NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
int32 NPP_WriteReady (NPP instance, NPStream *stream)
int32 NPP_Write (NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
NPError NPP_DestroyStream (NPP instance, NPStream *stream, NPError reason)
void NPP_StreamAsFile (NPP instance, NPStream *stream, const char *fname)
void NPP_Print (NPP instance, NPPrint *printInfo)
void NPP_URLNotify (NPP instance, const char *url, NPReason reason, void *notifyData)
NPError NPP_SetValue (NPP instance, NPNVariable variable, void *value)
int16 NPP_HandleEvent (NPP instance, void *event)
jref NPP_GetJavaClass (void)

Function Documentation

NPError NPP_Destroy ( NPP  instance,
NPSavedData **  save 
)

Definition at line 79 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;

  CPlugin * pPlugin = (CPlugin *)instance->pdata;
  if(pPlugin != NULL) {
    pPlugin->shut();
    delete pPlugin;
  }
  return rv;
}

Here is the call graph for this function:

NPError NPP_DestroyStream ( NPP  instance,
NPStream stream,
NPError  reason 
)

Definition at line 213 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;
  return rv;
}

Definition at line 262 of file npp_gate.cpp.

{
  return NULL;
}
NPError NPP_GetValue ( NPP  instance,
NPPVariable  variable,
void value 
)

Definition at line 145 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;

  if(instance == NULL)
    return NPERR_GENERIC_ERROR;

  CPlugin * pPlugin = (CPlugin *)instance->pdata;
  if(pPlugin == NULL)
    return NPERR_GENERIC_ERROR;

  if (variable == NPPVpluginScriptableInstance) {
    // addref happens in getter, so we don't addref here
    nsI4xScriptablePlugin * scriptablePeer = pPlugin->getScriptablePeer();
    if (scriptablePeer) {
      *(nsISupports **)value = scriptablePeer;
    } else {
      rv = NPERR_OUT_OF_MEMORY_ERROR;
    }
  }
  else if (variable == NPPVpluginScriptableIID) {
    static nsIID scriptableIID = NS_I4XSCRIPTABLEPLUGIN_IID;
    nsIID* ptr = (nsIID *)NPN_MemAlloc(sizeof(nsIID));
    if (ptr) {
        *ptr = scriptableIID;
        *(nsIID **)value = ptr;
    } else {
      rv = NPERR_OUT_OF_MEMORY_ERROR;
    }
  }

  return rv;
}

Here is the call graph for this function:

int16 NPP_HandleEvent ( NPP  instance,
void event 
)

Definition at line 249 of file npp_gate.cpp.

{
  if(instance == NULL)
    return 0;

  int16 rv = 0;
  CPlugin * pPlugin = (CPlugin *)instance->pdata;
  if (pPlugin)
    rv = pPlugin->handleEvent(event);

  return rv;
}

Here is the call graph for this function:

Definition at line 45 of file npp_gate.cpp.

{
    return NPERR_NO_ERROR;
}
NPError NPP_New ( NPMIMEType  pluginType,
NPP  instance,
uint16  mode,
int16  argc,
char *  argn[],
char *  argv[],
NPSavedData saved 
)

Definition at line 57 of file npp_gate.cpp.

{   
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;

  CPlugin * pPlugin = new CPlugin(instance);
  if(pPlugin == NULL)
    return NPERR_OUT_OF_MEMORY_ERROR;

  instance->pdata = (void *)pPlugin;
  return rv;
}
NPError NPP_NewStream ( NPP  instance,
NPMIMEType  type,
NPStream stream,
NPBool  seekable,
uint16 stype 
)

Definition at line 182 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;
  return rv;
}
void NPP_Print ( NPP  instance,
NPPrint printInfo 
)

Definition at line 228 of file npp_gate.cpp.

{
  if(instance == NULL)
    return;
}
NPError NPP_SetValue ( NPP  instance,
NPNVariable  variable,
void value 
)

Definition at line 240 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;
  return rv;
}
NPError NPP_SetWindow ( NPP  instance,
NPWindow pNPWindow 
)

Definition at line 97 of file npp_gate.cpp.

{    
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;

  if(pNPWindow == NULL)
    return NPERR_GENERIC_ERROR;

  CPlugin * pPlugin = (CPlugin *)instance->pdata;

  if(pPlugin == NULL) 
    return NPERR_GENERIC_ERROR;

  // window just created
  if(!pPlugin->isInitialized() && (pNPWindow->window != NULL)) { 
    if(!pPlugin->init(pNPWindow)) {
      delete pPlugin;
      pPlugin = NULL;
      return NPERR_MODULE_LOAD_FAILED_ERROR;
    }
  }

  // window goes away
  if((pNPWindow->window == NULL) && pPlugin->isInitialized())
    return NPERR_NO_ERROR;

  // window resized
  if(pPlugin->isInitialized() && (pNPWindow->window != NULL))
    return NPERR_NO_ERROR;

  // this should not happen, nothing to do
  if((pNPWindow->window == NULL) && !pPlugin->isInitialized())
    return NPERR_NO_ERROR;

  return rv;
}

Here is the call graph for this function:

Definition at line 50 of file npp_gate.cpp.

{
}
void NPP_StreamAsFile ( NPP  instance,
NPStream stream,
const char *  fname 
)

Definition at line 222 of file npp_gate.cpp.

{
  if(instance == NULL)
    return;
}
void NPP_URLNotify ( NPP  instance,
const char *  url,
NPReason  reason,
void notifyData 
)

Definition at line 234 of file npp_gate.cpp.

{
  if(instance == NULL)
    return;
}
int32 NPP_Write ( NPP  instance,
NPStream stream,
int32  offset,
int32  len,
void buffer 
)

Definition at line 204 of file npp_gate.cpp.

{   
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  int32 rv = len;
  return rv;
}
int32 NPP_WriteReady ( NPP  instance,
NPStream stream 
)

Definition at line 195 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  int32 rv = 0x0fffffff;
  return rv;
}