WebCore/plugins/PluginPackage.cpp
changeset 2 303757a437d3
parent 0 4f2f89ce4247
--- a/WebCore/plugins/PluginPackage.cpp	Fri Sep 17 09:02:29 2010 +0300
+++ b/WebCore/plugins/PluginPackage.cpp	Mon Oct 04 01:32:07 2010 +0300
@@ -108,6 +108,9 @@
     , m_module(0)
     , m_lastModified(lastModified)
     , m_freeLibraryTimer(this, &PluginPackage::freeLibraryTimerFired)
+#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
+    , m_infoIsFromCache(true)
+#endif
 {
     m_fileName = pathGetFileName(m_path);
     m_parentDirectory = m_path.left(m_path.length() - m_fileName.length() - 1);
@@ -162,6 +165,19 @@
     return package.release();
 }
 
+#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
+PassRefPtr<PluginPackage> PluginPackage::createPackageFromCache(const String& path, const time_t& lastModified, const String& name, const String& description, const String& mimeDescription)
+{
+    RefPtr<PluginPackage> package = adoptRef(new PluginPackage(path, lastModified));
+    package->m_name = name;
+    package->m_description = description;
+    package->determineModuleVersionFromDescription();
+    package->setMIMEDescription(mimeDescription);
+    package->m_infoIsFromCache = true;
+    return package.release();
+}
+#endif
+
 #if defined(XP_UNIX)
 void PluginPackage::determineQuirks(const String& mimeType)
 {
@@ -185,7 +201,6 @@
 #if PLATFORM(QT)
             m_quirks.add(PluginQuirkRequiresGtkToolKit);
 #endif
-            m_quirks.add(PluginQuirkRequiresDefaultScreenDepth);
         } else {
             // Flash 9 and older requests windowless plugins if we return a mozilla user agent
             m_quirks.add(PluginQuirkWantsMozillaUserAgent);
@@ -195,10 +210,18 @@
 #endif
         }
 
+        m_quirks.add(PluginQuirkRequiresDefaultScreenDepth);
         m_quirks.add(PluginQuirkThrottleInvalidate);
         m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages);
         m_quirks.add(PluginQuirkFlashURLNotifyBug);
     }
+
+#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
+    // Passing a 32-bit depth pixmap to NPAPI plugins is too inefficient. Instead, pass a X Pixmap
+    // that has same depth as the screen depth since graphics operations are optimized
+    // for this depth.
+    m_quirks.add(PluginQuirkRequiresDefaultScreenDepth);
+#endif
 }
 #endif
 
@@ -343,4 +366,20 @@
     return 0;
 }
 
+#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
+bool PluginPackage::ensurePluginLoaded()
+{
+    if (!m_infoIsFromCache)
+        return m_isLoaded;
+
+    m_quirks = PluginQuirkSet();
+    m_name = String();
+    m_description = String();
+    m_fullMIMEDescription = String();
+    m_moduleVersion = 0;
+
+    return fetchInfo();
 }
+#endif
+
+}