forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
referrer_util.h
38 lines (28 loc) · 1.43 KB
/
referrer_util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2013 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.
#ifndef IOS_WEB_COMMON_REFERRER_UTIL_H_
#define IOS_WEB_COMMON_REFERRER_UTIL_H_
#include <string>
#include "ios/web/public/navigation/referrer.h"
#include "net/url_request/url_request.h"
class GURL;
namespace web {
// Returns the string that should be sent as the Referer header value for
// navigating to |destination| from the given referrer, taking the referrer
// policy into account. Returns an empty string if no Referer should be sent.
std::string ReferrerHeaderValueForNavigation(const GURL& destination,
const web::Referrer& referrer);
// Returns the policy that should be used to process subsequent forwards, if
// any.
// TODO(stuartmorgan): Replace this with ReferrerForNavigation, since it should
// always be used with ReferrerHeaderValueForNavigation anyway.
net::URLRequest::ReferrerPolicy PolicyForNavigation(
const GURL& destination,
const web::Referrer& referrer);
// Returns the WebReferrerPolicy corresponding to the given policy string
// (e.g., 'always', 'never', 'origin', 'default'). The string is assumed to
// be lowercase already. Unrecognized values will be treated as Default.
ReferrerPolicy ReferrerPolicyFromString(const std::string& policy);
} // namespace web
#endif // IOS_WEB_COMMON_REFERRER_UTIL_H_