Changeset View
Changeset View
Standalone View
Standalone View
webenginepart/src/webenginepartcookiejar.h
Show All 29 Lines | |||||
30 | #include <QHash> | 30 | #include <QHash> | ||
31 | #include <QUrl> | 31 | #include <QUrl> | ||
32 | #include <QWebEngineCookieStore> | 32 | #include <QWebEngineCookieStore> | ||
33 | #include <QStringList> | 33 | #include <QStringList> | ||
34 | #include <QVariant> | 34 | #include <QVariant> | ||
35 | #include <QDebug> | 35 | #include <QDebug> | ||
36 | #include <QDBusInterface> | 36 | #include <QDBusInterface> | ||
37 | #include <QSet> | 37 | #include <QSet> | ||
38 | #include <QtWebEngine/QtWebEngineVersion> | ||||
38 | 39 | | |||
39 | class QWidget; | 40 | class QWidget; | ||
40 | class QWebEngineProfile; | 41 | class QWebEngineProfile; | ||
41 | 42 | | |||
42 | /** | 43 | /** | ||
43 | * @brief Class which takes care of synchronizing Chromium cookies from `QWebEngineCookieStore` with KIO | 44 | * @brief Class which takes care of synchronizing Chromium cookies from `QWebEngineCookieStore` with KIO | ||
44 | */ | 45 | */ | ||
45 | class WebEnginePartCookieJar : public QObject | 46 | class WebEnginePartCookieJar : public QObject | ||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | 107 | private: | |||
227 | * `KCookieServer::findCookies` contains an entry for each value in #CookieDetails) | 228 | * `KCookieServer::findCookies` contains an entry for each value in #CookieDetails) | ||
228 | * | 229 | * | ||
229 | * @param data: the data returned by `KCookieServer::findCookies`. It can contain data for more than one cookie, but only one will be parsed | 230 | * @param data: the data returned by `KCookieServer::findCookies`. It can contain data for more than one cookie, but only one will be parsed | ||
230 | * @param start: the position in the list where the data for the cookie starts. | 231 | * @param start: the position in the list where the data for the cookie starts. | ||
231 | * @return The cookie described by the data and its host | 232 | * @return The cookie described by the data and its host | ||
232 | */ | 233 | */ | ||
233 | static QNetworkCookie parseKIOCookie(const QStringList &data, int start); | 234 | static QNetworkCookie parseKIOCookie(const QStringList &data, int start); | ||
234 | 235 | | |||
236 | #if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5,11,0) | ||||
235 | /** | 237 | /** | ||
236 | * @brief Function used to filter cookies | 238 | * @brief Function used to filter cookies | ||
237 | * | 239 | * | ||
238 | * In theory, this function should use the configuration chosen by the user in the Cookies KCM. However, this can't be done for several reasons: | 240 | * In theory, this function should use the configuration chosen by the user in the Cookies KCM. However, this can't be done for several reasons: | ||
239 | * - this function doesn't have the cookies details availlable and they're needed for the "Ask" policy | 241 | * - this function doesn't have the cookies details availlable and they're needed for the "Ask" policy | ||
240 | * - this function doesn't know the URL of the cookie (even if `QWebEngineCookieStore::FilterRequest::origin` could be used as a substitute | 242 | * - this function doesn't know the URL of the cookie (even if `QWebEngineCookieStore::FilterRequest::origin` could be used as a substitute | ||
241 | * - if the policy is "Ask" and the question was asked here, it would be asked again when adding the cookie to `KCookieJar`. | 243 | * - if the policy is "Ask" and the question was asked here, it would be asked again when adding the cookie to `KCookieJar`. | ||
242 | * Because of these reasons, the only setting from the KCM which is applied here is whether to accept and reject cross domain cookies. Other settings | 244 | * Because of these reasons, the only setting from the KCM which is applied here is whether to accept and reject cross domain cookies. Other settings | ||
243 | * from the KCM will be enforced by the addCookies(). | 245 | * from the KCM will be enforced by the addCookies(). | ||
244 | * | 246 | * | ||
245 | * @param req the request to filter | 247 | * @param req the request to filter | ||
246 | * @return ``false` for third party cookies if the user chose to block them in the KCM and `true` otherwise | 248 | * @return ``false` for third party cookies if the user chose to block them in the KCM and `true` otherwise | ||
247 | * @internal Besides filtering cookie requests, this function also stores the `origin` member of request in the #m_lastRequestOrigin. | 249 | * @internal Besides filtering cookie requests, this function also stores the `origin` member of request in the #m_lastRequestOrigin. | ||
248 | * @endinternal | 250 | * @endinternal | ||
249 | * @sa addCookie() | 251 | * @sa addCookie() | ||
250 | */ | 252 | */ | ||
251 | bool filterCookie(const QWebEngineCookieStore::FilterRequest &req); | 253 | bool filterCookie(const QWebEngineCookieStore::FilterRequest &req); | ||
254 | #endif //QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5,11,0) | ||||
252 | 255 | | |||
253 | /** | 256 | /** | ||
254 | * @brief Adds a dot in front of a domain if it's not already there | 257 | * @brief Adds a dot in front of a domain if it's not already there | ||
255 | * | 258 | * | ||
256 | * @param dom the domain | 259 | * @param dom the domain | ||
257 | * @return `dom` if it already starts with a dot and `dom` preceeded by a dot otherwise | 260 | * @return `dom` if it already starts with a dot and `dom` preceeded by a dot otherwise | ||
258 | * | 261 | * | ||
259 | * @internal | 262 | * @internal | ||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |