summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authoridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 18:02:23 +0000
committeridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 18:02:23 +0000
commiteaadd905fd0d3e3e0496f229a5aaa3e3982002a4 (patch)
tree7174b1009f01eb2ee982c1d834c4d052ff916904 /chrome/browser/renderer_host
parentc86d472e35440254cf860f40c40aaaf45992bfdc (diff)
downloadchromium_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 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 8eb41af..75cccfc 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/download/save_file_manager.h"
#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/plugin_service.h"
+#include "chrome/browser/privacy_blacklist/blacklist.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/async_resource_handler.h"
#include "chrome/browser/renderer_host/buffered_resource_handler.h"
@@ -44,6 +45,7 @@
#include "net/base/net_errors.h"
#include "net/base/ssl_cert_request_info.h"
#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_context.h"
#include "webkit/glue/webappcachecontext.h"
// TODO(port): Move these includes to the above section when porting is done.
@@ -301,6 +303,14 @@ void ResourceDispatcherHost::BeginRequest(
return;
}
+ // Note that context can still be NULL here when running unit tests.
+ const Blacklist::Entry* entry = context && context->blacklist() ?
+ context->blacklist()->findMatch(request_data.url) : NULL;
+ if (entry && entry->IsBlocked(request_data.url)) {
+ // TODO(idanan): Send a ResourceResponse to replace the blocked resource.
+ return;
+ }
+
// Ensure the Chrome plugins are loaded, as they may intercept network
// requests. Does nothing if they are already loaded.
// TODO(mpcomplete): This takes 200 ms! Investigate parallelizing this by
@@ -328,10 +338,18 @@ void ResourceDispatcherHost::BeginRequest(
// Construct the request.
URLRequest* request = new URLRequest(request_data.url, this);
+ if (entry && entry->attributes()) {
+ request->SetUserData((void*)&Blacklist::kRequestDataKey,
+ new Blacklist::RequestData(entry));
+ }
request->set_method(request_data.method);
request->set_first_party_for_cookies(request_data.first_party_for_cookies);
- request->set_referrer(request_data.referrer.spec());
+
+ if (!entry || !(entry->attributes() & Blacklist::kDontSendReferrer))
+ request->set_referrer(request_data.referrer.spec());
+
request->SetExtraRequestHeaders(request_data.headers);
+
int load_flags = request_data.load_flags;
// EV certificate verification could be expensive. We don't want to spend
// time performing EV certificate verification on all resources because