WebCore/plugins/PluginPackage.cpp
changeset 2 303757a437d3
parent 0 4f2f89ce4247
equal deleted inserted replaced
0:4f2f89ce4247 2:303757a437d3
   106     , m_path(path)
   106     , m_path(path)
   107     , m_moduleVersion(0)
   107     , m_moduleVersion(0)
   108     , m_module(0)
   108     , m_module(0)
   109     , m_lastModified(lastModified)
   109     , m_lastModified(lastModified)
   110     , m_freeLibraryTimer(this, &PluginPackage::freeLibraryTimerFired)
   110     , m_freeLibraryTimer(this, &PluginPackage::freeLibraryTimerFired)
       
   111 #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
       
   112     , m_infoIsFromCache(true)
       
   113 #endif
   111 {
   114 {
   112     m_fileName = pathGetFileName(m_path);
   115     m_fileName = pathGetFileName(m_path);
   113     m_parentDirectory = m_path.left(m_path.length() - m_fileName.length() - 1);
   116     m_parentDirectory = m_path.left(m_path.length() - m_fileName.length() - 1);
   114 }
   117 }
   115 
   118 
   160         return 0;
   163         return 0;
   161 
   164 
   162     return package.release();
   165     return package.release();
   163 }
   166 }
   164 
   167 
       
   168 #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
       
   169 PassRefPtr<PluginPackage> PluginPackage::createPackageFromCache(const String& path, const time_t& lastModified, const String& name, const String& description, const String& mimeDescription)
       
   170 {
       
   171     RefPtr<PluginPackage> package = adoptRef(new PluginPackage(path, lastModified));
       
   172     package->m_name = name;
       
   173     package->m_description = description;
       
   174     package->determineModuleVersionFromDescription();
       
   175     package->setMIMEDescription(mimeDescription);
       
   176     package->m_infoIsFromCache = true;
       
   177     return package.release();
       
   178 }
       
   179 #endif
       
   180 
   165 #if defined(XP_UNIX)
   181 #if defined(XP_UNIX)
   166 void PluginPackage::determineQuirks(const String& mimeType)
   182 void PluginPackage::determineQuirks(const String& mimeType)
   167 {
   183 {
   168     if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType)) {
   184     if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType)) {
   169         // Because a single process cannot create multiple VMs, and we cannot reliably unload a
   185         // Because a single process cannot create multiple VMs, and we cannot reliably unload a
   183             // Flash 10.0 b218 doesn't like having a NULL window handle
   199             // Flash 10.0 b218 doesn't like having a NULL window handle
   184             m_quirks.add(PluginQuirkDontSetNullWindowHandleOnDestroy);
   200             m_quirks.add(PluginQuirkDontSetNullWindowHandleOnDestroy);
   185 #if PLATFORM(QT)
   201 #if PLATFORM(QT)
   186             m_quirks.add(PluginQuirkRequiresGtkToolKit);
   202             m_quirks.add(PluginQuirkRequiresGtkToolKit);
   187 #endif
   203 #endif
   188             m_quirks.add(PluginQuirkRequiresDefaultScreenDepth);
       
   189         } else {
   204         } else {
   190             // Flash 9 and older requests windowless plugins if we return a mozilla user agent
   205             // Flash 9 and older requests windowless plugins if we return a mozilla user agent
   191             m_quirks.add(PluginQuirkWantsMozillaUserAgent);
   206             m_quirks.add(PluginQuirkWantsMozillaUserAgent);
   192 #if PLATFORM(QT)
   207 #if PLATFORM(QT)
   193             // Flash 9 and older would crash on repeated calls to SetWindow in windowed mode
   208             // Flash 9 and older would crash on repeated calls to SetWindow in windowed mode
   194             m_quirks.add(PluginQuirkDontCallSetWindowMoreThanOnce);
   209             m_quirks.add(PluginQuirkDontCallSetWindowMoreThanOnce);
   195 #endif
   210 #endif
   196         }
   211         }
   197 
   212 
       
   213         m_quirks.add(PluginQuirkRequiresDefaultScreenDepth);
   198         m_quirks.add(PluginQuirkThrottleInvalidate);
   214         m_quirks.add(PluginQuirkThrottleInvalidate);
   199         m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages);
   215         m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages);
   200         m_quirks.add(PluginQuirkFlashURLNotifyBug);
   216         m_quirks.add(PluginQuirkFlashURLNotifyBug);
   201     }
   217     }
       
   218 
       
   219 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
       
   220     // Passing a 32-bit depth pixmap to NPAPI plugins is too inefficient. Instead, pass a X Pixmap
       
   221     // that has same depth as the screen depth since graphics operations are optimized
       
   222     // for this depth.
       
   223     m_quirks.add(PluginQuirkRequiresDefaultScreenDepth);
       
   224 #endif
   202 }
   225 }
   203 #endif
   226 #endif
   204 
   227 
   205 #if !OS(WINDOWS)
   228 #if !OS(WINDOWS)
   206 void PluginPackage::determineModuleVersionFromDescription()
   229 void PluginPackage::determineModuleVersionFromDescription()
   341 #endif
   364 #endif
   342 
   365 
   343     return 0;
   366     return 0;
   344 }
   367 }
   345 
   368 
   346 }
   369 #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
       
   370 bool PluginPackage::ensurePluginLoaded()
       
   371 {
       
   372     if (!m_infoIsFromCache)
       
   373         return m_isLoaded;
       
   374 
       
   375     m_quirks = PluginQuirkSet();
       
   376     m_name = String();
       
   377     m_description = String();
       
   378     m_fullMIMEDescription = String();
       
   379     m_moduleVersion = 0;
       
   380 
       
   381     return fetchInfo();
       
   382 }
       
   383 #endif
       
   384 
       
   385 }