Click here to Skip to main content
15,886,640 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Had anybody worked with CEF3 CefCookieManager?

I just want to study the usage of CefCookieManager,so I test my code in cefSimple project packed wtih Cef3 downloads.I use cef3.1750,vs2013(vc12)
First,I write a class(WXRequestContextHandler) which inherited form CefRequestContextHandler,like this:
C++
#include "include/cef_app.h"
#include "include/cef_request_context_handler.h"
#include "include/cef_cookie.h"

class WXRequestContextHandler :public CefRequestContextHandler
{
public:
	WXRequestContextHandler(){};
	~WXRequestContextHandler(){};
	CefRefPtr<CefCookieManager> GetCookieManager() OVERRIDE{
			
		return CefCookieManager::CreateManager("F:\\CefCookie",FALSE);
	}
private:
	// Include the default reference counting implementation.
	IMPLEMENT_REFCOUNTING(WXRequestContextHandler);
};


then Create an instance of this Class,like this:
C++
CefRefPtr<CefRequestContext> rc = CefRequestContext::CreateContext(new WXRequestContextHandler());


and Create the browser:
C++
CefBrowserHost::CreateBrowser(window_info, handler.get(), url,
                                browser_settings, rc);


OK,I don't know anymore about the CefCookieManager,so I run the code press F5,and got a exception(triggered in libcef.dll ,access violation 0xc0000005),the cefSimple application crashed.
I noticted the getCookieManager methed was called and when it return the exception will be triggered.but if it return NULL(which means use global cookieManager) the app runs as normal.
Obviously,I think I didn't use the CookieManager::CreateManager Correctly.
My problem is:what is the correct way to use CefCookieManager::CreateManager?
Posted

Well,thank your reply,Richard.
In fact,I had read the documents and googled many times,but the documents really simple,it only told me " Cookies managers can be unique per browser or shared across multiple browsers" and didn't give any code or example about it.maybe they think it's so easy that needn't explain.
Seems little guys concern about the CefCookieManager too,so it's difficult for me to found the topics about it.
 
Share this answer
 
I had solved this problem through CEF' forum,here's the link:
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=12534[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900