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

Unified Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 10911283: Implement 'Do Not Track' header (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/chrome_network_delegate.cc
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 1dd4374ebcbfa50ee67886ddfa994cdb7b9add41..8d4b054fbe780f03ecf102374572bc13dc6b8e26 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -69,6 +69,8 @@ bool ChromeNetworkDelegate::g_never_throttle_requests_ = false;
namespace {
+const char kDNTHeader[] = "DNT";
+
// If the |request| failed due to problems with a proxy, forward the error to
// the proxy extension API.
void ForwardProxyErrors(net::URLRequest* request,
@@ -143,12 +145,14 @@ ChromeNetworkDelegate::ChromeNetworkDelegate(
void* profile,
CookieSettings* cookie_settings,
BooleanPrefMember* enable_referrers,
+ BooleanPrefMember* enable_do_not_track,
chrome_browser_net::LoadTimeStats* load_time_stats)
: event_router_(event_router),
profile_(profile),
cookie_settings_(cookie_settings),
extension_info_map_(extension_info_map),
enable_referrers_(enable_referrers),
+ enable_do_not_track_(enable_do_not_track),
url_blacklist_manager_(url_blacklist_manager),
managed_mode_url_filter_(managed_mode_url_filter),
load_time_stats_(load_time_stats) {
@@ -165,12 +169,17 @@ void ChromeNetworkDelegate::NeverThrottleRequests() {
}
// static
-void ChromeNetworkDelegate::InitializeReferrersEnabled(
+void ChromeNetworkDelegate::InitializePrefsOnUIThread(
BooleanPrefMember* enable_referrers,
+ BooleanPrefMember* enable_do_not_track,
PrefService* pref_service) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
enable_referrers->Init(prefs::kEnableReferrers, pref_service, NULL);
enable_referrers->MoveToThread(BrowserThread::IO);
+ if (enable_do_not_track) {
+ enable_do_not_track->Init(prefs::kEnableDoNotTrack, pref_service, NULL);
+ enable_do_not_track->MoveToThread(BrowserThread::IO);
+ }
}
// static
@@ -209,6 +218,8 @@ int ChromeNetworkDelegate::OnBeforeURLRequest(
if (!enable_referrers_->GetValue())
request->set_referrer(std::string());
+ if (enable_do_not_track_ && enable_do_not_track_->GetValue())
+ request->SetExtraRequestHeaderByName(kDNTHeader, "1", true /* override */);
return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest(
profile_, extension_info_map_.get(), request, callback, new_url);
}
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.h ('k') | chrome/browser/net/chrome_network_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698