This source file includes following definitions.
- m_index
- type
- suffixes
- description
- enabledPlugin
#include "config.h"
#include "core/plugins/DOMMimeType.h"
#include "core/frame/LocalFrame.h"
#include "core/loader/FrameLoader.h"
#include "core/page/Page.h"
#include "core/plugins/DOMPlugin.h"
#include "wtf/text/StringBuilder.h"
namespace WebCore {
DOMMimeType::DOMMimeType(PassRefPtr<PluginData> pluginData, LocalFrame* frame, unsigned index)
: FrameDestructionObserver(frame)
, m_pluginData(pluginData)
, m_index(index)
{
ScriptWrappable::init(this);
}
DOMMimeType::~DOMMimeType()
{
}
const String &DOMMimeType::type() const
{
return mimeClassInfo().type;
}
String DOMMimeType::suffixes() const
{
const Vector<String>& extensions = mimeClassInfo().extensions;
StringBuilder builder;
for (size_t i = 0; i < extensions.size(); ++i) {
if (i)
builder.append(',');
builder.append(extensions[i]);
}
return builder.toString();
}
const String &DOMMimeType::description() const
{
return mimeClassInfo().desc;
}
PassRefPtrWillBeRawPtr<DOMPlugin> DOMMimeType::enabledPlugin() const
{
if (!m_frame || !m_frame->page() || !m_frame->page()->mainFrame()->loader().allowPlugins(NotAboutToInstantiatePlugin))
return nullptr;
return DOMPlugin::create(m_pluginData.get(), m_frame, m_pluginData->mimePluginIndices()[m_index]);
}
}