diff --git a/libcef/cookie_manager_impl.cc b/libcef/cookie_manager_impl.cc index 3f68ca960..0e65002d3 100644 --- a/libcef/cookie_manager_impl.cc +++ b/libcef/cookie_manager_impl.cc @@ -66,18 +66,14 @@ class VisitCookiesCallback : public base::RefCounted { } // namespace -CefCookieManagerImpl::CefCookieManagerImpl() - : is_global_(true) { - cookie_monster_ = - static_cast( - _Context->request_context()->cookie_store()); - DCHECK(cookie_monster_); -} - - // Creates a new cookie monster with storage at the specified |path|. -CefCookieManagerImpl::CefCookieManagerImpl(const CefString& path) - :is_global_(false) { - SetStoragePath(path); +CefCookieManagerImpl::CefCookieManagerImpl(bool is_global) + : is_global_(is_global) { + if (is_global) { + cookie_monster_ = + static_cast( + _Context->request_context()->cookie_store()); + DCHECK(cookie_monster_); + } } CefCookieManagerImpl::~CefCookieManagerImpl() { @@ -239,7 +235,7 @@ CefRefPtr CefCookieManager::GetGlobalManager() { return NULL; } - return new CefCookieManagerImpl(); + return new CefCookieManagerImpl(true); } // static @@ -251,5 +247,7 @@ CefRefPtr CefCookieManager::CreateManager( return NULL; } - return new CefCookieManagerImpl(path); + CefRefPtr manager(new CefCookieManagerImpl(false)); + manager->SetStoragePath(path); + return manager; } diff --git a/libcef/cookie_manager_impl.h b/libcef/cookie_manager_impl.h index 0098c55d5..2f5abab19 100644 --- a/libcef/cookie_manager_impl.h +++ b/libcef/cookie_manager_impl.h @@ -12,11 +12,7 @@ // Implementation of the CefCookieManager interface. class CefCookieManagerImpl : public CefCookieManager { public: - // Creates a new reference to the existing global cookie monster. - CefCookieManagerImpl(); - - // Creates a new cookie monster with storage at the specified |path|. - explicit CefCookieManagerImpl(const CefString& path); + CefCookieManagerImpl(bool is_global); ~CefCookieManagerImpl();