Widget* FrameLoaderClientImpl::createPlugin(HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually, DetachedPluginPolicy policy) { if (!m_webFrame->client()) return nullptr; WebPluginParams params; params.url = url; params.mimeType = mimeType; params.attributeNames = paramNames; params.attributeValues = paramValues; params.loadManually = loadManually; WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params); if (!webPlugin) return nullptr; // The container takes ownership of the WebPlugin. WebPluginContainerImpl* container = WebPluginContainerImpl::create(element, webPlugin); if (!webPlugin->initialize(container)) return nullptr; if (policy != AllowDetachedPlugin && !element->layoutObject()) return nullptr; return container; }
QScriptValue constructWebPlugin(QScriptContext *context, QScriptEngine *engine) { WebPlugin* plugin = new WebPlugin; QString arg1 = context->argumentCount() > 0 ? context->argument(0).toString() : QString(); QString arg2 = context->argumentCount() > 1 ? context->argument(1).toString() : QString(); QList<Plugin> arg3 = context->argumentCount() > 2 ? qscriptvalue_cast<QList<Plugin> >(context->argument(2)) : QList<Plugin>(); plugin->setName(arg1); plugin->setDescription(arg2); plugin->setPlugins(arg3); return engine->newQObject(plugin); }
QList<QWebPluginFactory::Plugin> AWebPluginFactory::plugins() const { QList<QWebPluginFactory::Plugin> list; for(int i = 0; i < factories.count(); i++) { WebPlugin* pluginFactory = factories.at(i); QList<APlugin> pluginList = pluginFactory->getPlugins(); for(int j = 0; j < pluginList.count(); j++) { APlugin plugin = pluginList.at(j); // Construct each plugin QWebPluginFactory::Plugin plugin_; plugin_.name = plugin.name; plugin_.description = plugin.description; for(int k = 0; k < plugin.mimeTypes.count(); k++) { AMimeType mimeType = plugin.mimeTypes.at(k); // Construct each mime type QWebPluginFactory::MimeType mimeType_; mimeType_.name = mimeType.name; mimeType_.description = mimeType.description; mimeType_.fileExtensions = mimeType.extensions; plugin_.mimeTypes.append(mimeType_); } list.append(plugin_); } } return list; }
WebPlugin::WebPlugin(const WebPlugin &plugin) { setName(plugin.getName()); setDescription(plugin.getDescription()); setPlugins(plugin.getPlugins()); }