Changeset View
Changeset View
Standalone View
Standalone View
webenginepart/src/webenginepartcookiejar.h
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 115 | private: | |||
---|---|---|---|---|---|
120 | * There's no sure way to find the window which received a cookie, so this function chooses the active window | 120 | * There's no sure way to find the window which received a cookie, so this function chooses the active window | ||
121 | * if there's one (according to `QApplication::activeWindow`) or the first widget in `QApplication::topLevelWidgets` | 121 | * if there's one (according to `QApplication::activeWindow`) or the first widget in `QApplication::topLevelWidgets` | ||
122 | * for which `QWidget::isWindow` is `true` and which doesn't have a parent. | 122 | * for which `QWidget::isWindow` is `true` and which doesn't have a parent. | ||
123 | * | 123 | * | ||
124 | * @return the ID of the window determined as described above or 0 if no such a window can be found | 124 | * @return the ID of the window determined as described above or 0 if no such a window can be found | ||
125 | */ | 125 | */ | ||
126 | static qlonglong findWinID(); | 126 | static qlonglong findWinID(); | ||
127 | 127 | | |||
128 | using CookieList = QList<QNetworkCookie>; | 128 | struct CookieWithUrl { | ||
129 | QNetworkCookie cookie; | ||||
130 | QUrl url; | ||||
131 | }; | ||||
132 | | ||||
dfaure: QVector is a much better container when sizeof(T) > sizeof(void*) | |||||
133 | using CookieUrlList = QVector<CookieWithUrl>; | ||||
134 | using CookieList = QVector<QNetworkCookie>; | ||||
129 | 135 | | |||
130 | /** | 136 | /** | ||
131 | * @brief An identifier for a cookie | 137 | * @brief An identifier for a cookie | ||
132 | * | 138 | * | ||
133 | * The identifier is made by the cookie's name, domain and path | 139 | * The identifier is made by the cookie's name, domain and path | ||
134 | */ | 140 | */ | ||
135 | struct CookieIdentifier{ | 141 | struct CookieIdentifier{ | ||
136 | 142 | | |||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
215 | * @note this function is asynchronous because it calls `QWebEngineCookieStore::setCookie` | 221 | * @note this function is asynchronous because it calls `QWebEngineCookieStore::setCookie` | ||
216 | */ | 222 | */ | ||
217 | void loadKIOCookies(); | 223 | void loadKIOCookies(); | ||
218 | 224 | | |||
219 | /** | 225 | /** | ||
220 | * @brief Finds all cookies stored in `KCookieJar` | 226 | * @brief Finds all cookies stored in `KCookieJar` | ||
221 | * @return a list of the cookies in `KCookieJar` | 227 | * @return a list of the cookies in `KCookieJar` | ||
222 | */ | 228 | */ | ||
223 | CookieList findKIOCookies(); | 229 | CookieUrlList findKIOCookies(); | ||
224 | 230 | | |||
225 | /** | 231 | /** | ||
226 | * @brief Enum describing the possible fields to pas to `KCookieServer::findCookies` using DBus. | 232 | * @brief Enum describing the possible fields to pas to `KCookieServer::findCookies` using DBus. | ||
227 | * | 233 | * | ||
228 | * The values are the same as those of `CookieDetails` in `kio/src/kioslaves/http/kcookiejar/kcookieserver.cpp` | 234 | * The values are the same as those of `CookieDetails` in `kio/src/kioslaves/http/kcookiejar/kcookieserver.cpp` | ||
229 | */ | 235 | */ | ||
230 | enum class CookieDetails {domain=0, path=1, name=2, host=3, value=4, expirationDate=5, protocolVersion=6, secure=7}; | 236 | enum class CookieDetails {domain=0, path=1, name=2, host=3, value=4, expirationDate=5, protocolVersion=6, secure=7}; | ||
231 | 237 | | |||
232 | /** | 238 | /** | ||
233 | * @brief Parses the value returned by `KCookieServer::findCookies` for a single cookie | 239 | * @brief Parses the value returned by `KCookieServer::findCookies` for a single cookie | ||
234 | * | 240 | * | ||
235 | * This function assumes that all possible data for the cookie is available (that is, that the list returned by | 241 | * This function assumes that all possible data for the cookie is available (that is, that the list returned by | ||
236 | * `KCookieServer::findCookies` contains an entry for each value in #CookieDetails) | 242 | * `KCookieServer::findCookies` contains an entry for each value in #CookieDetails) | ||
237 | * | 243 | * | ||
238 | * @param data: the data returned by `KCookieServer::findCookies`. It can contain data for more than one cookie, but only one will be parsed | 244 | * @param data: the data returned by `KCookieServer::findCookies`. It can contain data for more than one cookie, but only one will be parsed | ||
239 | * @param start: the position in the list where the data for the cookie starts. | 245 | * @param start: the position in the list where the data for the cookie starts. | ||
240 | * @return The cookie described by the data and its host | 246 | * @return The cookie described by the data and its host | ||
241 | */ | 247 | */ | ||
242 | static QNetworkCookie parseKIOCookie(const QStringList &data, int start); | 248 | static CookieWithUrl parseKIOCookie(const QStringList &data, int start); | ||
243 | 249 | | |||
244 | #if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5,11,0) | 250 | #if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5,11,0) | ||
245 | /** | 251 | /** | ||
246 | * @brief Function used to filter cookies | 252 | * @brief Function used to filter cookies | ||
247 | * | 253 | * | ||
248 | * 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: | 254 | * 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: | ||
249 | * - this function doesn't have the cookies details and they're needed for the "Ask" policy | 255 | * - this function doesn't have the cookies details and they're needed for the "Ask" policy | ||
250 | * - this function doesn't know the URL of the cookie (even if `QWebEngineCookieStore::FilterRequest::origin` could be used as a substitute | 256 | * - this function doesn't know the URL of the cookie (even if `QWebEngineCookieStore::FilterRequest::origin` could be used as a substitute | ||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |
QVector is a much better container when sizeof(T) > sizeof(void*)