String cookies(const Document* document, const KURL& url) { NetworkingContext* context = networkingContext(document); if (!context) return String(); QNetworkCookieJar* jar = context->networkAccessManager()->cookieJar(); QUrl urlForCookies(url); QUrl firstPartyUrl(document->firstPartyForCookies()); if (!thirdPartyCookiePolicyPermits(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 Document* document) { NetworkingContext* context = networkingContext(document); if (!context) return false; return context->networkAccessManager()->cookieJar(); }
String cookieRequestHeaderFieldValue(const Document* document, const KURL &url) { NetworkingContext* context = networkingContext(document); if (!context) return String(); QNetworkCookieJar* jar = context->networkAccessManager()->cookieJar(); 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 NetworkConnectionToWebProcess::deleteCookiesForHostname(bool privateBrowsingEnabled, const String& hostname) { WebCore::deleteCookiesForHostname(networkingContext(privateBrowsingEnabled), hostname); }
void NetworkConnectionToWebProcess::deleteAllCookies(bool privateBrowsingEnabled) { WebCore::deleteAllCookies(networkingContext(privateBrowsingEnabled)); }
void NetworkConnectionToWebProcess::deleteCookie(bool privateBrowsingEnabled, const KURL& url, const String& cookieName) { WebCore::deleteCookie(networkingContext(privateBrowsingEnabled), url, cookieName); }
void NetworkConnectionToWebProcess::getHostnamesWithCookies(bool privateBrowsingEnabled, Vector<String>& hostnames) { HashSet<String> hostnamesSet; WebCore::getHostnamesWithCookies(networkingContext(privateBrowsingEnabled), hostnamesSet); WTF::copyToVector(hostnamesSet, hostnames); }
void NetworkConnectionToWebProcess::getRawCookies(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, Vector<Cookie>& result) { WebCore::getRawCookies(networkingContext(privateBrowsingEnabled), firstParty, url, result); }
void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, String& result) { result = WebCore::cookieRequestHeaderFieldValue(networkingContext(privateBrowsingEnabled), firstParty, url); }
void NetworkConnectionToWebProcess::cookiesEnabled(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, bool& result) { result = WebCore::cookiesEnabled(networkingContext(privateBrowsingEnabled), firstParty, url); }
void NetworkConnectionToWebProcess::setCookiesFromDOM(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, const String& cookieString) { WebCore::setCookiesFromDOM(networkingContext(privateBrowsingEnabled), firstParty, url, cookieString); }
inline NetworkStorageSession& storageSession(const Document& document) { NetworkingContext* context = networkingContext(document); return context ? context->storageSession() : NetworkStorageSession::defaultStorageSession(); }