aboutsummaryrefslogtreecommitdiff
path: root/src/webenginepage.h
blob: a8241d02a3bf476ac3bb22170bb37031f691f9b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef WEBENGINEPAGE_H
#define WEBENGINEPAGE_H


#include <QFileDialog>
#include <QWebEngineFullScreenRequest>
#include <QWebEngineNotification>
#include <QWebEngineProfile>

#include <QWebEnginePage>
#include <QDesktopServices>
#include <QMessageBox>
#include <QImageReader>
#include <QWebEngineCertificateError>
#include <QAuthenticator>

#include <QWebEngineRegisterProtocolHandlerRequest>
#include <QWebEngineFullScreenRequest>

#include <QSettings>

#include "ui_certificateerrordialog.h"
#include "ui_passworddialog.h"

class WebEnginePage : public QWebEnginePage
{
    Q_OBJECT
public:
    WebEnginePage(QWebEngineProfile *profile, QObject *parent = nullptr);

private:
    QSettings settings;
protected:
    bool acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) override;
    QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type) override;
    bool certificateError(const QWebEngineCertificateError &error) override;
    QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes);

public slots:
    void handleFeaturePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
    void handleLoadFinished(bool ok);

private slots:
    void handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth);
    void handleProxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth, const QString &proxyHost);
    void handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request);
#if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
    void handleSelectClientCertificate(QWebEngineClientCertificateSelection clientCertSelection);
#endif
    void fullScreenRequestedByPage(QWebEngineFullScreenRequest request);
};

#endif // WEBENGINEPAGE_H