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