Changeset 86076 in webkit
- Timestamp:
- May 9, 2011 12:07:42 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r86074 r86076 1 2011-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 1 17 2011-05-09 Dan Bernstein <mitz@apple.com> 2 18 -
trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
r85431 r86076 34 34 namespace WebKit { 35 35 36 static bool getPluginArchitecture(CFBundleRef bundle, cpu_type_t& pluginArchitecture)36 static bool getPluginArchitecture(CFBundleRef bundle, PluginInfoStore::Plugin& plugin) 37 37 { 38 38 RetainPtr<CFArrayRef> pluginArchitecturesArray(AdoptCF, CFBundleCopyExecutableArchitectures(bundle)); … … 54 54 // We only support 64-bit Intel plug-ins on 64-bit Intel. 55 55 if (architectures.contains(kCFBundleExecutableArchitectureX86_64)) { 56 plugin Architecture = CPU_TYPE_X86_64;56 plugin.pluginArchitecture = CPU_TYPE_X86_64; 57 57 return true; 58 58 } … … 60 60 // We also support 32-bit Intel plug-ins on 64-bit Intel. 61 61 if (architectures.contains(kCFBundleExecutableArchitectureI386)) { 62 plugin Architecture = CPU_TYPE_X86;62 plugin.pluginArchitecture = CPU_TYPE_X86; 63 63 return true; 64 64 } … … 66 66 // We only support 32-bit Intel plug-ins on 32-bit Intel. 67 67 if (architectures.contains(kCFBundleExecutableArchitectureI386)) { 68 plugin Architecture = CPU_TYPE_X86;68 plugin.pluginArchitecture = CPU_TYPE_X86; 69 69 return true; 70 70 } … … 72 72 // We only support 64-bit PPC plug-ins on 64-bit PPC. 73 73 if (architectures.contains(kCFBundleExecutableArchitecturePPC64)) { 74 plugin Architecture = CPU_TYPE_POWERPC64;74 plugin.pluginArchitecture = CPU_TYPE_POWERPC64; 75 75 return true; 76 76 } … … 78 78 // We only support 32-bit PPC plug-ins on 32-bit PPC. 79 79 if (architectures.contains(kCFBundleExecutableArchitecturePPC)) { 80 plugin Architecture = CPU_TYPE_POWERPC;80 plugin.pluginArchitecture = CPU_TYPE_POWERPC; 81 81 return true; 82 82 } … … 112 112 } 113 113 114 static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo & pluginInfo)114 static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfoStore::Plugin& plugin) 115 115 { 116 116 RetainPtr<CFDictionaryRef> mimeTypes = getMIMETypesFromPluginBundle(bundle); … … 121 121 CFStringRef pluginName = static_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginName"))); 122 122 if (pluginName && CFGetTypeID(pluginName) == CFStringGetTypeID()) 123 plugin Info.name = pluginName;123 plugin.info.name = pluginName; 124 124 125 125 // Get the plug-in description. 126 126 CFStringRef pluginDescription = static_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginDescription"))); 127 127 if (pluginDescription && CFGetTypeID(pluginDescription) == CFStringGetTypeID()) 128 plugin Info.desc = pluginDescription;128 plugin.info.desc = pluginDescription; 129 129 130 130 // Get the MIME type mapping dictionary. … … 191 191 192 192 // Add this MIME type. 193 plugin Info.mimes.append(mimeClassInfo);193 plugin.info.mimes.append(mimeClassInfo); 194 194 } 195 195 … … 269 269 static const ResID MIMEListStringStringNumber = 128; 270 270 271 static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo & pluginInfo)271 static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfoStore::Plugin& plugin) 272 272 { 273 273 ResourceMap resourceMap(bundle); … … 311 311 mimeClassInfo.extensions.append(extensions[i].lower()); 312 312 313 plugin Info.mimes.append(mimeClassInfo);313 plugin.info.mimes.append(mimeClassInfo); 314 314 } 315 315 316 316 // Set the description and name if they exist. 317 317 if (descriptionAndName.size() > 0) 318 plugin Info.desc = descriptionAndName[0];318 plugin.info.desc = descriptionAndName[0]; 319 319 if (descriptionAndName.size() > 1) 320 plugin Info.name = descriptionAndName[1];320 plugin.info.name = descriptionAndName[1]; 321 321 322 322 return true; … … 340 340 341 341 // 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 351 345 plugin.path = pluginPath; 352 plugin.pluginArchitecture = pluginArchitecture;353 346 plugin.bundleIdentifier = CFBundleGetIdentifier(bundle.get()); 354 347 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; 355 353 356 354 RetainPtr<CFStringRef> filename(AdoptCF, CFURLCopyLastPathComponent(bundleURL.get()));
Note: See TracChangeset
for help on using the changeset viewer.