1 // Copyright 2019 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 #ifndef CONTENT_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_
6 #define CONTENT_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_
7 
8 #include <memory>
9 #include <string>
10 
11 #include "content/public/browser/client_hints_controller_delegate.h"
12 #include "net/http/http_request_headers.h"
13 
14 class BrowserContext;
15 class FrameTreeNode;
16 
17 namespace content {
18 
19 // Returns |rtt| after adding host-specific random noise, and rounding it as
20 // per the NetInfo spec to improve privacy.
21 CONTENT_EXPORT unsigned long RoundRttForTesting(
22     const std::string& host,
23     const base::Optional<base::TimeDelta>& rtt);
24 
25 // Returns downlink (in Mbps) after adding host-specific random noise to
26 // |downlink_kbps| (which is in Kbps), and rounding it as per the NetInfo spec
27 // to improve privacy.
28 CONTENT_EXPORT double RoundKbpsToMbpsForTesting(
29     const std::string& host,
30     const base::Optional<int32_t>& downlink_kbps);
31 
32 CONTENT_EXPORT void AddNavigationRequestClientHintsHeaders(
33     const GURL& url,
34     net::HttpRequestHeaders* headers,
35     BrowserContext* context,
36     bool javascript_enabled,
37     ClientHintsControllerDelegate* delegate,
38     bool is_ua_override_on,
39     FrameTreeNode*);
40 
41 }  // namespace content
42 
43 #endif  // CONTENT_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_
44