Exemple #1
0
void CPlugin::showGetPluginDialog()
{
  assert(m_pNPMIMEType != NULL);
  if(m_pNPMIMEType == NULL)
    return;

  // Get environment
  BOOL bOffline = FALSE;

  NPN_GetValue(m_pNPInstance, NPNVisOfflineBool, (void *)&bOffline);
  NPN_GetValue(m_pNPInstance, NPNVjavascriptEnabledBool, (void *)&m_bJavaScript);
  //NPN_GetValue(m_pNPInstance, NPNVasdEnabledBool, (void *)&m_bSmartUpdate);

  m_bOnline = !bOffline;

  dbgOut1("Environment:");
  dbgOut2("%s", m_bOnline ? "On-line" : "Off-line");
  dbgOut2("JavaScript %s", m_bJavaScript ? "Enabled" : "Disabled");
  dbgOut2("SmartUpdate %s", m_bSmartUpdate ? "Enabled" : "Disabled");

  if((!m_bSmartUpdate && (m_szPageURL != NULL) || (m_szFileURL != NULL)) || !m_bJavaScript)
  {
    // we don't want it more than once
    if(m_hWndDialog == NULL)
      CreateDialogParam(m_hInst, MAKEINTRESOURCE(IDD_PLUGIN_DOWNLOAD), m_hWnd,
                        (DLGPROC)GetPluginDialogProc, (LPARAM)this);
  }
  else
    getPlugin();
}
void nsPluginThread::dispatch()
{
  dbgOut2("nsPluginThread::dispatch: %s", FormatAction(mAction));

  switch (mAction) {
    case action_npp_new:
      pluginNPPFuncs.newp((NPMIMEType)mP1, (NPP)mP2, (uint16)mP3, (int16)mP4, (char**)mP5, (char**)mP6, (NPSavedData*)mP7);
      break;
    case action_npp_destroy:
      pluginNPPFuncs.destroy((NPP)mP1, (NPSavedData**)mP2);
      break;
    case action_npp_set_window:
      pluginNPPFuncs.setwindow((NPP)mP1, (NPWindow*)mP2);
      break;
    case action_npp_new_stream:
      pluginNPPFuncs.newstream((NPP)mP1, (NPMIMEType)mP2, (NPStream*)mP3, (NPBool)mP4, (uint16*)mP5);
      break;
    case action_npp_destroy_stream:
    {
      NPStream * stream = (NPStream *)mP2;
      pluginNPPFuncs.destroystream((NPP)mP1, stream, (NPError)mP3);
      break;
    }
    case action_npp_stream_as_file:
    {
      NPStream * stream = (NPStream *)mP2;
      pluginNPPFuncs.asfile((NPP)mP1, stream, (char*)mP3);
      break;
    }
    case action_npp_write_ready:
      pluginNPPFuncs.writeready((NPP)mP1, (NPStream *)mP2);
      break;
    case action_npp_write:
      pluginNPPFuncs.write((NPP)mP1, (NPStream *)mP2, (int32)mP3, (int32)mP4, (void *)mP5);
      break;
    case action_npp_print:
      pluginNPPFuncs.print((NPP)mP1, (NPPrint*)mP2);
      break;
    case action_npp_handle_event:
      pluginNPPFuncs.event((NPP)mP1, (void *)mP2);
      break;
    case action_npp_url_notify:
      pluginNPPFuncs.urlnotify((NPP)mP1, (const char*)mP2, (NPReason)mP3, (void*)mP4);
      break;
    case action_npp_get_java_class:
      //pluginNPPFuncs.javaClass;
      break;
    case action_npp_get_value:
      pluginNPPFuncs.getvalue((NPP)mP1, (NPPVariable)mP2, (void *)mP3);
      break;
    case action_npp_set_value:
      pluginNPPFuncs.setvalue((NPP)mP1, (NPNVariable)mP2, (void *)mP3);
      break;
    default:
      dbgOut1("Unexpected action!");
      break;
  }
}
Exemple #3
0
void NP_LOADDS NPP_URLNotify(NPP pInstance, const char* url, NPReason reason, void* notifyData)
{
  dbgOut2("NPP_URLNotify, URL '%s'", url);

  CPlugin * pPlugin = (CPlugin *)pInstance->pdata;
  assert(pPlugin != NULL);

  pPlugin->URLNotify(url);
}
Exemple #4
0
//------------------------------------------------------------------------------------
// NPP_Print:
//------------------------------------------------------------------------------------
void NP_LOADDS NPP_Print(NPP pInstance, NPPrint * printInfo)
{
  dbgOut2("NPP_Print, printInfo = %#08x", printInfo);

  CPlugin * pPlugin = (CPlugin *)pInstance->pdata;
  assert(pPlugin != NULL);

  pPlugin->print(printInfo);
}
Exemple #5
0
void CPlugin::URLNotify(const char * szURL)
{
  dbgOut2("CPlugin::URLNotify(), URL '%s'", szURL);

  NPStream * pStream = NULL;
  char buf[256];

  assert(m_hInst != NULL);
  assert(m_pNPInstance != NULL);
  
  int iSize = LoadString(m_hInst, IDS_GOING2HTML, buf, sizeof(buf));

  NPError rc = NPN_NewStream(m_pNPInstance, "text/html", "asd_plugin_finder", &pStream);
  if (rc != NPERR_NO_ERROR)
    return;

  //char buf[] = "<html>\n<body>\n\n<h2 align=center>NPN_NewStream / NPN_Write - This seems to work.</h2>\n\n</body>\n</html>";
  
  NPN_Write(m_pNPInstance, pStream, iSize, buf);

  NPN_DestroyStream(m_pNPInstance, pStream, NPRES_DONE);
}