Is there any tutorial how to use the cookie manager for a own client?
For me it won't work any I tried several things, already.
- Code: Select all
class MyRequestContextHandler : public CefRequestContextHandler
{
private:
IMPLEMENT_REFCOUNTING(CRequestContextHandler);
public:
virtual CefRefPtr<CefCookieManager> GetCookieManager() OVERRIDE
{
return CefCookieManager::GetGlobalManager(NULL);
}
};
...
CefRequestContextSettings settings;
CefRefPtr<CefRequestContextHandler> contextHandler = new CRequestContextHandler();
CefRefPtr<CefRequestContext> requestContext = CefRequestContext::CreateContext(settings, contextHandler);
CefRefPtr<CefURLRequest> urlRequest = CefURLRequest::Create(request, new CURLRequestClient, requestContext);
...
GetCookieManager is never being called. Request and Response works perfectly.
Also the cookie manager of the newly created requestContext points not to the GlobalManager.
I have no problems visiting cookies with my main browser, but the request client doesn't visit any cookie at all when calling visit all cookies in function OnRequestComplete.
However, I received a few cookies on the response header, so how can this be?
Even when swapping the CefRequestContext default cookie manager with the globalmanager or using the default cookie manager from the context - CefCookieVisitor::Visit will not get called.
I don't think my problem lies in CefCookieVisitor::Visit, since it works with the main browser.
Is this a bug? I can't find anything related to CefURLRequestClient and the cookie manager.
- Note that, if I use the main browser, everything works fine.