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

Side by Side Diff: content/browser/net/referrer.cc

Issue 23496076: WIP - Refactor programmatic downloads Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/net/referrer.h ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/net/referrer.h"
6
7 #include "base/command_line.h"
8 #include "content/public/common/content_switches.h"
9 #include "content/public/common/referrer.h"
10 #include "net/url_request/url_request.h"
11
12 namespace content {
13
14 void SetReferrerForRequest(net::URLRequest* request, const Referrer& referrer) {
15 if (!referrer.url.is_valid() ||
16 CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoReferrers)) {
17 request->SetReferrer(std::string());
18 } else {
19 request->SetReferrer(referrer.url.spec());
20 }
21
22 net::URLRequest::ReferrerPolicy net_referrer_policy =
23 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
24 switch (referrer.policy) {
25 case WebKit::WebReferrerPolicyDefault:
26 net_referrer_policy =
27 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
28 break;
29 case WebKit::WebReferrerPolicyAlways:
30 case WebKit::WebReferrerPolicyNever:
31 case WebKit::WebReferrerPolicyOrigin:
32 net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER;
33 break;
34 }
35 request->set_referrer_policy(net_referrer_policy);
36 }
37
38 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/net/referrer.h ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698