| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef WEBENGINEPAGE_H |
| 4 | #define WEBENGINEPAGE_H |
| 5 | |
| 6 | #include <QWebEnginePage> |
| 7 | |
| 8 | class WebEngineViewer; |
| 9 | |
| 10 | class WebEnginePage : public QWebEnginePage { |
| 11 | Q_OBJECT |
| 12 | |
| 13 | public: |
| 14 | explicit WebEnginePage(QObject* parent = nullptr); |
| 15 | |
| 16 | WebEngineViewer* view() const; |
| 17 | |
| 18 | signals: |
| 19 | void domIsIdle(); |
| 20 | |
| 21 | public slots: |
| 22 | QString pageHtml(const QString& url); |
| 23 | |
| 24 | private slots: |
| 25 | void hideUnwantedElements(); |
| 26 | |
| 27 | protected: |
| 28 | virtual void javaScriptAlert(const QUrl& security_origin, const QString& msg); |
| 29 | virtual bool acceptNavigationRequest(const QUrl& url, NavigationType type, bool is_main_frame); |
| 30 | virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, |
| 31 | const QString& message, |
| 32 | int line_number, |
| 33 | const QString& source_id); |
| 34 | }; |
| 35 | |
| 36 | #endif // WEBENGINEPAGE_H |