summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm')
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm61
1 files changed, 53 insertions, 8 deletions
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
index accab46..d290f5b 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
@@ -86,13 +86,35 @@ static bool getPluginArchitecture(CFBundleRef bundle, cpu_type_t& pluginArchitec
return false;
}
+
+static RetainPtr<CFDictionaryRef> getMIMETypesFromPluginBundle(CFBundleRef bundle)
+{
+ CFStringRef propertyListFilename = static_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginMIMETypesFilename")));
+ if (propertyListFilename) {
+ RetainPtr<CFStringRef> propertyListPath(AdoptCF, CFStringCreateWithFormat(kCFAllocatorDefault, 0, CFSTR("%@/Library/Preferences/%@"), NSHomeDirectory(), propertyListFilename));
+ RetainPtr<CFURLRef> propertyListURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, propertyListPath.get(), kCFURLPOSIXPathStyle, FALSE));
+
+ CFDataRef propertyListData;
+ CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, propertyListURL.get(), &propertyListData, 0, 0, 0);
+ RetainPtr<CFPropertyListRef> propertyList(AdoptCF, CFPropertyListCreateWithData(kCFAllocatorDefault, propertyListData, kCFPropertyListImmutable, 0, 0));
+ if (propertyListData)
+ CFRelease(propertyListData);
+
+ // FIXME: Have the plug-in create the MIME types property list if it doesn't exist.
+ // https://bugs.webkit.org/show_bug.cgi?id=57204
+ if (!propertyList || CFGetTypeID(propertyList.get()) != CFDictionaryGetTypeID())
+ return 0;
+
+ return static_cast<CFDictionaryRef>(CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), CFSTR("WebPluginMIMETypes")));
+ }
+
+ return static_cast<CFDictionaryRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginMIMETypes")));
+}
static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& pluginInfo)
{
- // FIXME: Handle WebPluginMIMETypesFilenameKey.
-
- CFDictionaryRef mimeTypes = static_cast<CFDictionaryRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginMIMETypes")));
- if (!mimeTypes || CFGetTypeID(mimeTypes) != CFDictionaryGetTypeID())
+ RetainPtr<CFDictionaryRef> mimeTypes = getMIMETypesFromPluginBundle(bundle);
+ if (!mimeTypes || CFGetTypeID(mimeTypes.get()) != CFDictionaryGetTypeID())
return false;
// Get the plug-in name.
@@ -106,10 +128,10 @@ static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& plugi
pluginInfo.desc = pluginDescription;
// Get the MIME type mapping dictionary.
- CFIndex numMimeTypes = CFDictionaryGetCount(mimeTypes);
+ CFIndex numMimeTypes = CFDictionaryGetCount(mimeTypes.get());
Vector<CFStringRef> mimeTypesVector(numMimeTypes);
Vector<CFDictionaryRef> mimeTypeInfoVector(numMimeTypes);
- CFDictionaryGetKeysAndValues(mimeTypes, reinterpret_cast<const void**>(mimeTypesVector.data()), reinterpret_cast<const void**>(mimeTypeInfoVector.data()));
+ CFDictionaryGetKeysAndValues(mimeTypes.get(), reinterpret_cast<const void**>(mimeTypesVector.data()), reinterpret_cast<const void**>(mimeTypeInfoVector.data()));
for (CFIndex i = 0; i < numMimeTypes; ++i) {
MimeClassInfo mimeClassInfo;
@@ -142,8 +164,15 @@ static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& plugi
CFStringRef extension = static_cast<CFStringRef>(CFArrayGetValueAtIndex(extensionsArray, i));
if (!extension || CFGetTypeID(extension) != CFStringGetTypeID())
continue;
-
- mimeClassInfo.extensions.append(String(extension).lower());
+
+ // The DivX plug-in lists multiple extensions in a comma separated string instead of using
+ // multiple array elements in the property list. Work around this here by splitting the
+ // extension string into components.
+ Vector<String> extensionComponents;
+ String(extension).lower().split(',', extensionComponents);
+
+ for (size_t i = 0; i < extensionComponents.size(); ++i)
+ mimeClassInfo.extensions.append(extensionComponents[i]);
}
// Add this MIME type.
@@ -333,8 +362,24 @@ void NetscapePluginModule::determineQuirks()
if (plugin.bundleIdentifier == "com.macromedia.Flash Player.plugin") {
// Flash requires that the return value of getprogname() be "WebKitPluginHost".
m_pluginQuirks.add(PluginQuirks::PrognameShouldBeWebKitPluginHost);
+
+ // Flash supports snapshotting.
m_pluginQuirks.add(PluginQuirks::SupportsSnapshotting);
}
+
+ if (plugin.bundleIdentifier == "com.microsoft.SilverlightPlugin") {
+ // Silverlight doesn't explicitly opt into transparency, so we'll do it whenever
+ // there's a 'background' attribute.
+ m_pluginQuirks.add(PluginQuirks::MakeTransparentIfBackgroundAttributeExists);
+ }
+
+#ifndef NP_NO_QUICKDRAW
+ if (plugin.bundleIdentifier == "com.apple.ist.ds.appleconnect.webplugin") {
+ // The AppleConnect plug-in uses QuickDraw but doesn't paint or receive events
+ // so we'll allow it to be instantiated even though we don't support QuickDraw.
+ m_pluginQuirks.add(PluginQuirks::AllowHalfBakedQuickDrawSupport);
+ }
+#endif
}
} // namespace WebKit