1 /* 2 Copyright (C) 2009 Jakub Wieczorek <faw217 (at) gmail.com> 3 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. 8 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. 13 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. 18 */ 19 20 #ifndef QWEBPLUGINDATABASE_H 21 #define QWEBPLUGINDATABASE_H 22 23 #include "qwebkitglobal.h" 24 #include "qwebpluginfactory.h" 25 26 #include <QtCore/qobject.h> 27 #include <QtCore/qstringlist.h> 28 29 namespace WebCore { 30 class PluginDatabase; 31 class PluginPackage; 32 } 33 34 class QWebPluginInfoPrivate; 35 class QWEBKIT_EXPORT QWebPluginInfo { 36 public: 37 QWebPluginInfo(); 38 QWebPluginInfo(const QWebPluginInfo& other); 39 QWebPluginInfo &operator=(const QWebPluginInfo& other); 40 ~QWebPluginInfo(); 41 42 private: 43 QWebPluginInfo(WebCore::PluginPackage* package); 44 45 public: 46 typedef QWebPluginFactory::MimeType MimeType; 47 48 QString name() const; 49 QString description() const; 50 QList<MimeType> mimeTypes() const; 51 bool supportsMimeType(const QString& mimeType) const; 52 QString path() const; 53 54 bool isNull() const; 55 56 void setEnabled(bool enabled); 57 bool isEnabled() const; 58 59 bool operator==(const QWebPluginInfo& other) const; 60 bool operator!=(const QWebPluginInfo& other) const; 61 62 friend class QWebPluginDatabase; 63 64 private: 65 QWebPluginInfoPrivate* d; 66 WebCore::PluginPackage* m_package; 67 mutable QList<MimeType> m_mimeTypes; 68 }; 69 70 class QWebPluginDatabasePrivate; 71 class QWEBKIT_EXPORT QWebPluginDatabase : public QObject { 72 Q_OBJECT 73 74 private: 75 QWebPluginDatabase(QObject* parent = 0); 76 ~QWebPluginDatabase(); 77 78 public: 79 QList<QWebPluginInfo> plugins() const; 80 81 static QStringList defaultSearchPaths(); 82 QStringList searchPaths() const; 83 void setSearchPaths(const QStringList& paths); 84 void addSearchPath(const QString& path); 85 86 void refresh(); 87 88 QWebPluginInfo pluginForMimeType(const QString& mimeType); 89 void setPreferredPluginForMimeType(const QString& mimeType, const QWebPluginInfo& plugin); 90 91 friend class QWebSettings; 92 93 private: 94 QWebPluginDatabasePrivate* d; 95 WebCore::PluginDatabase* m_database; 96 }; 97 98 #endif // QWEBPLUGINDATABASE_H 99