使用CefCookieManager的正确方法是什么? (VC ++)

时间:2014-12-18 17:10:11

标签: chromium-embedded

问候语,大家。

我尝试制作一个嵌入CEF(Chromium嵌入框架)的程序,用于html显示。

我只想在我的程序中创建的每个浏览器窗口都有不同的CefCookieManager。我读过CEF的文件并知道它是可能的。

代码很简单: 首先,我编写了一个继承自CefRequestContextHandler

的类
#pragma once
#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:\\", false);
        //return NULL;
         }
private:
    // Include the default reference counting implementation.
    IMPLEMENT_REFCOUNTING(WXRequestContextHandler);
};

然后我创建一个CefRequestContext的实例:

m_reqContext = CefRequestContext::CreateContext(new WXRequestContextHandler());

最后使用之前创建的CefRequestContext实例通过CefBrowserHost :: CreateBrowser创建浏览器:

CefBrowserHost::CreateBrowser(info, m_cefHandler.get(), pszURL, settings, m_reqContext);

好吧,我认为这很简单,事实上我还不知道其他更多,所以当我运行这些代码来创建第一个窗口时,我得到了一个异常(在libcef.dll中触发,访问冲突0xc00000005 )程序崩溃了。

不幸的是,我发现有关CefCookieManager和CefRequestHandler的文档和教程非常糟糕,所以必须在这里找到帮助。如果有人知道关于我的问题的一些问题或者有关CefCookieManager和CefRequestConextHandler的一些教程,请帮忙。

我使用CEF3。1750(2014年6月),VS2013(vc12),win7。

1 个答案:

答案 0 :(得分:0)

我自己解决了这个问题(通过CEF论坛):

here is the link: