Changeset 96400 in webkit


Ignore:
Timestamp:
Sep 30, 2011 7:23:43 AM (13 years ago)
Author:
Carlos Garcia Campos
Message:

[UNIX] Add a method to get information for an already loaded plugin module
https://bugs.webkit.org/show_bug.cgi?id=69139

Reviewed by Martin Robinson.

  • Shared/Plugins/Netscape/NetscapePluginModule.h: Add pluginInfo().
  • Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:

(WebKit::NetscapePluginModule::pluginInfo): Private method to get
the plugin information from the module, it must be called when the
module has been already initialized.
(WebKit::NetscapePluginModule::getPluginInfo): Use pluginInfo() to
get information of the plugin module for the given path.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r96399 r96400  
     12011-09-30  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [UNIX] Add a method to get information for an already loaded plugin module
     4        https://bugs.webkit.org/show_bug.cgi?id=69139
     5
     6        Reviewed by Martin Robinson.
     7
     8        * Shared/Plugins/Netscape/NetscapePluginModule.h: Add pluginInfo().
     9        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
     10        (WebKit::NetscapePluginModule::pluginInfo): Private method to get
     11        the plugin information from the module, it must be called when the
     12        module has been already initialized.
     13        (WebKit::NetscapePluginModule::getPluginInfo): Use pluginInfo() to
     14        get information of the plugin module for the given path.
     15
    1162011-09-30  Zeno Albisser  <zeno.albisser@nokia.com>
    217
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h

    r95901 r96400  
    7070    void applyX11QuirksBeforeLoad();
    7171    static void setMIMEDescription(const String& mimeDescription, PluginModuleInfo&);
     72    bool pluginInfo(PluginModuleInfo&);
    7273#endif
    7374
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp

    r95901 r96400  
    119119}
    120120
     121bool NetscapePluginModule::pluginInfo(PluginModuleInfo& plugin)
     122{
     123    ASSERT(m_isInitialized);
     124
     125    plugin.path = m_pluginPath;
     126    plugin.info.file = pathGetFileName(m_pluginPath);
     127
     128    Module* module = m_module.get();
     129    NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
     130    if (!NPP_GetValue)
     131        return false;
     132
     133    NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
     134    if (!NP_GetMIMEDescription)
     135        return false;
     136
     137    char* buffer;
     138    NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer);
     139    if (error == NPERR_NO_ERROR)
     140        plugin.info.name = buffer;
     141
     142    error = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
     143    if (error == NPERR_NO_ERROR)
     144        plugin.info.desc = buffer;
     145
     146    const char* mimeDescription = NP_GetMIMEDescription();
     147    if (!mimeDescription)
     148        return false;
     149
     150    setMIMEDescription(mimeDescription, plugin);
     151
     152    return true;
     153}
    121154bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
    122155{
     
    132165
    133166    pluginModule->incrementLoadCount();
    134 
    135     plugin.path = pluginPath;
    136     plugin.info.file = pathGetFileName(pluginPath);
    137 
    138     Module* module = pluginModule->module();
    139     NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
    140     if (!NPP_GetValue) {
    141         pluginModule->decrementLoadCount();
    142         return false;
    143     }
    144 
    145     NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
    146     if (!NP_GetMIMEDescription) {
    147         pluginModule->decrementLoadCount();
    148         return false;
    149     }
    150 
    151     char* buffer;
    152     NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer);
    153     if (error == NPERR_NO_ERROR)
    154         plugin.info.name = buffer;
    155 
    156     error = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
    157     if (error == NPERR_NO_ERROR)
    158         plugin.info.desc = buffer;
    159 
    160     const char* mimeDescription = NP_GetMIMEDescription();
    161     if (!mimeDescription) {
    162         pluginModule->decrementLoadCount();
    163         return false;
    164     }
    165 
    166     setMIMEDescription(mimeDescription, plugin);
    167 
     167    bool returnValue = pluginModule->pluginInfo(plugin);
    168168    pluginModule->decrementLoadCount();
    169169
    170     return true;
     170    return returnValue;
    171171}
    172172
Note: See TracChangeset for help on using the changeset viewer.