mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
PluginInterface: Replace createRequest with acceptNavigationRequest
This commit is contained in:
parent
7d9a07b379
commit
b83c845bab
@ -20,12 +20,7 @@
|
|||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QNetworkRequest>
|
#include <QWebEnginePage>
|
||||||
#if QTWEBENGINE_DISABLED
|
|
||||||
#include <QWebHitTestResult>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
|
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
|
|
||||||
@ -59,6 +54,7 @@ class QKeyEvent;
|
|||||||
class QWheelEvent;
|
class QWheelEvent;
|
||||||
|
|
||||||
class WebView;
|
class WebView;
|
||||||
|
class WebPage;
|
||||||
|
|
||||||
class PluginInterface
|
class PluginInterface
|
||||||
{
|
{
|
||||||
@ -86,9 +82,9 @@ public:
|
|||||||
virtual bool keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
virtual bool keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
||||||
virtual bool keyRelease(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
virtual bool keyRelease(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
|
||||||
|
|
||||||
virtual QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData) { Q_UNUSED(op) Q_UNUSED(request) Q_UNUSED(outgoingData) return 0; }
|
virtual bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) { Q_UNUSED(page); Q_UNUSED(url); Q_UNUSED(type); Q_UNUSED(isMainFrame); return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(PluginInterface, "QupZilla.Browser.PluginInterface/1.2")
|
Q_DECLARE_INTERFACE(PluginInterface, "QupZilla.Browser.PluginInterface/2.0")
|
||||||
|
|
||||||
#endif // PLUGININTERFACE_H
|
#endif // PLUGININTERFACE_H
|
||||||
|
@ -191,16 +191,17 @@ bool PluginProxy::processKeyRelease(const Qz::ObjectName &type, QObject* obj, QK
|
|||||||
return accepted;
|
return accepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply* PluginProxy::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData)
|
bool PluginProxy::acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame)
|
||||||
{
|
{
|
||||||
|
bool accepted = true;
|
||||||
|
|
||||||
foreach (PluginInterface* iPlugin, m_loadedPlugins) {
|
foreach (PluginInterface* iPlugin, m_loadedPlugins) {
|
||||||
QNetworkReply* reply = iPlugin->createRequest(op, request, outgoingData);
|
if (!iPlugin->acceptNavigationRequest(page, url, type, isMainFrame)) {
|
||||||
if (reply) {
|
accepted = false;
|
||||||
return reply;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return accepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginProxy::emitWebPageCreated(WebPage* page)
|
void PluginProxy::emitWebPageCreated(WebPage* page)
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
bool processKeyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event);
|
bool processKeyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event);
|
||||||
bool processKeyRelease(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event);
|
bool processKeyRelease(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event);
|
||||||
|
|
||||||
QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData);
|
bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame);
|
||||||
|
|
||||||
void emitWebPageCreated(WebPage* page);
|
void emitWebPageCreated(WebPage* page);
|
||||||
void emitWebPageDeleted(WebPage* page);
|
void emitWebPageDeleted(WebPage* page);
|
||||||
|
@ -785,6 +785,11 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio
|
|||||||
{
|
{
|
||||||
m_lastRequestUrl = url;
|
m_lastRequestUrl = url;
|
||||||
|
|
||||||
|
if (!mApp->plugins()->acceptNavigationRequest(this, url, type, isMainFrame))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return QWebEnginePage::acceptNavigationRequest(url, type, isMainFrame);
|
||||||
|
|
||||||
#if QTWEBENGINE_DISABLED
|
#if QTWEBENGINE_DISABLED
|
||||||
if (type == QWebEnginePage::NavigationTypeFormResubmitted) {
|
if (type == QWebEnginePage::NavigationTypeFormResubmitted) {
|
||||||
// Don't show this dialog if app is still starting
|
// Don't show this dialog if app is still starting
|
||||||
@ -800,9 +805,6 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return QWebEnginePage::acceptNavigationRequest(url, type, isMainFrame);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::addAdBlockRule(const AdBlockRule* rule, const QUrl &url)
|
void WebPage::addAdBlockRule(const AdBlockRule* rule, const QUrl &url)
|
||||||
|
Loading…
Reference in New Issue
Block a user