Support disabling of cookie load/save via SetSupportedSchemes (see issue #2622).

With this change the CefCookieManager::SetSupportedSchemes method can be used
to disable all loading and saving of cookies for the associated request context.
This matches functionality that was previously available via GetBlockingManager.

This change also fixes a bug where Set-Cookie headers returned for a request
handled via CefSchemeHandlerFactory would be ignored if there was not also a
CefResourceRequestHandler returned for the request.

To test: All CookieTest.* tests pass.
This commit is contained in:
Marshall Greenblatt
2019-05-02 18:23:57 -04:00
parent cef882616b
commit 8b400331c7
18 changed files with 322 additions and 161 deletions

View File

@ -43,6 +43,7 @@ class CefCookieManagerOldImpl : public CefCookieManager {
// CefCookieManager methods.
void SetSupportedSchemes(const std::vector<CefString>& schemes,
bool include_defaults,
CefRefPtr<CefCompletionCallback> callback) override;
bool VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor) override;
bool VisitUrlCookies(const CefString& url,
@ -56,10 +57,10 @@ class CefCookieManagerOldImpl : public CefCookieManager {
CefRefPtr<CefDeleteCookiesCallback> callback) override;
bool FlushStore(CefRefPtr<CefCompletionCallback> callback) override;
// Set the schemes supported by |cookie_monster|. Default schemes will always
// be supported.
// Set the schemes supported by |cookie_monster|.
static void SetCookieMonsterSchemes(net::CookieMonster* cookie_monster,
const std::vector<std::string>& schemes);
const std::vector<std::string>& schemes,
bool include_defaults);
private:
// Execute |method| on the IO thread once the request context is available.
@ -71,6 +72,7 @@ class CefCookieManagerOldImpl : public CefCookieManager {
scoped_refptr<CefURLRequestContextGetter> request_context);
void SetSupportedSchemesWithContext(
const std::vector<std::string>& schemes,
bool include_defaults,
CefRefPtr<CefCompletionCallback> callback,
scoped_refptr<CefURLRequestContextGetter> request_context);
void GetCookieStoreWithContext(
@ -79,6 +81,7 @@ class CefCookieManagerOldImpl : public CefCookieManager {
scoped_refptr<CefURLRequestContextGetter> request_context);
void SetSupportedSchemesInternal(const std::vector<std::string>& schemes,
bool include_defaults,
CefRefPtr<CefCompletionCallback> callback);
void VisitAllCookiesInternal(CefRefPtr<CefCookieVisitor> visitor,
const CookieStoreGetter& cookie_store_getter);