Back to index

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

Go to the source code of this file.

Functions

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_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_GetValue (NPP instance, NPPVariable variable, void *value)
NPError NPP_SetValue (NPP instance, NPNVariable variable, void *value)
int16 NPP_HandleEvent (NPP instance, void *event)

Function Documentation

NPError NPP_Destroy ( NPP  instance,
NPSavedData **  save 
)

Definition at line 77 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin != NULL) {
    plugin->shut();
    NS_DestroyPluginInstance(plugin);
  }
  return rv;
}

Here is the call graph for this function:

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

Definition at line 172 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return NPERR_GENERIC_ERROR;

  NPError rv = plugin->DestroyStream(stream, reason);
  return rv;
}

Here is the call graph for this function:

NPError NPP_GetValue ( NPP  instance,
NPPVariable  variable,
void value 
)

Definition at line 221 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return NPERR_GENERIC_ERROR;

  NPError rv = plugin->GetValue(variable, value);
  return rv;
}

Here is the call graph for this function:

int16 NPP_HandleEvent ( NPP  instance,
void event 
)

Definition at line 247 of file npp_gate.cpp.

{
  if(instance == NULL)
    return 0;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return 0;

  uint16 rv = plugin->HandleEvent(event);
  return rv;
}

Here is the call graph for this function:

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

Definition at line 48 of file npp_gate.cpp.

{   
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  NPError rv = NPERR_NO_ERROR;

  // create a new plugin instance object
  // initialization will be done when the associated window is ready
  nsPluginCreateData ds;
  
  ds.instance = instance;
  ds.type     = pluginType; 
  ds.mode     = mode; 
  ds.argc     = argc; 
  ds.argn     = argn; 
  ds.argv     = argv; 
  ds.saved    = saved;

  nsPluginInstanceBase * plugin = NS_NewPluginInstance(&ds);
  if(plugin == NULL)
    return NPERR_OUT_OF_MEMORY_ERROR;

  // associate the plugin instance object with NPP instance
  instance->pdata = (void *)plugin;
  return rv;
}

Here is the call graph for this function:

NPError NPP_NewStream ( NPP  instance,
NPMIMEType  type,
NPStream stream,
NPBool  seekable,
uint16 stype 
)

Definition at line 133 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return NPERR_GENERIC_ERROR;

  NPError rv = plugin->NewStream(type, stream, seekable, stype);
  return rv;
}

Here is the call graph for this function:

void NPP_Print ( NPP  instance,
NPPrint printInfo 
)

Definition at line 197 of file npp_gate.cpp.

{
  if(instance == NULL)
    return;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return;

  plugin->Print(printInfo);
}

Here is the call graph for this function:

NPError NPP_SetValue ( NPP  instance,
NPNVariable  variable,
void value 
)

Definition at line 234 of file npp_gate.cpp.

{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return NPERR_GENERIC_ERROR;

  NPError rv = plugin->SetValue(variable, value);
  return rv;
}

Here is the call graph for this function:

NPError NPP_SetWindow ( NPP  instance,
NPWindow pNPWindow 
)

Definition at line 95 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;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;

  if(plugin == NULL) 
    return NPERR_GENERIC_ERROR;

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

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

  // window resized?
  if(plugin->isInitialized() && (pNPWindow->window != NULL))
    return plugin->SetWindow(pNPWindow);

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

  return rv;
}

Here is the call graph for this function:

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

Definition at line 185 of file npp_gate.cpp.

{
  if(instance == NULL)
    return;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return;

  plugin->StreamAsFile(stream, fname);
}

Here is the call graph for this function:

void NPP_URLNotify ( NPP  instance,
const char *  url,
NPReason  reason,
void notifyData 
)

Definition at line 209 of file npp_gate.cpp.

{
  if(instance == NULL)
    return;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return;

  plugin->URLNotify(url, reason, notifyData);
}

Here is the call graph for this function:

int32 NPP_Write ( NPP  instance,
NPStream stream,
int32  offset,
int32  len,
void buffer 
)

Definition at line 159 of file npp_gate.cpp.

{   
  if(instance == NULL)
    return len;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return len;

  int32 rv = plugin->Write(stream, offset, len, buffer);
  return rv;
}

Here is the call graph for this function:

int32 NPP_WriteReady ( NPP  instance,
NPStream stream 
)

Definition at line 146 of file npp_gate.cpp.

{
  if(instance == NULL)
    return 0x0fffffff;

  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
  if(plugin == NULL) 
    return 0x0fffffff;

  int32 rv = plugin->WriteReady(stream);
  return rv;
}

Here is the call graph for this function: