void deleteAllCookies(const NetworkStorageSession& session) { ASSERT_UNUSED(session, !session.context()); // Not yet implemented for cookie jars other than the shared one. SharedCookieJarQt* jar = SharedCookieJarQt::shared(); if (jar) jar->deleteAllCookies(); }
String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url) { QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared(); if (!jar) return String(); QList<QNetworkCookie> cookies = jar->cookiesForUrl(QUrl(url)); if (cookies.isEmpty()) return String(); QStringList resultCookies; foreach (QNetworkCookie networkCookie, cookies) resultCookies.append(QString::fromLatin1(networkCookie.toRawForm(QNetworkCookie::NameAndValueOnly).constData())); return resultCookies.join(QLatin1String("; ")); }
void deleteCookiesForHostname(const NetworkStorageSession& session, const String& hostname) { ASSERT_UNUSED(session, !session.context()); // Not yet implemented for cookie jars other than the shared one. SharedCookieJarQt* jar = SharedCookieJarQt::shared(); if (jar) jar->deleteCookiesForHostname(hostname); }
void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames) { ASSERT_UNUSED(session, !session.context()); // Not yet implemented for cookie jars other than the shared one. SharedCookieJarQt* jar = SharedCookieJarQt::shared(); if (jar) jar->getHostnamesWithCookies(hostnames); }
String cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url) { QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared(); if (!jar) return String(); QUrl urlForCookies(url); QUrl firstPartyUrl(firstParty); if (!thirdPartyCookiePolicyPermits(session.context(), urlForCookies, firstPartyUrl)) return String(); QList<QNetworkCookie> cookies = jar->cookiesForUrl(urlForCookies); if (cookies.isEmpty()) return String(); QStringList resultCookies; foreach (const QNetworkCookie& networkCookie, cookies) { if (networkCookie.isHttpOnly()) continue; resultCookies.append(QString::fromLatin1(networkCookie.toRawForm(QNetworkCookie::NameAndValueOnly).constData())); } return resultCookies.join(QLatin1String("; ")); }
bool cookiesEnabled(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& /*url*/) { QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared(); return !!jar; }
String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url) { // FIXME: include HttpOnly cookie return cookiesForDOM(session.context(), firstParty, url); }