Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / ios / web / public / referrer_util.h
blob3500dfc231a6a68f31ebd43a068f5c856f842373
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.
5 #ifndef IOS_WEB_PUBLIC_REFERRER_UTIL_H_
6 #define IOS_WEB_PUBLIC_REFERRER_UTIL_H_
8 #include <string>
10 #include "ios/web/public/referrer.h"
11 #include "net/url_request/url_request.h"
13 class GURL;
15 namespace web {
17 // Returns a sanitized version of |referrer| for use in a Referer header.
18 GURL ReferrerForHeader(const GURL& referrer);
20 // Returns the string that should be sent as the Referer header value for
21 // navigating to |destination| from the given referrer, taking the referrer
22 // policy into account. Returns an empty string if no Referer should be sent.
23 std::string ReferrerHeaderValueForNavigation(
24 const GURL& destination,
25 const web::Referrer& referrer);
27 // Returns the policy that should be used to process subsequent forwards, if
28 // any.
29 net::URLRequest::ReferrerPolicy PolicyForNavigation(
30 const GURL& destination,
31 const web::Referrer& referrer);
33 // Returns the WebReferrerPolicy corresponding to the given policy string
34 // (e.g., 'always', 'never', 'origin', 'default'). The string is assumed to
35 // be lowercase already. Unrecognized values will be treated as Default.
36 ReferrerPolicy ReferrerPolicyFromString(const std::string& policy);
38 } // namespace web
40 #endif // IOS_WEB_PUBLIC_REFERRER_UTIL_H_