summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-29 21:00:34 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-29 21:00:34 +0000
commit15e84d9dad946d522ca6b5acf7db721a4ea76946 (patch)
treeaf079dd93c04f3736f10ac77da8a86ce099cc4d2 /net
parent1cc71de3863b49ba125576bdff84d739356070fb (diff)
downloadchromium_src-15e84d9dad946d522ca6b5acf7db721a4ea76946.zip
chromium_src-15e84d9dad946d522ca6b5acf7db721a4ea76946.tar.gz
chromium_src-15e84d9dad946d522ca6b5acf7db721a4ea76946.tar.bz2
Implement extended cookie controls.
BUG=32782 TEST=none Review URL: http://codereview.chromium.org/554119 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/cookie_policy.h13
-rw-r--r--net/url_request/url_request_context.h12
-rw-r--r--net/url_request/url_request_unittest.h2
3 files changed, 20 insertions, 7 deletions
diff --git a/net/base/cookie_policy.h b/net/base/cookie_policy.h
index 8efe998..bf647fc 100644
--- a/net/base/cookie_policy.h
+++ b/net/base/cookie_policy.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,13 +14,17 @@ namespace net {
// The CookiePolicy class implements third-party cookie blocking.
class CookiePolicy {
public:
+ virtual ~CookiePolicy() {}
+
// 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);
+ virtual 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);
+ virtual bool CanSetCookie(const GURL& url,
+ const GURL& first_party_for_cookies);
enum Type {
ALLOW_ALL_COOKIES = 0, // Do not perform any cookie blocking.
@@ -46,9 +50,10 @@ class CookiePolicy {
CookiePolicy();
- private:
+ protected:
Type type_;
+ private:
DISALLOW_COPY_AND_ASSIGN(CookiePolicy);
};
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index b0204ce..978960e 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -35,6 +35,7 @@ class URLRequestContext :
URLRequestContext()
: http_transaction_factory_(NULL),
ftp_transaction_factory_(NULL),
+ cookie_policy_(NULL),
cookie_store_(NULL),
transport_security_state_(NULL) {
}
@@ -67,7 +68,12 @@ class URLRequestContext :
net::CookieStore* cookie_store() { return cookie_store_.get(); }
// Gets the cookie policy for this context.
- net::CookiePolicy* cookie_policy() { return &cookie_policy_; }
+ net::CookiePolicy* cookie_policy() const {
+ return cookie_policy_;
+ }
+ void set_cookie_policy(net::CookiePolicy* cookie_policy) {
+ cookie_policy_ = cookie_policy;
+ }
net::TransportSecurityState* transport_security_state() {
return transport_security_state_; }
@@ -131,8 +137,8 @@ class URLRequestContext :
scoped_refptr<net::SSLConfigService> ssl_config_service_;
net::HttpTransactionFactory* http_transaction_factory_;
net::FtpTransactionFactory* ftp_transaction_factory_;
+ net::CookiePolicy* cookie_policy_;
scoped_refptr<net::CookieStore> cookie_store_;
- net::CookiePolicy cookie_policy_;
scoped_refptr<net::TransportSecurityState> transport_security_state_;
net::FtpAuthCache ftp_auth_cache_;
std::string accept_language_;
diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h
index abd94aa..3f5a55a 100644
--- a/net/url_request/url_request_unittest.h
+++ b/net/url_request/url_request_unittest.h
@@ -65,6 +65,7 @@ class TestURLRequestContext : public URLRequestContext {
virtual ~TestURLRequestContext() {
delete ftp_transaction_factory_;
delete http_transaction_factory_;
+ delete cookie_policy_;
}
private:
@@ -78,6 +79,7 @@ class TestURLRequestContext : public URLRequestContext {
disk_cache::CreateInMemoryCacheBackend(0));
// In-memory cookie store.
cookie_store_ = new net::CookieMonster();
+ cookie_policy_ = new net::CookiePolicy();
accept_language_ = "en-us,fr";
accept_charset_ = "iso-8859-1,*,utf-8";
}