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

Unified Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 600008: Add option to suppress HTTP Referer header. (Closed)
Patch Set: add comment Created 10 years, 10 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
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/resource_dispatcher_host.cc
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index b92c6a99d7af4fc4f80cdf2fcc0c5ccb80ee09af..48854236d205b69577bf362caabda47d55acae36 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 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.
@@ -379,7 +379,8 @@ void ResourceDispatcherHost::BeginRequest(
URLRequest* request = new URLRequest(request_data.url, this);
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());
+ request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNoReferrers) ? std::string() : request_data.referrer.spec());
request->SetExtraRequestHeaders(request_data.headers);
int load_flags = request_data.load_flags;
@@ -615,7 +616,8 @@ void ResourceDispatcherHost::BeginDownload(
}
request->set_method("GET");
- request->set_referrer(referrer.spec());
+ request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch(
darin (slow to review) 2010/02/10 07:20:41 i think this duplication of code is unfortunate.
+ switches::kNoReferrers) ? std::string() : referrer.spec());
request->set_context(request_context);
request->set_load_flags(request->load_flags() |
net::LOAD_IS_DOWNLOAD);
@@ -671,7 +673,8 @@ void ResourceDispatcherHost::BeginSaveFile(const GURL& url,
URLRequest* request = new URLRequest(url, this);
request->set_method("GET");
- request->set_referrer(referrer.spec());
+ request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNoReferrers) ? std::string() : referrer.spec());
// So far, for saving page, we need fetch content from cache, in the
// future, maybe we can use a configuration to configure this behavior.
request->set_load_flags(net::LOAD_PREFERRING_CACHE);
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698