Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
NPPEntryPointManager Class Reference

#include <epmanager.h>

Collaboration diagram for NPPEntryPointManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void createEntryPointsForPlugin (char *mimetype, NPPluginFuncs *funcs, NP_SHUTDOWN shutdownproc, XP_HLIB hLib)
void removeEntryPointsForPlugin (NPP instance, XP_HLIB *lib)
NPPluginFuncsfindEntryPointsForPlugin (char *mimetype)
 NPPEntryPointManager ()
 ~NPPEntryPointManager ()
void callNP_Shutdown (NPP instance)
void callNP_ShutdownAll ()
NPError callNPP_New (NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
NPError callNPP_Destroy (NPP instance, NPSavedData **save, BOOL *last)
NPError callNPP_SetWindow (NPP instance, NPWindow *window)
NPError callNPP_NewStream (NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
NPError callNPP_DestroyStream (NPP instance, NPStream *stream, NPReason reason)
int32 callNPP_WriteReady (NPP instance, NPStream *stream)
int32 callNPP_Write (NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
void callNPP_StreamAsFile (NPP instance, NPStream *stream, const char *fname)
void callNPP_Print (NPP instance, NPPrint *platformPrint)
void callNPP_URLNotify (NPP instance, const char *url, NPReason reason, void *notifyData)
jref callNPP_GetJavaClass (void)
NPError callNPP_GetValue (NPP instance, NPPVariable variable, void *value)
NPError callNPP_SetValue (NPP instance, NPNVariable variable, void *value)
int16 callNPP_HandleEvent (NPP instance, void *event)

Private Member Functions

NPPluginFuncsfindEntryPointsForInstance (NPP instance)

Private Attributes

PluginEntryPointListmEntryPoints

Detailed Description

Definition at line 70 of file epmanager.h.


Constructor & Destructor Documentation

Definition at line 69 of file epmanager.cpp.

Definition at line 74 of file epmanager.cpp.

{
  for(PluginEntryPointList * eps = mEntryPoints; eps != NULL;)
  {
    for(InstanceList * instances = eps->instances; instances != NULL;)
    {
      InstanceList * next = instances->next;
      delete instances;
      instances = next;
    }

    PluginEntryPointList * next = eps->next;
    delete eps;
    eps = next;
  }
}

Member Function Documentation

Definition at line 189 of file epmanager.cpp.

{
  for(PluginEntryPointList * eps = mEntryPoints; eps != NULL; eps = eps->next)
  {
    for(InstanceList * instances = eps->instances; instances != NULL; instances = instances->next)
    {
      if(instances->instance == instance)
      {
        if(eps->realShutdown)
        {
          logger->logSPY_NP_Shutdown(eps->mimetype);
          eps->realShutdown();
          eps->realShutdown = NULL; // don't want to call it more than once
        }
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 176 of file epmanager.cpp.

{
  for(PluginEntryPointList * eps = mEntryPoints; eps != NULL; eps = eps->next)
  {
    if(eps->realShutdown)
    {
      logger->logSPY_NP_Shutdown(eps->mimetype);
      eps->realShutdown();
      eps->realShutdown = NULL; // don't want to call it more than once
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

NPError NPPEntryPointManager::callNPP_Destroy ( NPP  instance,
NPSavedData **  save,
BOOL last 
)

Definition at line 236 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = NULL;

  BOOL done = FALSE;

  for(PluginEntryPointList * eps = mEntryPoints; eps != NULL; eps = eps->next)
  {
    InstanceList * prev = NULL;
    for(InstanceList * instances = eps->instances; instances != NULL; instances = instances->next)
    {
      if(instances->instance == instance)
      {
        nppfuncs = &eps->realNPPFuncs;
        done = TRUE;

        // check if this is the last one
        if(eps->instances->next == NULL) 
          *last = TRUE;
        else
        {
          // deassociate instance if this is not the last one
          // last instance will be needed to find corresponding shutdown proc
          if(prev)
            prev->next = instances->next;
          else
            eps->instances = instances->next;

          delete instances;
        }

        break;
      }
      prev = instances;
    }
    if(done)
      break;
  }

  if(!nppfuncs || !nppfuncs->destroy)
    return NPERR_GENERIC_ERROR;

  return CallNPP_DestroyProc(nppfuncs->destroy, instance, save);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 299 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->destroystream)
    return NPERR_GENERIC_ERROR;

  return CallNPP_DestroyStreamProc(nppfuncs->destroystream, instance, stream, reason);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NPError NPPEntryPointManager::callNPP_GetValue ( NPP  instance,
NPPVariable  variable,
void value 
)

Definition at line 353 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->getvalue)
    return NPERR_GENERIC_ERROR;

  return CallNPP_GetValueProc(nppfuncs->getvalue, instance, variable, value);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 371 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->event)
    return NPERR_GENERIC_ERROR;

  return CallNPP_HandleEventProc(nppfuncs->event, instance, event);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 208 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = NULL;

  for(PluginEntryPointList * eps = mEntryPoints; eps != NULL; eps = eps->next)
  {
    if(0 == stricmp(eps->mimetype, pluginType))
    {
      nppfuncs = &eps->realNPPFuncs;

      // now we should associate this plugin instance with plugin entry points
      // so that later we could find entry points by instance rather than by mimetype
      InstanceList * inst = new InstanceList(instance);
      inst->next = eps->instances;
      eps->instances = inst;

      break;
    }
  }

  if(!nppfuncs || !nppfuncs->newp)
    return NPERR_GENERIC_ERROR;

  NPError rv = CallNPP_NewProc(nppfuncs->newp, pluginType, instance, mode, argc, argn, argv, saved);

  return rv;
}

Here is the caller graph for this function:

NPError NPPEntryPointManager::callNPP_NewStream ( NPP  instance,
NPMIMEType  type,
NPStream stream,
NPBool  seekable,
uint16 stype 
)

Definition at line 290 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->newstream)
    return NPERR_GENERIC_ERROR;

  return CallNPP_NewStreamProc(nppfuncs->newstream, instance, type, stream, seekable, stype);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NPPEntryPointManager::callNPP_Print ( NPP  instance,
NPPrint platformPrint 
)

Definition at line 335 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->print)
    return;

  CallNPP_PrintProc(nppfuncs->print, instance, platformPrint);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NPError NPPEntryPointManager::callNPP_SetValue ( NPP  instance,
NPNVariable  variable,
void value 
)

Definition at line 362 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->setvalue)
    return NPERR_GENERIC_ERROR;

  return CallNPP_SetValueProc(nppfuncs->setvalue, instance, variable, value);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 281 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->setwindow)
    return NPERR_GENERIC_ERROR;

  return CallNPP_SetWindowProc(nppfuncs->setwindow, instance, window);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NPPEntryPointManager::callNPP_StreamAsFile ( NPP  instance,
NPStream stream,
const char *  fname 
)

Definition at line 326 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->asfile)
    return;

  CallNPP_StreamAsFileProc(nppfuncs->asfile, instance, stream, fname);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NPPEntryPointManager::callNPP_URLNotify ( NPP  instance,
const char *  url,
NPReason  reason,
void notifyData 
)

Definition at line 344 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->urlnotify)
    return;

  CallNPP_URLNotifyProc(nppfuncs->urlnotify, instance, url, reason, notifyData);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int32 NPPEntryPointManager::callNPP_Write ( NPP  instance,
NPStream stream,
int32  offset,
int32  len,
void buffer 
)

