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_
10 #include "ios/web/public/referrer.h"
11 #include "net/url_request/url_request.h"
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
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
);
40 #endif // IOS_WEB_PUBLIC_REFERRER_UTIL_H_