blob: 12bb6eea7c73b51e6876da4b3030db365e96f8e0 [file] [log] [blame]
// Copyright 2019 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 CONTENT_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_
#define CONTENT_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_
#include <memory>
#include <string>
#include "content/public/browser/client_hints_controller_delegate.h"
#include "net/http/http_request_headers.h"
class BrowserContext;
namespace content {
// Returns |rtt| after adding host-specific random noise, and rounding it as
// per the NetInfo spec to improve privacy.
CONTENT_EXPORT unsigned long RoundRttForTesting(
const std::string& host,
const base::Optional<base::TimeDelta>& rtt);
// Returns downlink (in Mbps) after adding host-specific random noise to
// |downlink_kbps| (which is in Kbps), and rounding it as per the NetInfo spec
// to improve privacy.
CONTENT_EXPORT double RoundKbpsToMbpsForTesting(
const std::string& host,
const base::Optional<int32_t>& downlink_kbps);
CONTENT_EXPORT void AddNavigationRequestClientHintsHeaders(
const GURL& url,
net::HttpRequestHeaders* headers,
content::BrowserContext* context,
content::ClientHintsControllerDelegate* delegate);
} // namespace content
#endif // CONTENT_BROWSER_CLIENT_HINTS_CLIENT_HINTS_H_