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 enum PluginLoadClientPolicy : uint8_t {
33 // No client-specific plug-in load policy has been defined. The plug-in should be visible in navigator.plugins and WebKit should synchronously
34 // ask the client whether the plug-in should be loaded.
35 PluginLoadClientPolicyUndefined = 0,
37 // The plug-in module should be blocked from being instantiated. The plug-in should be hidden in navigator.plugins.
38 PluginLoadClientPolicyBlock,
40 // WebKit should synchronously ask the client whether the plug-in should be loaded. The plug-in should be visible in navigator.plugins.
41 PluginLoadClientPolicyAsk,
43 // The plug-in module may be loaded if WebKit is not blocking it.
44 PluginLoadClientPolicyAllow,
46 // The plug-in module should be loaded irrespective of whether WebKit has asked it to be blocked.
47 PluginLoadClientPolicyAllowAlways,
50 struct MimeClassInfo {
53 Vector<String> extensions;
56 inline bool operator==(const MimeClassInfo& a, const MimeClassInfo& b)
58 return a.type == b.type && a.desc == b.desc && a.extensions == b.extensions;
65 Vector<MimeClassInfo> mimes;
66 bool isApplicationPlugin;
68 PluginLoadClientPolicy clientLoadPolicy;
71 String bundleIdentifier;
76 // FIXME: merge with PluginDatabase in the future
77 class PluginData : public RefCounted<PluginData> {
79 static Ref<PluginData> create(const Page* page) { return adoptRef(*new PluginData(page)); }
81 const Vector<PluginInfo>& plugins() const { return m_plugins; }
82 Vector<PluginInfo> webVisiblePlugins() const;
83 WEBCORE_EXPORT void getWebVisibleMimesAndPluginIndices(Vector<MimeClassInfo>&, Vector<size_t>&) const;
85 enum AllowedPluginTypes {
87 OnlyApplicationPlugins
90 WEBCORE_EXPORT bool supportsWebVisibleMimeType(const String& mimeType, const AllowedPluginTypes) const;
91 String pluginNameForWebVisibleMimeType(const String& mimeType) const;
92 String pluginFileForWebVisibleMimeType(const String& mimeType) const;
94 static void refresh();
97 explicit PluginData(const Page*);
99 bool getPluginInfoForWebVisibleMimeType(const String& mimeType, PluginInfo&) const;
102 #if defined ENABLE_WEB_REPLAY && ENABLE_WEB_REPLAY
103 PluginData(Vector<PluginInfo> plugins)
110 Vector<PluginInfo> m_plugins;