src/npp_gate.cpp
NPError NPP_New(NPMIMEType pluginType,
                NPP instance,
                uint16_t mode,
                int16_t argc,
                char* argn[],
                char* argv[],
                NPSavedData* saved)
{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

#ifdef XP_MACOSX
  // Setting Core Graphics drawing is required for the plugin to load in
  // modern browsers, because the default QuickDraw mode is no longer
  // supported. We don't actually care whether setting this succeeds, because
  // we don't draw.
  NPNFuncs.setvalue(instance, NPPVpluginDrawingModel,
                    (void*)NPDrawingModelCoreGraphics);
  // http://crbug.com/139816 suggests that the Cocoa event model will soon be
  // required too.
  NPNFuncs.setvalue(instance, NPPVpluginEventModel, (void*) NPEventModelCocoa);
#endif

  NPError rv = NPERR_NO_ERROR;

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

  instance->pdata = (void *)pPlugin;
  return rv;
}
// here the plugin creates an instance of our CPlugin object which
// will be associated with this newly created plugin instance and
// will do all the neccessary job

here the plugin creates an instance of our CPlugin object which
will be associated with this newly created plugin instance and
will do all the neccessary job
here the plugin creates an instance of our CPlugin object which will be associated with this newly created plugin instance and will do all the neccessary job
NPError NPP_New(NPMIMEType pluginType,
                NPP instance,
                uint16_t mode,
                int16_t argc,
                char* argn[],
                char* argv[],
                NPSavedData* saved)
{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;
#ifdef XP_MACOSX
  NPNFuncs.setvalue(instance, NPPVpluginDrawingModel,
                    (void*)NPDrawingModelCoreGraphics);
  NPNFuncs.setvalue(instance, NPPVpluginEventModel, (void*) NPEventModelCocoa);
#endif
  NPError rv = NPERR_NO_ERROR;
  Plugin * pPlugin = new Plugin(instance);
  if(pPlugin == NULL)
    return NPERR_OUT_OF_MEMORY_ERROR;
  instance->pdata = (void *)pPlugin;
  return rv;
}
NPError NPP_New ( NPMIMEType pluginType , NPP instance , uint16_t mode , int16_t argc , char * argn [ ] , char * argv [ ] , NPSavedData * saved ) { if ( instance == NULL ) return NPERR_INVALID_INSTANCE_ERROR ; #ifdef XP_MACOSX NPNFuncs . setvalue ( instance , NPPVpluginDrawingModel , ( void * ) NPDrawingModelCoreGraphics ) ; NPNFuncs . setvalue ( instance , NPPVpluginEventModel , ( void * ) NPEventModelCocoa ) ; #endif NPError rv = NPERR_NO_ERROR ; Plugin * pPlugin = new Plugin ( instance ) ; if ( pPlugin == NULL ) return NPERR_OUT_OF_MEMORY_ERROR ; instance -> pdata = ( void * ) pPlugin ; return rv ; }
here the plugin creates an instance of our CPlugin object which
will be associated with this newly created plugin instance and
will do all the neccessary job
here the plugin creates an instance of our CPlugin object which will be associated with this newly created plugin instance and will do all the neccessary job
// Setting Core Graphics drawing is required for the plugin to load in
 // modern browsers, because the default QuickDraw mode is no longer
 // supported. We don't actually care whether setting this succeeds, because
 // we don't draw.
 // http://crbug.com/139816 suggests that the Cocoa event model will soon be
 // required too.