Definition at line 317 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->write)
    return NPERR_GENERIC_ERROR;

  return CallNPP_WriteProc(nppfuncs->write, instance, stream, offset, len, buffer);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 308 of file epmanager.cpp.

{
  NPPluginFuncs * nppfuncs = findEntryPointsForInstance(instance);
  if(!nppfuncs || !nppfuncs->writeready)
    return NPERR_GENERIC_ERROR;

  return CallNPP_WriteReadyProc(nppfuncs->writeready, instance, stream);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NPPEntryPointManager::createEntryPointsForPlugin ( char *  mimetype,
NPPluginFuncs funcs,
NP_SHUTDOWN  shutdownproc,
XP_HLIB  hLib 
)

Definition at line 91 of file epmanager.cpp.

{
  PluginEntryPointList * eps = new PluginEntryPointList();

  if(eps == NULL)
    return;

  strcpy(eps->mimetype, mimetype);

  if(funcs)
  {
    eps->realNPPFuncs.size          = funcs->size;
    eps->realNPPFuncs.version       = funcs->version;
    eps->realNPPFuncs.newp          = funcs->newp;
    eps->realNPPFuncs.destroy       = funcs->destroy;
    eps->realNPPFuncs.setwindow     = funcs->setwindow;
    eps->realNPPFuncs.newstream     = funcs->newstream;
    eps->realNPPFuncs.destroystream = funcs->destroystream;
    eps->realNPPFuncs.asfile        = funcs->asfile;
    eps->realNPPFuncs.writeready    = funcs->writeready;
    eps->realNPPFuncs.write         = funcs->write;
    eps->realNPPFuncs.print         = funcs->print;
    eps->realNPPFuncs.event         = funcs->event;
    eps->realNPPFuncs.urlnotify     = funcs->urlnotify;
    eps->realNPPFuncs.javaClass     = funcs->javaClass;
    eps->realNPPFuncs.getvalue      = funcs->getvalue;
    eps->realNPPFuncs.setvalue      = funcs->setvalue;
  }

  eps->realShutdown = shutdownproc;
  eps->hLib = hLib;

  eps->next = mEntryPoints;
  mEntryPoints = eps;
}

Here is the caller graph for this function:

Definition at line 162 of file epmanager.cpp.

{
  for(PluginEntryPointList * eps = mEntryPoints; eps != NULL; eps = eps->next)
  {
    for(InstanceList * instances = eps->instances; instances != NULL; instances = instances->next)
    {
      if(instances->instance == instance)
        return &eps->realNPPFuncs;
    }
  }

  return NULL;
}

Here is the caller graph for this function:

Definition at line 151 of file epmanager.cpp.

{
  for(PluginEntryPointList * eps = mEntryPoints; eps != NULL; eps = eps->next)
  {
    if(0 == stricmp(eps->mimetype, mimetype))
      return &eps->realNPPFuncs;
  }

  return NULL;
}

Here is the caller graph for this function:

void NPPEntryPointManager::removeEntryPointsForPlugin ( NPP  instance,
XP_HLIB *  lib 
)

Definition at line 127 of file epmanager.cpp.

{
  NPPluginFuncs * eptoremove = findEntryPointsForInstance(instance);

  PluginEntryPointList * prev = NULL;

  for(PluginEntryPointList * eps = mEntryPoints; eps != NULL; eps = eps->next)
  {
    if(&eps->realNPPFuncs == eptoremove)
    {
      if(prev)
        prev->next = eps->next;
      else
        mEntryPoints = eps->next;

      *lib = eps->hLib;
      delete eps;
      return;
    }

    prev = eps;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 73 of file epmanager.h.


The documentation for this class was generated from the following files: