qwebplugindatabase_p.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #ifndef QWEBPLUGINDATABASE_H
  17. #define QWEBPLUGINDATABASE_H
  18. #include "qwebkitglobal.h"
  19. #include "qwebpluginfactory.h"
  20. #include <QtCore/qobject.h>
  21. #include <QtCore/qstringlist.h>
  22. namespace WebCore {
  23. class PluginDatabase;
  24. class PluginPackage;
  25. }
  26. class QWebPluginInfoPrivate;
  27. class QWEBKIT_EXPORT QWebPluginInfo {
  28. public:
  29. QWebPluginInfo();
  30. QWebPluginInfo(const QWebPluginInfo& other);
  31. QWebPluginInfo &operator=(const QWebPluginInfo& other);
  32. ~QWebPluginInfo();
  33. private:
  34. QWebPluginInfo(WebCore::PluginPackage* package);
  35. public:
  36. typedef QWebPluginFactory::MimeType MimeType;
  37. QString name() const;
  38. QString description() const;
  39. QList<MimeType> mimeTypes() const;
  40. bool supportsMimeType(const QString& mimeType) const;
  41. QString path() const;
  42. bool isNull() const;
  43. void setEnabled(bool enabled);
  44. bool isEnabled() const;
  45. bool operator==(const QWebPluginInfo& other) const;
  46. bool operator!=(const QWebPluginInfo& other) const;
  47. friend class QWebPluginDatabase;
  48. private:
  49. QWebPluginInfoPrivate* d;
  50. WebCore::PluginPackage* m_package;
  51. mutable QList<MimeType> m_mimeTypes;
  52. };
  53. class QWebPluginDatabasePrivate;
  54. class QWEBKIT_EXPORT QWebPluginDatabase : public QObject {
  55. Q_OBJECT
  56. private:
  57. QWebPluginDatabase(QObject* parent = 0);
  58. ~QWebPluginDatabase();
  59. public:
  60. QList<QWebPluginInfo> plugins() const;
  61. static QStringList defaultSearchPaths();
  62. QStringList searchPaths() const;
  63. void setSearchPaths(const QStringList& paths);
  64. void addSearchPath(const QString& path);
  65. void refresh();
  66. QWebPluginInfo pluginForMimeType(const QString& mimeType);
  67. void setPreferredPluginForMimeType(const QString& mimeType, const QWebPluginInfo& plugin);
  68. friend class QWebSettings;
  69. private:
  70. QWebPluginDatabasePrivate* d;
  71. WebCore::PluginDatabase* m_database;
  72. };
  73. #endif // QWEBPLUGINDATABASE_H