summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 08:24:12 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 08:24:12 +0000
commitcb370a06391bd8cd1d3c52e4722645962366dd42 (patch)
tree9ca36ba10363365401bd1a816962f4679fda8467 /net/url_request
parentdbefae2c2db09a90c2b9ee4d3ea1a40e580e532e (diff)
downloadchromium_src-cb370a06391bd8cd1d3c52e4722645962366dd42.zip
chromium_src-cb370a06391bd8cd1d3c52e4722645962366dd42.tar.gz
chromium_src-cb370a06391bd8cd1d3c52e4722645962366dd42.tar.bz2
Changes to support new cookie policy.
Changes: 1- net::CookiePolicy becomes an interface. 2- Old implementaiton of CookiePolicy copied to StaticCookiePolicy. 3- ChromeULRRequestContext implements CookiePolicy. 4- HostContentSettingsMap gets a global "BlockThirdPartyCookies" pref. R=pkasting Review URL: http://codereview.chromium.org/556095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_context.h14
-rw-r--r--net/url_request/url_request_http_job.cc7
2 files changed, 11 insertions, 10 deletions
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index b0204ce..d27ab01 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.
@@ -12,7 +12,6 @@
#include "base/ref_counted.h"
#include "base/string_util.h"
-#include "net/base/cookie_policy.h"
#include "net/base/cookie_store.h"
#include "net/base/host_resolver.h"
#include "net/base/ssl_config_service.h"
@@ -22,6 +21,7 @@
#include "net/url_request/request_tracker.h"
namespace net {
+class CookiePolicy;
class FtpTransactionFactory;
class HttpTransactionFactory;
class SocketStream;
@@ -35,7 +35,7 @@ class URLRequestContext :
URLRequestContext()
: http_transaction_factory_(NULL),
ftp_transaction_factory_(NULL),
- cookie_store_(NULL),
+ cookie_policy_(NULL),
transport_security_state_(NULL) {
}
@@ -63,11 +63,11 @@ class URLRequestContext :
return ftp_transaction_factory_;
}
- // Gets the cookie store for this context.
+ // Gets the cookie store for this context (may be null).
net::CookieStore* cookie_store() { return cookie_store_.get(); }
- // Gets the cookie policy for this context.
- net::CookiePolicy* cookie_policy() { return &cookie_policy_; }
+ // Gets the cookie policy for this context (may be null).
+ net::CookiePolicy* cookie_policy() { return cookie_policy_; }
net::TransportSecurityState* transport_security_state() {
return transport_security_state_; }
@@ -132,7 +132,7 @@ class URLRequestContext :
net::HttpTransactionFactory* http_transaction_factory_;
net::FtpTransactionFactory* ftp_transaction_factory_;
scoped_refptr<net::CookieStore> cookie_store_;
- net::CookiePolicy cookie_policy_;
+ 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_http_job.cc b/net/url_request/url_request_http_job.cc
index 4b665be..7ec4ccf 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 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.
@@ -13,6 +13,7 @@
#include "base/rand_util.h"
#include "base/string_util.h"
#include "net/base/cert_status_flags.h"
+#include "net/base/cookie_policy.h"
#include "net/base/filter.h"
#include "net/base/https_prober.h"
#include "net/base/transport_security_state.h"
@@ -511,7 +512,7 @@ void URLRequestHttpJob::NotifyHeadersComplete() {
// Get the Set-Cookie values, and send them to our cookie database.
if (!(request_info_.load_flags & net::LOAD_DO_NOT_SAVE_COOKIES)) {
URLRequestContext* ctx = request_->context();
- if (ctx && ctx->cookie_store() &&
+ if (ctx && ctx->cookie_store() && ctx->cookie_policy() &&
ctx->cookie_policy()->CanSetCookie(
request_->url(), request_->first_party_for_cookies())) {
FetchResponseCookies();
@@ -667,7 +668,7 @@ std::string URLRequestHttpJob::AssembleRequestCookies() {
URLRequestContext* context = request_->context();
if (context) {
// Add in the cookie header. TODO might we need more than one header?
- if (context->cookie_store() &&
+ if (context->cookie_store() && context->cookie_policy() &&
context->cookie_policy()->CanGetCookies(
request_->url(), request_->first_party_for_cookies())) {
net::CookieOptions options;