Add CefCookieManager::GetBlockingManager (issue #2374)

This commit is contained in:
Marshall Greenblatt
2018-03-14 21:40:37 -04:00
parent a98c6b1f52
commit e030236c36
12 changed files with 324 additions and 109 deletions

View File

@@ -22,7 +22,14 @@ namespace {
class ClientRequestContextHandler : public CefRequestContextHandler,
public CefExtensionHandler {
public:
ClientRequestContextHandler() {}
ClientRequestContextHandler() {
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
if (command_line->HasSwitch(switches::kRequestContextBlockCookies)) {
// Use a cookie manager that neither stores nor retrieves cookies.
cookie_manager_ = CefCookieManager::GetBlockingManager();
}
}
// CefRequestContextHandler methods:
bool OnBeforePluginLoad(const CefString& mime_type,
@@ -73,6 +80,10 @@ class ClientRequestContextHandler : public CefRequestContextHandler,
}
}
CefRefPtr<CefCookieManager> GetCookieManager() OVERRIDE {
return cookie_manager_;
}
// CefExtensionHandler methods:
void OnExtensionLoaded(CefRefPtr<CefExtension> extension) OVERRIDE {
CEF_REQUIRE_UI_THREAD();
@@ -99,6 +110,8 @@ class ClientRequestContextHandler : public CefRequestContextHandler,
}
private:
CefRefPtr<CefCookieManager> cookie_manager_;
IMPLEMENT_REFCOUNTING(ClientRequestContextHandler);
DISALLOW_COPY_AND_ASSIGN(ClientRequestContextHandler);
};