This source file includes following definitions.
- m_index
- name
- filename
- description
- length
- item
- canGetItemsForName
- namedItem
#include "config.h"
#include "core/plugins/DOMPlugin.h"
#include "platform/plugins/PluginData.h"
#include "wtf/text/AtomicString.h"
namespace WebCore {
DOMPlugin::DOMPlugin(PluginData* pluginData, LocalFrame* frame, unsigned index)
: FrameDestructionObserver(frame)
, m_pluginData(pluginData)
, m_index(index)
{
ScriptWrappable::init(this);
}
DOMPlugin::~DOMPlugin()
{
}
String DOMPlugin::name() const
{
return pluginInfo().name;
}
String DOMPlugin::filename() const
{
return pluginInfo().file;
}
String DOMPlugin::description() const
{
return pluginInfo().desc;
}
unsigned DOMPlugin::length() const
{
return pluginInfo().mimes.size();
}
PassRefPtrWillBeRawPtr<DOMMimeType> DOMPlugin::item(unsigned index)
{
if (index >= pluginInfo().mimes.size())
return nullptr;
const MimeClassInfo& mime = pluginInfo().mimes[index];
const Vector<MimeClassInfo>& mimes = m_pluginData->mimes();
for (unsigned i = 0; i < mimes.size(); ++i) {
if (mimes[i] == mime && m_pluginData->mimePluginIndices()[i] == m_index)
return DOMMimeType::create(m_pluginData.get(), m_frame, i).get();
}
return nullptr;
}
bool DOMPlugin::canGetItemsForName(const AtomicString& propertyName)
{
const Vector<MimeClassInfo>& mimes = m_pluginData->mimes();
for (unsigned i = 0; i < mimes.size(); ++i)
if (mimes[i].type == propertyName)
return true;
return false;
}
PassRefPtrWillBeRawPtr<DOMMimeType> DOMPlugin::namedItem(const AtomicString& propertyName)
{
const Vector<MimeClassInfo>& mimes = m_pluginData->mimes();
for (unsigned i = 0; i < mimes.size(); ++i)
if (mimes[i].type == propertyName)
return DOMMimeType::create(m_pluginData.get(), m_frame, i).get();
return nullptr;
}
}