diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp index e17ca0376..e8718777e 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp @@ -20,10 +20,15 @@ #include "config.h" #include "WebFrameNetworkingContext.h" +#include "SessionTracker.h" #include "WebFrame.h" #include "WebPage.h" + #include <QObject> #include <QVariant> +#include <WebCore/SessionID.h> + +using namespace WebCore; namespace WebKit { @@ -38,9 +43,45 @@ WebFrameNetworkingContext::WebFrameNetworkingContext(WebFrame* frame) } } -PassRefPtr<WebFrameNetworkingContext> WebFrameNetworkingContext::create(WebFrame* frame) +Ref<WebFrameNetworkingContext> WebFrameNetworkingContext::create(WebFrame* frame) +{ + return adoptRef(*new WebFrameNetworkingContext(frame)); +} + +void WebFrameNetworkingContext::ensurePrivateBrowsingSession(SessionID sessionID) +{ + ASSERT(isMainThread()); + + if (SessionTracker::storageSession(sessionID)) + return; + + SessionTracker::setSession(sessionID, NetworkStorageSession::createPrivateBrowsingSession(String::number(sessionID.sessionID()))); +} + +WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const { - return adoptRef(new WebFrameNetworkingContext(frame)); + if (!frame()) + return nullptr; + + return toWebFrameLoaderClient(frame()->loader().client()); +} + +QNetworkAccessManager* WebFrameNetworkingContext::networkAccessManager() const +{ + // QTFIXME: This is a leftover of old process model + // QtMM player may call networkAccessManager() in WebProcess + // so we cannot just have ASSERT here. + qWarning("QtWebKit bug: WebFrameNetworkingContext::networkAccessManager() is called"); + return nullptr; +} + +WebCore::NetworkStorageSession& WebFrameNetworkingContext::storageSession() const +{ + if (frame() && frame()->page()->usesEphemeralSession()) + return *SessionTracker::storageSession(SessionID::legacyPrivateSessionID()); + + return NetworkStorageSession::defaultStorageSession(); + } } |