#ifndef PluginData_h
#define PluginData_h
#include "platform/PlatformExport.h"
#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class Page;
struct PluginInfo;
struct MimeClassInfo {
String type;
String desc;
Vector<String> extensions;
};
inline bool operator==(const MimeClassInfo& a, const MimeClassInfo& b)
{
return a.type == b.type && a.desc == b.desc && a.extensions == b.extensions;
}
struct PluginInfo {
String name;
String file;
String desc;
Vector<MimeClassInfo> mimes;
};
class PLATFORM_EXPORT PluginData : public RefCounted<PluginData> {
public:
static PassRefPtr<PluginData> create(const Page* page) { return adoptRef(new PluginData(page)); }
const Vector<PluginInfo>& plugins() const { return m_plugins; }
const Vector<MimeClassInfo>& mimes() const { return m_mimes; }
const Vector<size_t>& mimePluginIndices() const { return m_mimePluginIndices; }
bool supportsMimeType(const String& mimeType) const;
String pluginNameForMimeType(const String& mimeType) const;
String pluginFileForMimeType(const String& mimeType) const;
static void refresh();
private:
explicit PluginData(const Page*);
void initPlugins(const Page*);
const PluginInfo* pluginInfoForMimeType(const String& mimeType) const;
Vector<PluginInfo> m_plugins;
Vector<MimeClassInfo> m_mimes;
Vector<size_t> m_mimePluginIndices;
};
PLATFORM_EXPORT String getPluginMimeTypeFromExtension(const String& extension);
}
#endif