diff options
| author | Martin Negyokru <negyokru@inf.u-szeged.hu> | 2024-10-31 16:07:11 +0100 |
|---|---|---|
| committer | Martin Negyokru <negyokru@inf.u-szeged.hu> | 2025-05-29 08:54:07 +0200 |
| commit | 91f45c8e59bc4b9afd7b3a52d3c05e339a19ce71 (patch) | |
| tree | a07418490848e27e46389d396fa628768000b671 /src/core/api/qwebengineextensionmanager.h | |
| parent | 7b22a723e8515329dd334d35377f86e371f29c7d (diff) | |
Add API for extension management
Introduce QWebEngineExtensionManager and QWebEngineExtensionInfo.
The manager has methods to load and install Chrome extensions from the filesystem.
QWebEngineExtensionInfo provides information about a loaded extension.
The current state of our js extension API support is very limited
meaning most of the extensions downloaded from Chrome extension store
won't work. Adding support for these APIs will be done in followup patches.
Fixes: QTBUG-118452
Task-number: QTBUG-61676
Change-Id: I017ad5e8d2ba963afbd2f31ac36fee9451a951bd
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/api/qwebengineextensionmanager.h')
| -rw-r--r-- | src/core/api/qwebengineextensionmanager.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/core/api/qwebengineextensionmanager.h b/src/core/api/qwebengineextensionmanager.h new file mode 100644 index 000000000..4bff8c304 --- /dev/null +++ b/src/core/api/qwebengineextensionmanager.h @@ -0,0 +1,60 @@ +// Copyright (C) 2025 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWEBENGINEEXTENSIONMANAGER_H_ +#define QWEBENGINEEXTENSIONMANAGER_H_ + +#include <QtWebEngineCore/qtwebenginecoreglobal.h> + +#if QT_CONFIG(webengine_extensions) + +#include <QtCore/qlist.h> +#include <QtCore/qstring.h> +#include <QtCore/qobject.h> +#include <QtWebEngineCore/qwebengineextensioninfo.h> + +namespace QtWebEngineCore { +class ExtensionManager; +class ProfileAdapter; +} + +QT_BEGIN_NAMESPACE + +class Q_WEBENGINECORE_EXPORT QWebEngineExtensionManager : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString installDirectory READ installDirectory FINAL) + Q_PROPERTY(QList<QWebEngineExtensionInfo> extensions READ extensions FINAL) +public: + QML_NAMED_ELEMENT(WebEngineExtensionManager) + QML_UNCREATABLE("") + QML_ADDED_IN_VERSION(6, 10) + + ~QWebEngineExtensionManager() override; + Q_INVOKABLE void loadExtension(const QString &path); + Q_INVOKABLE void installExtension(const QString &path); + Q_INVOKABLE void unloadExtension(const QWebEngineExtensionInfo &extension); + Q_INVOKABLE void uninstallExtension(const QWebEngineExtensionInfo &extension); + Q_INVOKABLE void setExtensionEnabled(const QWebEngineExtensionInfo &extension, bool enabled); + + QString installDirectory(); + QList<QWebEngineExtensionInfo> extensions(); + +Q_SIGNALS: + void extensionLoadFinished(const QWebEngineExtensionInfo &extension); + void extensionInstallFinished(const QWebEngineExtensionInfo &extension); + void extensionUnloadFinished(const QWebEngineExtensionInfo &extension); + void extensionUninstallFinished(const QWebEngineExtensionInfo &extension); + +private: + friend class QtWebEngineCore::ProfileAdapter; + Q_DISABLE_COPY(QWebEngineExtensionManager) + + QWebEngineExtensionManager(QtWebEngineCore::ExtensionManager *d); + QtWebEngineCore::ExtensionManager *d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QT_CONFIG(webengine_extensions) +#endif // QWEBENGINEEXTENSIONMANAGER_H_ |
