NS_METHOD CPluginInstancePeer::Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor) { NPN_Version(plugin_major, plugin_minor, netscape_major, netscape_minor); return NS_OK; }
// Verifies the version of the NPAPI. // The eventListeners use a NPAPI function available // since Gecko 1.9. bool VlcPluginBase::canUseEventListener() { int plugin_major, plugin_minor; int browser_major, browser_minor; NPN_Version(&plugin_major, &plugin_minor, &browser_major, &browser_minor); if (browser_minor >= 19 || browser_major > 0) return true; return false; }
/*! Returns the version information - the version of the plugin API, and the version of the browser. See also: <a href=http://developer.netscape.com/library/documentation/communicator/plugin/refpgve.htm#npnversion> Netscape: NPN_Version method</a> */ void QNPlugin::getVersionInfo(int& plugin_major, int& plugin_minor, int& browser_major, int& browser_minor) { NPN_Version(&plugin_major, &plugin_minor, &browser_major, &browser_minor); }
/*! Extracts the version of the browser into \a major and \a minor. See http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/ for an explanation of those values. \sa getNppVersion() userAgent() */ void QtNPBindable::getBrowserVersion(int *major, int *minor) const { int dummy = 0; if (pi) NPN_Version(&dummy, &dummy, major, minor); }
/*! Extracts the version of the plugin API used by this plugin into \a major and \a minor. See http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/ for an explanation of those values. \sa getBrowserVersion() userAgent() */ void QtNPBindable::getNppVersion(int *major, int *minor) const { int dummy = 0; if (pi) NPN_Version(major, minor, &dummy, &dummy); }
DWORD CPluginBase::makeNPNCall(NPAPI_Action action, DWORD dw1, DWORD dw2, DWORD dw3, DWORD dw4, DWORD dw5, DWORD dw6, DWORD dw7) { DWORD dwRet = 0L; DWORD dwTickEnter = XP_GetTickCount(); switch (action) { case action_invalid: assert(0); break; case action_npn_version: { static int iP_maj = 0; static int iP_min = 0; static int iN_maj = 0; static int iN_min = 0; if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)&iP_maj; if(dw2 == DEFAULT_DWARG_VALUE) dw2 = (DWORD)&iP_min; if(dw3 == DEFAULT_DWARG_VALUE) dw3 = (DWORD)&iN_maj; if(dw4 == DEFAULT_DWARG_VALUE) dw4 = (DWORD)&iN_min; NPN_Version((int *)dw1, (int *)dw2, (int *)dw3, (int *)dw4); break; } case action_npn_get_url_notify: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; dwRet = NPN_GetURLNotify((NPP)dw1, (char *)dw2, (char *)dw3, (void *)dw4); break; case action_npn_get_url: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; dwRet = NPN_GetURL((NPP)dw1, (char *)dw2, (char *)dw3); break; case action_npn_post_url_notify: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; dwRet = NPN_PostURLNotify((NPP)dw1, (char *)dw2, (char *)dw3, (int32)dw4, (char *)dw5, (BOOL)dw6, (void *)dw7); break; case action_npn_post_url: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; dwRet = NPN_PostURL((NPP)dw1, (char *)dw2, (char *)dw3, (int32)dw4, (char *)dw5, (BOOL)dw6); break; case action_npn_new_stream: assert(m_pStream == NULL); if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; if(dw4 == DEFAULT_DWARG_VALUE) dw4 = (DWORD)&m_pStream; dwRet = NPN_NewStream((NPP)dw1, (char *)dw2, (char *)dw3, (NPStream **)dw4); break; case action_npn_destroy_stream: assert(m_pStream != NULL); if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; if(dw2 == DEFAULT_DWARG_VALUE) dw2 = (DWORD)m_pStream; dwRet = NPN_DestroyStream((NPP)dw1, (NPStream *)dw2, (NPError)dw3); m_pStream = NULL; break; case action_npn_request_read: break; case action_npn_write: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; if(dw2 == DEFAULT_DWARG_VALUE) dw2 = (DWORD)m_pStream; dwRet = NPN_Write((NPP)dw1, (NPStream *)dw2, (int32)dw3, (void *)dw4); break; case action_npn_status: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; NPN_Status((NPP)dw1, (char *)dw2); break; case action_npn_user_agent: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; dwRet = (DWORD)NPN_UserAgent((NPP)dw1); break; case action_npn_mem_alloc: assert(m_pNPNAlloced == NULL); m_pNPNAlloced = NPN_MemAlloc((int32)dw1); dwRet = (DWORD)m_pNPNAlloced; if(m_pNPNAlloced != NULL) { for(int i = 0; i < (int)dw1; i++) *(((BYTE *)m_pNPNAlloced) + i) = 255; } break; case action_npn_mem_free: assert(m_pNPNAlloced != NULL); dw1 = (DWORD)m_pNPNAlloced; NPN_MemFree((void *)dw1); m_pNPNAlloced = NULL; break; case action_npn_mem_flush: dwRet = (DWORD)NPN_MemFlush((int32)dw1); break; case action_npn_reload_plugins: NPN_ReloadPlugins((NPBool)dw1); break; case action_npn_get_java_env: dwRet = (DWORD)NPN_GetJavaEnv(); break; case action_npn_get_java_peer: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; dwRet = (DWORD)NPN_GetJavaPeer((NPP)dw1); break; case action_npn_get_value: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; if(dw3 == DEFAULT_DWARG_VALUE) dw3 = (DWORD)m_pValue; dwRet = (DWORD)NPN_GetValue((NPP)dw1, (NPNVariable)dw2, (void *)dw3); break; case action_npn_set_value: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; if(dw3 == DEFAULT_DWARG_VALUE) dw3 = (DWORD)m_pValue; // note that Mozilla expects boolean values not as a pointer to BOOL // but rather as simply null and not null, let's convert if((dw2 == NPPVpluginWindowBool) || (dw2 == NPPVpluginTransparentBool) || (dw2 == NPPVpluginKeepLibraryInMemory)) { dwRet = (DWORD)NPN_SetValue((NPP)dw1, (NPPVariable)dw2, (void *)(*(BOOL *)dw3)); } else dwRet = (DWORD)NPN_SetValue((NPP)dw1, (NPPVariable)dw2, (void *)dw3); break; case action_npn_invalidate_rect: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; NPN_InvalidateRect((NPP)dw1, (NPRect *)dw2); break; case action_npn_invalidate_region: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; NPN_InvalidateRegion((NPP)dw1, (NPRegion)dw2); break; case action_npn_force_redraw: if(dw1 == DEFAULT_DWARG_VALUE) dw1 = (DWORD)m_pNPInstance; NPN_ForceRedraw((NPP)dw1); break; default: assert(0); break; } DWORD dwTickReturn = XP_GetTickCount(); pLogger->appendToLog(action, dwTickEnter, dwTickReturn, dwRet, dw1, dw2, dw3, dw4, dw5, dw6, dw7); return dwRet; }