NetworkStorageSession.h [plain text]
#ifndef NetworkStorageSession_h
#define NetworkStorageSession_h
#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
#if PLATFORM(COCOA) || USE(CFNETWORK)
typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
#endif
namespace WebCore {
class NetworkingContext;
class SoupNetworkSession;
class NetworkStorageSession {
WTF_MAKE_NONCOPYABLE(NetworkStorageSession); WTF_MAKE_FAST_ALLOCATED;
public:
static NetworkStorageSession& defaultStorageSession();
static std::unique_ptr<NetworkStorageSession> createPrivateBrowsingSession(const String& identifierBase = String());
static void switchToNewTestingSession();
#if PLATFORM(COCOA) || USE(CFNETWORK) || USE(SOUP)
bool isPrivateBrowsingSession() const { return m_isPrivate; }
#endif
#if PLATFORM(COCOA) || USE(CFNETWORK)
NetworkStorageSession(RetainPtr<CFURLStorageSessionRef>);
CFURLStorageSessionRef platformSession() { return m_platformSession.get(); }
RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const;
#elif USE(SOUP)
NetworkStorageSession(std::unique_ptr<SoupNetworkSession>);
~NetworkStorageSession();
SoupNetworkSession& soupNetworkSession() const;
void setSoupNetworkSession(std::unique_ptr<SoupNetworkSession>);
#else
NetworkStorageSession(NetworkingContext*);
~NetworkStorageSession();
NetworkingContext* context() const;
#endif
private:
#if PLATFORM(COCOA) || USE(CFNETWORK)
NetworkStorageSession();
RetainPtr<CFURLStorageSessionRef> m_platformSession;
#elif USE(SOUP)
std::unique_ptr<SoupNetworkSession> m_session;
#else
RefPtr<NetworkingContext> m_context;
#endif
#if PLATFORM(COCOA) || USE(CFNETWORK) || USE(SOUP)
bool m_isPrivate;
#endif
};
#if PLATFORM(WIN) && USE(CFNETWORK)
void overrideCookieStorage(CFHTTPCookieStorageRef);
CFHTTPCookieStorageRef overridenCookieStorage();
#endif
}
#endif // NetworkStorageSession_h