本文整理汇总了C++中PluginPackage::ensurePluginLoaded方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginPackage::ensurePluginLoaded方法的具体用法?C++ PluginPackage::ensurePluginLoaded怎么用?C++ PluginPackage::ensurePluginLoaded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginPackage
的用法示例。
在下文中一共展示了PluginPackage::ensurePluginLoaded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MIMETypeForExtension
String PluginDatabase::MIMETypeForExtension(const String& extension) const
{
if (extension.isEmpty())
return String();
PluginSet::const_iterator end = m_plugins.end();
String mimeType;
Vector<PluginPackage*, 2> pluginChoices;
HashMap<PluginPackage*, String> mimeTypeForPlugin;
for (PluginSet::const_iterator it = m_plugins.begin(); it != end; ++it) {
if (!(*it)->isEnabled())
continue;
MIMEToExtensionsMap::const_iterator mime_end = (*it)->mimeToExtensions().end();
for (MIMEToExtensionsMap::const_iterator mime_it = (*it)->mimeToExtensions().begin(); mime_it != mime_end; ++mime_it) {
mimeType = mime_it->first;
PluginPackage* preferredPlugin = m_preferredPlugins.get(mimeType).get();
const Vector<String>& extensions = mime_it->second;
bool foundMapping = false;
for (unsigned i = 0; i < extensions.size(); i++) {
if (equalIgnoringCase(extensions[i], extension)) {
PluginPackage* plugin = (*it).get();
if (preferredPlugin && PluginPackage::equal(*plugin, *preferredPlugin))
return mimeType;
#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
if (!plugin->ensurePluginLoaded())
continue;
#endif
pluginChoices.append(plugin);
mimeTypeForPlugin.add(plugin, mimeType);
foundMapping = true;
break;
}
}
if (foundMapping)
break;
}
}
if (pluginChoices.isEmpty())
return String();
qsort(pluginChoices.data(), pluginChoices.size(), sizeof(PluginPackage*), PluginDatabase::preferredPluginCompare);
return mimeTypeForPlugin.get(pluginChoices[0]);
}
示例2: pluginForMIMEType
PluginPackage* PluginDatabase::pluginForMIMEType(const String& mimeType)
{
if (mimeType.isEmpty())
return 0;
String key = mimeType.lower();
PluginSet::const_iterator end = m_plugins.end();
PluginPackage* preferredPlugin = m_preferredPlugins.get(key).get();
if (preferredPlugin
&& preferredPlugin->isEnabled()
&& preferredPlugin->mimeToDescriptions().contains(key)) {
return preferredPlugin;
}
Vector<PluginPackage*, 2> pluginChoices;
for (PluginSet::const_iterator it = m_plugins.begin(); it != end; ++it) {
PluginPackage* plugin = (*it).get();
if (!plugin->isEnabled())
continue;
if (plugin->mimeToDescriptions().contains(key)) {
#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
if (!plugin->ensurePluginLoaded())
continue;
#endif
pluginChoices.append(plugin);
}
}
if (pluginChoices.isEmpty())
return 0;
qsort(pluginChoices.data(), pluginChoices.size(), sizeof(PluginPackage*), PluginDatabase::preferredPluginCompare);
return pluginChoices[0];
}