2
Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
23
#include <wtf/RefCounted.h>
24
#include <wtf/Vector.h>
25
#include <wtf/text/WTFString.h>
32
struct MimeClassInfo {
35
Vector<String> extensions;
37
MimeClassInfo isolatedCopy() const
40
clone.type = type.isolatedCopy();
41
clone.desc = desc.isolatedCopy();
42
for (unsigned i = 0; i < extensions.size(); ++i)
43
clone.extensions.append(extensions[i].isolatedCopy());
48
inline bool operator==(const MimeClassInfo& a, const MimeClassInfo& b)
50
return a.type == b.type && a.desc == b.desc && a.extensions == b.extensions;
57
Vector<MimeClassInfo> mimes;
59
PluginInfo isolatedCopy() const
62
clone.name = name.isolatedCopy();
63
clone.file = file.isolatedCopy();
64
clone.desc = desc.isolatedCopy();
65
for (unsigned i = 0; i < mimes.size(); ++i)
66
clone.mimes.append(mimes[i].isolatedCopy());
71
// FIXME: merge with PluginDatabase in the future
72
class PluginData : public RefCounted<PluginData> {
74
static PassRefPtr<PluginData> create(const Page* page) { return adoptRef(new PluginData(page)); }
76
const Vector<PluginInfo>& plugins() const { return m_plugins; }
77
const Vector<MimeClassInfo>& mimes() const { return m_mimes; }
78
const Vector<size_t>& mimePluginIndices() const { return m_mimePluginIndices; }
80
bool supportsMimeType(const String& mimeType) const;
81
String pluginNameForMimeType(const String& mimeType) const;
82
String pluginFileForMimeType(const String& mimeType) const;
84
static void refresh();
87
explicit PluginData(const Page*);
88
void initPlugins(const Page*);
89
const PluginInfo* pluginInfoForMimeType(const String& mimeType) const;
91
Vector<PluginInfo> m_plugins;
92
Vector<MimeClassInfo> m_mimes;
93
Vector<size_t> m_mimePluginIndices;