Exemplo n.º 1
0
bool NetscapePluginModule::getPluginInfoForLoadedPlugin(PluginModuleInfo& plugin)
{
    ASSERT(m_isInitialized);

    plugin.path = m_pluginPath;
    plugin.info.file = pathGetFileName(m_pluginPath);

    Module* module = m_module.get();
    NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
    if (!NPP_GetValue)
        return false;

    NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
    if (!NP_GetMIMEDescription)
        return false;

    char* buffer;
    NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer);
    if (error == NPERR_NO_ERROR)
        plugin.info.name = buffer;

    error = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
    if (error == NPERR_NO_ERROR)
        plugin.info.desc = buffer;

    const char* mimeDescription = NP_GetMIMEDescription();
    if (!mimeDescription)
        return false;

    setMIMEDescription(mimeDescription, plugin);

    return true;
}
Exemplo n.º 2
0
bool NetscapePluginModule::getPluginInfoForLoadedPlugin(RawPluginMetaData& metaData)
{
    ASSERT(m_isInitialized);

    Module* module = m_module.get();
    NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
    if (!NPP_GetValue)
        return false;

    NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
    if (!NP_GetMIMEDescription)
        return false;

    char* buffer;
    NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer);
    if (error == NPERR_NO_ERROR)
        metaData.name = String::fromUTF8(buffer);

    error = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
    if (error == NPERR_NO_ERROR)
        metaData.description = String::fromUTF8(buffer);

    String mimeDescription = String::fromUTF8(NP_GetMIMEDescription());
    if (mimeDescription.isNull())
        return false;

    metaData.mimeDescription = mimeDescription;

#if PLATFORM(GTK)
    metaData.requiresGtk2 = module->functionPointer<void (*)()>("gtk_progress_get_type");
