File indexing completed on 2024-05-12 04:58:17
0001 /* ============================================================ 0002 * Falkon - Qt web browser 0003 * Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #ifndef PLUGINPROXY_H 0019 #define PLUGINPROXY_H 0020 0021 #include "plugins.h" 0022 #include "qzcommon.h" 0023 0024 #include <QWebEnginePage> 0025 0026 class WebPage; 0027 class BrowserWindow; 0028 0029 class FALKON_EXPORT PluginProxy : public Plugins 0030 { 0031 Q_OBJECT 0032 public: 0033 enum EventHandlerType { MouseDoubleClickHandler, MousePressHandler, MouseReleaseHandler, 0034 MouseMoveHandler, KeyPressHandler, KeyReleaseHandler, 0035 WheelEventHandler 0036 }; 0037 0038 explicit PluginProxy(QObject *parent = nullptr); 0039 0040 void registerAppEventHandler(EventHandlerType type, PluginInterface* obj); 0041 0042 void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &r); 0043 void populateExtensionsMenu(QMenu *menu); 0044 0045 bool processMouseDoubleClick(Qz::ObjectName type, QObject* obj, QMouseEvent* event); 0046 bool processMousePress(Qz::ObjectName type, QObject* obj, QMouseEvent* event); 0047 bool processMouseRelease(Qz::ObjectName type, QObject* obj, QMouseEvent* event); 0048 bool processMouseMove(Qz::ObjectName type, QObject* obj, QMouseEvent* event); 0049 0050 bool processWheelEvent(Qz::ObjectName type, QObject* obj, QWheelEvent* event); 0051 0052 bool processKeyPress(Qz::ObjectName type, QObject* obj, QKeyEvent* event); 0053 bool processKeyRelease(Qz::ObjectName type, QObject* obj, QKeyEvent* event); 0054 0055 bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame); 0056 0057 void emitWebPageCreated(WebPage* page); 0058 void emitWebPageDeleted(WebPage* page); 0059 0060 void emitMainWindowCreated(BrowserWindow* window); 0061 void emitMainWindowDeleted(BrowserWindow* window); 0062 0063 Q_SIGNALS: 0064 void webPageCreated(WebPage* page); 0065 void webPageDeleted(WebPage* page); 0066 0067 void mainWindowCreated(BrowserWindow* window); 0068 void mainWindowDeleted(BrowserWindow* window); 0069 0070 private Q_SLOTS: 0071 void pluginUnloaded(PluginInterface* plugin); 0072 0073 private: 0074 QList<PluginInterface*> m_mouseDoubleClickHandlers; 0075 QList<PluginInterface*> m_mousePressHandlers; 0076 QList<PluginInterface*> m_mouseReleaseHandlers; 0077 QList<PluginInterface*> m_mouseMoveHandlers; 0078 0079 QList<PluginInterface*> m_wheelEventHandlers; 0080 0081 QList<PluginInterface*> m_keyPressHandlers; 0082 QList<PluginInterface*> m_keyReleaseHandlers; 0083 }; 0084 0085 #endif // PLUGINPROXY_H