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

Side by Side Diff: content/public/common/referrer.cc

Issue 263563003: Add referrer & load flag support to BitmapFetcher class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove temp comments Created 6 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2014 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 #include "content/public/common/referrer.h"
5
6 #include <string>
7
8 #include "base/command_line.h"
9 #include "base/logging.h"
10 #include "content/public/common/content_switches.h"
11
12 namespace {
13
14 GURL ReferrerForHeader(const GURL& referrer) {
Kibeom Kim (inactive) 2014/04/30 00:58:56 From ios/web/public/referrer_util.cc . https://ch
15 DCHECK(referrer.is_valid());
16 GURL::Replacements replacements;
17 replacements.ClearUsername();
18 replacements.ClearPassword();
19 replacements.ClearRef();
20 return referrer.ReplaceComponents(replacements);
21 }
22
23 } // namespace
24
25 namespace content {
26
27 GURL Referrer::ReferrerHeaderUrlForNavigation(const GURL& destination) const {
28 GURL referrer_url;
29
30 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoReferrers))
31 return referrer_url;
32
33 // Make sure that we're covering all the cases.
34 DCHECK(blink::WebReferrerPolicyLast == 3);
35
36 switch (policy) {
37 case blink::WebReferrerPolicyDefault:
38 if (url.SchemeIsSecure() && !destination.SchemeIsSecure())
39 break;
40 // Purposeful fall through.
41 case blink::WebReferrerPolicyAlways:
42 referrer_url = ReferrerForHeader(url);
43 break;
44 case blink::WebReferrerPolicyOrigin:
45 referrer_url = url.GetOrigin();
46 break;
47 case blink::WebReferrerPolicyNever:
48 break;
49 default:
50 NOTREACHED();
51 }
52
53 return referrer_url;
54 }
55
56 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698