Changeset 86076 in webkit


Ignore:
Timestamp:
May 9, 2011 12:07:42 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-05-09 Anders Carlsson <andersca@apple.com>

Reviewed by John Sullivan.

Clean up NetscapePluginModule::getPluginInfo
https://bugs.webkit.org/show_bug.cgi?id=60486

Make all 'get' functions take a PluginInfoStore::Plugin reference, since getPluginInfoFromPropertyLists
is going to need it to know the path and plug-in architecture.

  • Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: (WebKit::getPluginArchitecture): (WebKit::getPluginInfoFromPropertyLists): (WebKit::getPluginInfoFromCarbonResources): (WebKit::NetscapePluginModule::getPluginInfo):
Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r86074 r86076  
     12011-05-09  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        Clean up NetscapePluginModule::getPluginInfo
     6        https://bugs.webkit.org/show_bug.cgi?id=60486
     7
     8        Make all 'get' functions take a PluginInfoStore::Plugin reference, since getPluginInfoFromPropertyLists
     9        is going to need it to know the path and plug-in architecture.
     10
     11        * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
     12        (WebKit::getPluginArchitecture):
     13        (WebKit::getPluginInfoFromPropertyLists):
     14        (WebKit::getPluginInfoFromCarbonResources):
     15        (WebKit::NetscapePluginModule::getPluginInfo):
     16
    1172011-05-09  Dan Bernstein  <mitz@apple.com>
    218
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm

    r85431 r86076  
    3434namespace WebKit {
    3535
    36 static bool getPluginArchitecture(CFBundleRef bundle, cpu_type_t& pluginArchitecture)
     36static bool getPluginArchitecture(CFBundleRef bundle, PluginInfoStore::Plugin& plugin)
    3737{
    3838    RetainPtr<CFArrayRef> pluginArchitecturesArray(AdoptCF, CFBundleCopyExecutableArchitectures(bundle));
     
    5454    // We only support 64-bit Intel plug-ins on 64-bit Intel.
    5555    if (architectures.contains(kCFBundleExecutableArchitectureX86_64)) {
    56         pluginArchitecture = CPU_TYPE_X86_64;
     56        plugin.pluginArchitecture = CPU_TYPE_X86_64;
    5757        return true;
    5858    }
     
    6060    // We also support 32-bit Intel plug-ins on 64-bit Intel.
    6161    if (architectures.contains(kCFBundleExecutableArchitectureI386)) {
    62         pluginArchitecture = CPU_TYPE_X86;
     62        plugin.pluginArchitecture = CPU_TYPE_X86;
    6363        return true;
    6464    }
     
    6666    // We only support 32-bit Intel plug-ins on 32-bit Intel.
    6767    if (architectures.contains(kCFBundleExecutableArchitectureI386)) {
    68         pluginArchitecture = CPU_TYPE_X86;
     68        plugin.pluginArchitecture = CPU_TYPE_X86;
    6969        return true;
    7070    }
     
    7272    // We only support 64-bit PPC plug-ins on 64-bit PPC.
    7373    if (architectures.contains(kCFBundleExecutableArchitecturePPC64)) {
    74         pluginArchitecture = CPU_TYPE_POWERPC64;
     74        plugin.pluginArchitecture = CPU_TYPE_POWERPC64;
    7575        return true;
    7676    }
     
    7878    // We only support 32-bit PPC plug-ins on 32-bit PPC.
    7979    if (architectures.contains(kCFBundleExecutableArchitecturePPC)) {
    80         pluginArchitecture = CPU_TYPE_POWERPC;
     80        plugin.pluginArchitecture = CPU_TYPE_POWERPC;
    8181        return true;
    8282    }
     
    112112}
    113113
    114 static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& pluginInfo)
     114static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfoStore::Plugin& plugin)
    115115{
    116116    RetainPtr<CFDictionaryRef> mimeTypes = getMIMETypesFromPluginBundle(bundle);
     
    121121    CFStringRef pluginName = static_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginName")));
    122122    if (pluginName && CFGetTypeID(pluginName) == CFStringGetTypeID())
    123         pluginInfo.name = pluginName;
     123        plugin.info.name = pluginName;
    124124   
    125125    // Get the plug-in description.
    126126    CFStringRef pluginDescription = static_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginDescription")));
    127127    if (pluginDescription && CFGetTypeID(pluginDescription) == CFStringGetTypeID())
    128         pluginInfo.desc = pluginDescription;
     128        plugin.info.desc = pluginDescription;
    129129   
    130130    // Get the MIME type mapping dictionary.
     
    191191
    192192        // Add this MIME type.
    193         pluginInfo.mimes.append(mimeClassInfo);
     193        plugin.info.mimes.append(mimeClassInfo);
    194194    }
    195195
     
    269269static const ResID MIMEListStringStringNumber = 128;
    270270
    271 static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& pluginInfo)
     271static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfoStore::Plugin& plugin)
    272272{
    273273    ResourceMap resourceMap(bundle);
     
    311311            mimeClassInfo.extensions.append(extensions[i].lower());
    312312
    313         pluginInfo.mimes.append(mimeClassInfo);
     313        plugin.info.mimes.append(mimeClassInfo);
    314314    }
    315315
    316316    // Set the description and name if they exist.
    317317    if (descriptionAndName.size() > 0)
    318         pluginInfo.desc = descriptionAndName[0];
     318        plugin.info.desc = descriptionAndName[0];
    319319    if (descriptionAndName.size() > 1)
    320         pluginInfo.name = descriptionAndName[1];
     320        plugin.info.name = descriptionAndName[1];
    321321
    322322    return true;
     
    340340   
    341341    // Check that the architecture is valid.
    342     cpu_type_t pluginArchitecture = 0;
    343     if (!getPluginArchitecture(bundle.get(), pluginArchitecture))
    344         return false;
    345    
    346     // Check that there's valid info for this plug-in.
    347     if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info) &&
    348         !getPluginInfoFromCarbonResources(bundle.get(), plugin.info))
    349         return false;
    350    
     342    if (!getPluginArchitecture(bundle.get(), plugin))
     343        return false;
     344
    351345    plugin.path = pluginPath;
    352     plugin.pluginArchitecture = pluginArchitecture;
    353346    plugin.bundleIdentifier = CFBundleGetIdentifier(bundle.get());
    354347    plugin.versionNumber = CFBundleGetVersionNumber(bundle.get());
     348   
     349    // Check that there's valid info for this plug-in.
     350    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin) &&
     351        !getPluginInfoFromCarbonResources(bundle.get(), plugin))
     352        return false;
    355353   
    356354    RetainPtr<CFStringRef> filename(AdoptCF, CFURLCopyLastPathComponent(bundleURL.get()));
Note: See TracChangeset for help on using the changeset viewer.