Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: net/base/cookie_policy.h

Issue 556095: Changes to support new cookie policy.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/options/advanced_contents_view.cc ('k') | net/base/static_cookie_policy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_COOKIE_POLICY_H_ 5 #ifndef NET_BASE_COOKIE_POLICY_H_
6 #define NET_BASE_COOKIE_POLICY_H_ 6 #define NET_BASE_COOKIE_POLICY_H_
7 7
8 #include "base/basictypes.h"
9
10 class GURL; 8 class GURL;
11 9
12 namespace net { 10 namespace net {
13 11
14 // The CookiePolicy class implements third-party cookie blocking.
15 class CookiePolicy { 12 class CookiePolicy {
16 public: 13 public:
17 // Consult the user's third-party cookie blocking preferences to determine 14 // Determine if the URL's cookies may be read.
18 // whether the URL's cookies can be read. 15 virtual bool CanGetCookies(const GURL& url,
19 bool CanGetCookies(const GURL& url, const GURL& first_party_for_cookies); 16 const GURL& first_party_for_cookies) = 0;
20 17
21 // Consult the user's third-party cookie blocking preferences to determine 18 // Determine if the URL's cookies may be written.
22 // whether the URL's cookies can be set. 19 virtual bool CanSetCookie(const GURL& url,
23 bool CanSetCookie(const GURL& url, const GURL& first_party_for_cookies); 20 const GURL& first_party_for_cookies) = 0;
24 21
25 enum Type { 22 protected:
26 ALLOW_ALL_COOKIES = 0, // Do not perform any cookie blocking. 23 virtual ~CookiePolicy() {}
27 BLOCK_THIRD_PARTY_COOKIES, // Prevent third-party cookies from being set.
28 BLOCK_ALL_COOKIES // Disable cookies.
29 };
30
31 static bool ValidType(int32 type) {
32 return type >= ALLOW_ALL_COOKIES && type <= BLOCK_ALL_COOKIES;
33 }
34
35 static Type FromInt(int32 type) {
36 return static_cast<Type>(type);
37 }
38
39 // Sets the current policy to enforce. This should be called when the user's
40 // preferences change.
41 void set_type(Type type) { type_ = type; }
42
43 Type type() const {
44 return type_;
45 }
46
47 CookiePolicy();
48
49 private:
50 Type type_;
51
52 DISALLOW_COPY_AND_ASSIGN(CookiePolicy);
53 }; 24 };
54 25
55 } // namespace net 26 } // namespace net
56 27
57 #endif // NET_BASE_COOKIE_POLICY_H_ 28 #endif // NET_BASE_COOKIE_POLICY_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/options/advanced_contents_view.cc ('k') | net/base/static_cookie_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698