WebCookieManagerProxy.h [plain text]
#ifndef WebCookieManagerProxy_h
#define WebCookieManagerProxy_h
#include "APIObject.h"
#include "GenericCallback.h"
#include "ImmutableArray.h"
#include "MessageReceiver.h"
#include "WebContextSupplement.h"
#include "WebCookieManagerProxyClient.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
#if USE(SOUP)
#include "SoupCookiePersistentStorageType.h"
#endif
namespace WebKit {
class WebContext;
class WebProcessProxy;
typedef GenericCallback<WKArrayRef> ArrayCallback;
typedef GenericCallback<WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy> HTTPCookieAcceptPolicyCallback;
class WebCookieManagerProxy : public TypedAPIObject<APIObject::TypeCookieManager>, public WebContextSupplement, private CoreIPC::MessageReceiver {
public:
static const char* supplementName();
static PassRefPtr<WebCookieManagerProxy> create(WebContext*);
virtual ~WebCookieManagerProxy();
void initializeClient(const WKCookieManagerClient*);
void getHostnamesWithCookies(PassRefPtr<ArrayCallback>);
void deleteCookiesForHostname(const String& hostname);
void deleteAllCookies();
void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
void getHTTPCookieAcceptPolicy(PassRefPtr<HTTPCookieAcceptPolicyCallback>);
void startObservingCookieChanges();
void stopObservingCookieChanges();
#if USE(SOUP)
void setCookiePersistentStorage(const String& storagePath, uint32_t storageType);
void getCookiePersistentStorage(String& storagePath, uint32_t& storageType) const;
#endif
using APIObject::ref;
using APIObject::deref;
private:
WebCookieManagerProxy(WebContext*);
void didGetHostnamesWithCookies(const Vector<String>&, uint64_t callbackID);
void didGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID);
void cookiesDidChange();
virtual void contextDestroyed() OVERRIDE;
virtual void processDidClose(WebProcessProxy*) OVERRIDE;
virtual void processDidClose(NetworkProcessProxy*) OVERRIDE;
virtual bool shouldTerminate(WebProcessProxy*) const OVERRIDE;
virtual void refWebContextSupplement() OVERRIDE;
virtual void derefWebContextSupplement() OVERRIDE;
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
#if PLATFORM(MAC)
void persistHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
#endif
HashMap<uint64_t, RefPtr<ArrayCallback>> m_arrayCallbacks;
HashMap<uint64_t, RefPtr<HTTPCookieAcceptPolicyCallback>> m_httpCookieAcceptPolicyCallbacks;
WebCookieManagerProxyClient m_client;
#if USE(SOUP)
String m_cookiePersistentStoragePath;
SoupCookiePersistentStorageType m_cookiePersistentStorageType;
#endif
};
}
#endif // WebCookieManagerProxy_h