Windows should animate when they are about to get docked at screen edges.
[chromium-blink-merge.git] / net / base / static_cookie_policy.h
blobeaf2f97fc362ea6de76cd244f6e6cc88f3af31a3
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_BASE_STATIC_COOKIE_POLICY_H_
6 #define NET_BASE_STATIC_COOKIE_POLICY_H_
8 #include "base/basictypes.h"
9 #include "net/base/net_export.h"
11 class GURL;
13 namespace net {
15 // The StaticCookiePolicy class implements a static cookie policy that supports
16 // three modes: allow all, deny all, or block third-party cookies.
17 class NET_EXPORT StaticCookiePolicy {
18 public:
19 // Do not change the order of these types as they are persisted in
20 // preferences.
21 enum Type {
22 // Do not perform any cookie blocking.
23 ALLOW_ALL_COOKIES = 0,
24 // Prevent only third-party cookies from being set.
25 BLOCK_SETTING_THIRD_PARTY_COOKIES,
26 // Block all cookies (third-party or not) from begin set or read.
27 BLOCK_ALL_COOKIES,
28 // Prevent only third-party cookies from being set or read.
29 BLOCK_ALL_THIRD_PARTY_COOKIES
32 StaticCookiePolicy()
33 : type_(StaticCookiePolicy::ALLOW_ALL_COOKIES) {
36 explicit StaticCookiePolicy(Type type)
37 : type_(type) {
40 // Sets the current policy to enforce. This should be called when the user's
41 // preferences change.
42 void set_type(Type type) { type_ = type; }
43 Type type() const { return type_; }
45 // Consults the user's third-party cookie blocking preferences to determine
46 // whether the URL's cookies can be read.
47 int CanGetCookies(const GURL& url, const GURL& first_party_for_cookies) const;
49 // Consults the user's third-party cookie blocking preferences to determine
50 // whether the URL's cookies can be set.
51 int CanSetCookie(const GURL& url,
52 const GURL& first_party_for_cookies) const;
54 private:
55 Type type_;
57 DISALLOW_COPY_AND_ASSIGN(StaticCookiePolicy);
60 } // namespace net
62 #endif // NET_BASE_STATIC_COOKIE_POLICY_H_