diff options
author | idanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 18:02:23 +0000 |
---|---|---|
committer | idanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 18:02:23 +0000 |
commit | eaadd905fd0d3e3e0496f229a5aaa3e3982002a4 (patch) | |
tree | 7174b1009f01eb2ee982c1d834c4d052ff916904 /net | |
parent | c86d472e35440254cf860f40c40aaaf45992bfdc (diff) | |
download | chromium_src-eaadd905fd0d3e3e0496f229a5aaa3e3982002a4.zip chromium_src-eaadd905fd0d3e3e0496f229a5aaa3e3982002a4.tar.gz chromium_src-eaadd905fd0d3e3e0496f229a5aaa3e3982002a4.tar.bz2 |
Privacy Blacklist SketelonAdded code hooks to serve as place holders for the implementationof the privacy blacklist. The --privacy-blacklist option was addedwhich will eventually is used to activate the code.This is work-in-progress code which effectively makes a couple morepointer-checks when the --privacy-blacklist is not specified. Whenit is specified, some of the blacklist code is executed but theblacklist is always empty and therefore has no impact on browsing.
BUG=none
TEST=Blacklist*
Review URL: http://codereview.chromium.org/119313
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19033 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/url_request/url_request_context.h | 22 | ||||
-rw-r--r-- | net/url_request/url_request_http_job.cc | 6 |
2 files changed, 25 insertions, 3 deletions
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 2c9f6fa..374af90 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -23,6 +23,8 @@ class HostResolver; class HttpTransactionFactory; class ProxyService; } +class Blacklist; +class URLRequest; // Subclass to provide application-specific context for URLRequest instances. class URLRequestContext : @@ -34,7 +36,8 @@ class URLRequestContext : http_transaction_factory_(NULL), ftp_transaction_factory_(NULL), cookie_store_(NULL), - force_tls_state_(NULL) { + force_tls_state_(NULL), + blacklist_(NULL) { } net::HostResolver* host_resolver() const { @@ -67,6 +70,9 @@ class URLRequestContext : // Gets the FTP authentication cache for this context. net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; } + // Gets the Privacy Blacklist, if any for this context. + const Blacklist* blacklist() { return blacklist_; } + // Gets the value of 'Accept-Charset' header field. const std::string& accept_charset() const { return accept_charset_; } @@ -87,6 +93,19 @@ class URLRequestContext : referrer_charset_ = charset; } + // Called for each cookie returning for the given request. A pointer to + // the cookie is passed so that it can be modified. Returns true if the + // cookie was not dropped (it could still be modified though). + virtual bool interceptCookie(const URLRequest* request, std::string* cookie) { + return true; + } + + // Called before adding cookies to sent requests. Allows overriding + // requests to block sending of cookies. + virtual bool allowSendingCookies(const URLRequest* request) const { + return true; + } + protected: friend class base::RefCountedThreadSafe<URLRequestContext>; @@ -102,6 +121,7 @@ class URLRequestContext : net::CookiePolicy cookie_policy_; net::ForceTLSState* force_tls_state_;; net::FtpAuthCache ftp_auth_cache_; + const Blacklist* blacklist_; std::string accept_language_; std::string accept_charset_; // The charset of the referrer where this request comes from. It's not diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 1c8053d..d3b16a6 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -663,7 +663,8 @@ void URLRequestHttpJob::AddExtraHeaders() { URLRequestContext* context = request_->context(); if (context) { - request_info_.extra_headers += AssembleRequestCookies(); + if (context->allowSendingCookies(request_)) + request_info_.extra_headers += AssembleRequestCookies(); if (!context->accept_language().empty()) request_info_.extra_headers += "Accept-Language: " + context->accept_language() + "\r\n"; @@ -700,7 +701,8 @@ void URLRequestHttpJob::FetchResponseCookies() { void* iter = NULL; while (response_info_->headers->EnumerateHeader(&iter, name, &value)) - response_cookies_.push_back(value); + if (request_->context()->interceptCookie(request_, &value)) + response_cookies_.push_back(value); } |