diff options
Diffstat (limited to 'net/base/static_cookie_policy.h')
-rw-r--r-- | net/base/static_cookie_policy.h | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/net/base/static_cookie_policy.h b/net/base/static_cookie_policy.h index 4734d33..a16fd0c 100644 --- a/net/base/static_cookie_policy.h +++ b/net/base/static_cookie_policy.h @@ -14,18 +14,30 @@ namespace net { // The StaticCookiePolicy class implements a static cookie policy that supports // three modes: allow all, deny all, or block third-party cookies. -// -// NOTE: This CookiePolicy implementation always completes synchronously. The -// callback parameter will be ignored if specified. Just pass NULL. -// class StaticCookiePolicy : public CookiePolicy { public: + // Consult the user's third-party cookie blocking preferences to determine + // whether the URL's cookies can be read. + bool CanGetCookies(const GURL& url, const GURL& first_party_for_cookies); + + // Consult the user's third-party cookie blocking preferences to determine + // whether the URL's cookies can be set. + bool CanSetCookie(const GURL& url, const GURL& first_party_for_cookies); + enum Type { ALLOW_ALL_COOKIES = 0, // Do not perform any cookie blocking. BLOCK_THIRD_PARTY_COOKIES, // Prevent third-party cookies from being set. BLOCK_ALL_COOKIES // Disable cookies. }; + // Sets the current policy to enforce. This should be called when the user's + // preferences change. + void set_type(Type type) { type_ = type; } + + Type type() const { + return type_; + } + StaticCookiePolicy() : type_(StaticCookiePolicy::ALLOW_ALL_COOKIES) { } @@ -34,26 +46,6 @@ class StaticCookiePolicy : public CookiePolicy { : type_(type) { } - // Sets the current policy to enforce. This should be called when the user's - // preferences change. - void set_type(Type type) { type_ = type; } - Type type() const { return type_; } - - // CookiePolicy methods: - - // Consults the user's third-party cookie blocking preferences to determine - // whether the URL's cookies can be read. - virtual int CanGetCookies(const GURL& url, - const GURL& first_party_for_cookies, - CompletionCallback* callback); - - // Consults the user's third-party cookie blocking preferences to determine - // whether the URL's cookies can be set. - virtual int CanSetCookie(const GURL& url, - const GURL& first_party_for_cookies, - const std::string& cookie_line, - CompletionCallback* callback); - private: Type type_; |