1 /* 2 Copyright (C) 2009 Jakub Wieczorek <faw217@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 PluginPackage; 31 } 32 33 class QWebPluginInfoPrivate; 34 class QWEBKIT_EXPORT QWebPluginInfo { 35 public: 36 QWebPluginInfo(); 37 QWebPluginInfo(const QWebPluginInfo& other); 38 QWebPluginInfo &operator=(const QWebPluginInfo& other); 39 ~QWebPluginInfo(); 40 41 private: 42 QWebPluginInfo(WebCore::PluginPackage* plugin); 43 44 public: 45 typedef QWebPluginFactory::MimeType MimeType; 46 47 QString name() const; 48 QString description() const; 49 QList<MimeType> mimeTypes() const; 50 bool supportsMimeType(const QString& mimeType) const; 51 QString path() const; 52 53 bool isNull() const; 54 55 void setEnabled(bool enabled); 56 bool isEnabled() const; 57 58 bool operator==(const QWebPluginInfo& other) const; 59 bool operator!=(const QWebPluginInfo& other) const; 60 61 friend class QWebPluginDatabase; 62 63 private: 64 QWebPluginInfoPrivate *d; 65 }; 66 67 class QWebPluginDatabasePrivate; 68 class QWEBKIT_EXPORT QWebPluginDatabase : public QObject { 69 Q_OBJECT 70 71 private: 72 QWebPluginDatabase(QObject* parent = 0); 73 ~QWebPluginDatabase(); 74 75 public: 76 QList<QWebPluginInfo> plugins() const; 77 78 static QStringList defaultSearchPaths(); 79 QStringList searchPaths() const; 80 void setSearchPaths(const QStringList& paths); 81 void addSearchPath(const QString& path); 82 83 void refresh(); 84 85 QWebPluginInfo pluginForMimeType(const QString& mimeType); 86 void setPreferredPluginForMimeType(const QString& mimeType, const QWebPluginInfo& plugin); 87 88 friend class QWebSettings; 89 90 private: 91 QWebPluginDatabasePrivate *d; 92 }; 93 94 #endif // QWEBPLUGINDATABASE_H 95