#endif

    return true;
}
Exemplo n.º 3
0
bool PluginPackage::fetchInfo()
{
    if (!load())
        return false;

    NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = 0;
    NPP_GetValueProcPtr NPP_GetValue = 0;

    g_module_symbol(m_module, "NP_GetMIMEDescription", (void**)&NP_GetMIMEDescription);
    g_module_symbol(m_module, "NP_GetValue", (void**)&NPP_GetValue);

    if (!NP_GetMIMEDescription || !NPP_GetValue)
        return false;

    char* buffer = 0;
    NPError err = NPP_GetValue(0, NPPVpluginNameString, &buffer);
    if (err == NPERR_NO_ERROR)
        m_name = String::fromUTF8(buffer);

    buffer = 0;
    err = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
    if (err == NPERR_NO_ERROR) {
        m_description = String::fromUTF8(buffer);
        determineModuleVersionFromDescription();
    }

    const gchar* types = NP_GetMIMEDescription();
    if (!types)
        return true;

    gchar** mimeDescs = g_strsplit(types, ";", -1);
    for (int i = 0; mimeDescs[i] && mimeDescs[i][0]; i++) {
        GOwnPtr<char> mime(g_utf8_strdown(mimeDescs[i], -1));
        gchar** mimeData = g_strsplit(mime.get(), ":", 3);
        if (g_strv_length(mimeData) < 3) {
            g_strfreev(mimeData);
            continue;
        }

        String description = String::fromUTF8(mimeData[2]);
        gchar** extensions = g_strsplit(mimeData[1], ",", -1);

        Vector<String> extVector;
        for (int j = 0; extensions[j]; j++)
            extVector.append(String::fromUTF8(extensions[j]));

        determineQuirks(mimeData[0]);
        m_mimeToExtensions.add(mimeData[0], extVector);
        m_mimeToDescriptions.add(mimeData[0], description);

        g_strfreev(extensions);
        g_strfreev(mimeData);
    }
    g_strfreev(mimeDescs);

    return true;
}
Exemplo n.º 4
0
NPError Private_GetValue(NPP instance, NPPVariable variable, void *result)
{
  EnterCodeResource();
  NPError rv = NPP_GetValue(instance, variable, result);
  ExitCodeResource();
  return rv;
}
Exemplo n.º 5
0
bool NetscapePlugin::platformPostInitialize()
{
#if PLATFORM(GTK)
    if (moduleMixesGtkSymbols(m_pluginModule->module()))
        return false;
#endif

    uint64_t windowID = 0;
    bool needsXEmbed = false;
    if (m_isWindowed) {
        NPP_GetValue(NPPVpluginNeedsXEmbed, &needsXEmbed);
        if (needsXEmbed) {
            windowID = controller()->createPluginContainer();
            if (!windowID)
                return false;
        } else {
            notImplemented();
            return false;
        }
    }

    if (!(m_pluginDisplay = getPluginDisplay()))
        return false;

    NPSetWindowCallbackStruct* callbackStruct = new NPSetWindowCallbackStruct;
    callbackStruct->type = 0;
    m_npWindow.ws_info = callbackStruct;

    if (m_isWindowed)
        return platformPostInitializeWindowed(needsXEmbed, windowID);

    return platformPostInitializeWindowless();
}
Exemplo n.º 6
0
bool NetscapePlugin::platformPostInitialize()
{
    uint64_t windowID = 0;
    // NPPVpluginNeedsXEmbed is a boolean value, but at least the
    // Flash player plugin is using an 'int' instead.
    int needsXEmbed = 0;
    if (m_isWindowed) {
        NPP_GetValue(NPPVpluginNeedsXEmbed, &needsXEmbed);
        if (needsXEmbed) {
            windowID = controller()->createPluginContainer();
            if (!windowID)
                return false;
        } else {
            notImplemented();
            return false;
        }
    }

    if (!(m_pluginDisplay = getPluginDisplay()))
        return false;

    NPSetWindowCallbackStruct* callbackStruct = new NPSetWindowCallbackStruct;
    callbackStruct->type = 0;
    m_npWindow.ws_info = callbackStruct;

    if (m_isWindowed)
        return platformPostInitializeWindowed(needsXEmbed, windowID);

    return platformPostInitializeWindowless();
}
Exemplo n.º 7
0
bool PluginPackage::fetchInfo()
{
    if (!load())
        return false;

    NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = 0;
    NPP_GetValueProcPtr NPP_GetValue = 0;

    NP_GetMIMEDescription = (NP_GetMIMEDescriptionFuncPtr)dlsym(m_module,"NP_GetMIMEDescription");
    NPP_GetValue = (NPP_GetValueProcPtr)dlsym(m_module,"NP_GetValue");

    if (!NP_GetMIMEDescription || !NPP_GetValue)
        return false;

    char* buffer = 0;
    NPError err = NPP_GetValue(0, NPPVpluginNameString, &buffer);
    if (err != NPERR_NO_ERROR)
        return false;
    m_name = String::fromUTF8(buffer);

    buffer = 0;
    err = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
    if (err != NPERR_NO_ERROR)
        return false;
    m_description = String::fromUTF8(buffer);
    determineModuleVersionFromDescription();

    String description = String::fromUTF8(NP_GetMIMEDescription());
    Vector<String> types;
    description.split(UChar(';'), false, types);
    for (unsigned i = 0; i < types.size(); ++i) {
        Vector<String> mime;
        types[i].split(UChar(':'), true, mime);
        if (mime.size() > 0) {
            Vector<String> exts;
            if (mime.size() > 1)
                mime[1].split(UChar(','), false, exts);
            m_mimeToExtensions.add(mime[0], exts);
            if (mime.size() > 2)
                m_mimeToDescriptions.add(mime[0], mime[2]);
        }
    }

    return true;
}
NPObject* NetscapePlugin::pluginScriptableNPObject()
{
    ASSERT(m_isStarted);
    NPObject* scriptableNPObject = 0;
    
    if (NPP_GetValue(NPPVpluginScriptableNPObject, &scriptableNPObject) != NPERR_NO_ERROR)
        return 0;
    
    return scriptableNPObject;
}
bool NetscapePlugin::shouldLoadSrcURL()
{
    // Check if we should cancel the load
    NPBool cancelSrcStream = false;

    if (NPP_GetValue(NPPVpluginCancelSrcStream, &cancelSrcStream) != NPERR_NO_ERROR)
        return true;

    return !cancelSrcStream;
}
Exemplo n.º 10
0
bool NetscapePlugin::getFormValue(String& formValue)
{
    ASSERT(m_isStarted);

    char* formValueString = 0;
    if (NPP_GetValue(NPPVformValue, &formValueString) != NPERR_NO_ERROR)
        return false;

    formValue = String::fromUTF8(formValueString);

    // The plug-in allocates the form value string with NPN_MemAlloc so it needs to be freed with NPN_MemFree.
    npnMemFree(formValueString);
    return true;
}
Exemplo n.º 11
0
NPObject* NetscapePlugin::pluginScriptableNPObject()
{
    ASSERT(m_isStarted);
    NPObject* scriptableNPObject = 0;
    
    if (NPP_GetValue(NPPVpluginScriptableNPObject, &scriptableNPObject) != NPERR_NO_ERROR)
        return 0;

#if PLUGIN_ARCHITECTURE(MAC)
    if (m_pluginModule->pluginQuirks().contains(PluginQuirks::ReturnsNonRetainedScriptableNPObject))
        retainNPObject(scriptableNPObject);        
#endif    

    return scriptableNPObject;
}
Exemplo n.º 12
0
bool NetscapePlugin::shouldLoadSrcURL()
{
#if PLUGIN_ARCHITECTURE(X11)
    // Flash crashes when NPP_GetValue is called for NPPVpluginCancelSrcStream in windowed mode.
    if (m_isWindowed && m_pluginModule->pluginQuirks().contains(PluginQuirks::DoNotCancelSrcStreamInWindowedMode))
        return true;
#endif

    // Check if we should cancel the load
    NPBool cancelSrcStream = false;

    if (NPP_GetValue(NPPVpluginCancelSrcStream, &cancelSrcStream) != NPERR_NO_ERROR)
        return true;

    return !cancelSrcStream;
}
Exemplo n.º 13
0
NPError
NP_GetValue(void* future, NPPVariable variable, void *value)
{
  return NPP_GetValue((NPP_t *)future, variable, value);
}
Exemplo n.º 14
0
NPError OSCALL NP_GetValue(void* npp, NPPVariable variable, void* value)
{
  return NPP_GetValue((NPP)npp, variable, value);
}
Exemplo n.º 15
0
NPError Private_GetValue(NPP instance, NPPVariable variable, void *result)
{
  NPError rv = NPP_GetValue(instance, variable, result);
  return rv;
}