blob: a73c712f6aa509db39b0b424c1a6ebeb2993cccf (
plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
// Copyright (C) 2016 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
// Qt-Security score:significant reason:default
#ifndef QWEBENGINEWEBVIEW_P_H
#define QWEBENGINEWEBVIEW_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qobject.h>
#include <QtCore/qurl.h>
#include <QtGui/qwindow.h>
#include <QtQml/qqmlcomponent.h>
#include <QtWebView/private/qwebview_p.h>
#include <QtWebEngineQuick/QQuickWebEngineProfile>
#include <QtWebEngineQuick/private/qquickwebenginesettings_p.h>
#include <QtCore/qpointer.h>
#include <QVariant>
QT_BEGIN_NAMESPACE
class QQuickItem;
class QQuickWebEngineView;
class QQuickWindow;
class QWebEngineLoadingInfo;
class QNetworkCookie;
class QWebEngineWebViewPrivate;
class QWebEngineWebViewSettingsPrivate : public QWebViewSettingsPrivate
{
Q_OBJECT
public:
explicit QWebEngineWebViewSettingsPrivate(QWebEngineWebViewPrivate *p = nullptr);
bool localStorageEnabled() const override;
bool javaScriptEnabled() const override;
bool localContentCanAccessFileUrls() const override;
bool allowFileAccess() const override;
void setLocalContentCanAccessFileUrls(bool enabled) override;
void setJavaScriptEnabled(bool enabled) override;
void setLocalStorageEnabled(bool enabled) override;
void setAllowFileAccess(bool enabled) override;
void init(QQuickWebEngineSettings *settings);
private:
QPointer<QQuickWebEngineSettings> m_settings;
bool m_localStorageEnabled = true;
bool m_javaScriptEnabled = true;
bool m_localContentCanAccessFileUrlsEnabled = true;
bool m_allowFileAccessEnabled = true;
};
class QWebEngineWebViewPrivate : public QWebViewPrivate
{
Q_OBJECT
public:
explicit QWebEngineWebViewPrivate(QWebView *p);
~QWebEngineWebViewPrivate() override;
void initialize(QObject *context) override;
QString httpUserAgent() const override;
void setHttpUserAgent(const QString &userAgent) override;
QUrl url() const override;
void setUrl(const QUrl &url) override;
bool canGoBack() const override;
bool canGoForward() const override;
QString title() const override;
int loadProgress() const override;
bool isLoading() const override;
QWebViewSettingsPrivate *settings() const override;
QWindow *nativeWindow() const override { return nullptr; }
void goBack() override;
void goForward() override;
void reload() override;
void stop() override;
void loadHtml(const QString &html, const QUrl &baseUrl = QUrl()) override;
void setCookie(const QString &domain, const QString &name,
const QString &value) override;
void deleteCookie(const QString &domain, const QString &name) override;
void deleteAllCookies() override;
void runJavaScript(const QString &script,
const std::function<void(const QVariant &)> &resultCallback) override;
private Q_SLOTS:
void q_urlChanged();
void q_loadProgressChanged();
void q_titleChanged();
void q_loadingChanged(const QWebEngineLoadingInfo &loadRequest);
void q_profileChanged();
void q_httpUserAgentChanged();
void q_cookieAdded(const QNetworkCookie &cookie);
void q_cookieRemoved(const QNetworkCookie &cookie);
private:
friend class QWebEngineWebViewSettingsPrivate;
QQuickWebEngineProfile *m_profile = nullptr;
mutable QWebEngineWebViewSettingsPrivate *m_settings = nullptr;
QString m_httpUserAgent;
struct QQuickWebEngineViewPtr
{
inline QQuickWebEngineView *operator->() const
{
if (!m_webEngineView)
init();
return m_webEngineView.get();
}
void init() const;
QWebEngineWebViewPrivate *m_parent;
mutable std::unique_ptr<QQuickWebEngineView> m_webEngineView;
} m_webEngineView;
struct QWebEngineCookieStorePtr
{
inline QWebEngineCookieStore *operator->() const
{
if (!m_cookieStore)
init();
return m_cookieStore;
}
void init() const;
QQuickWebEngineViewPtr *m_webEngineViewPtr = nullptr;
mutable QWebEngineCookieStore *m_cookieStore = nullptr;
} m_cookieStore;
QQuickItem *m_parentItem;
QQuickWindow *m_window;
bool m_ownsWindow;
};
QT_END_NAMESPACE
#endif // QWEBENGINEWEBVIEW_P_H
|