#include "content/browser/web_package/signed_exchange_utils.h"
#include <string_view>
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/loader/download_utils_impl.h"
#include "content/browser/web_package/signed_exchange_devtools_proxy.h"
#include "content/browser/web_package/signed_exchange_error.h"
#include "content/browser/web_package/signed_exchange_request_handler.h"
#include "content/common/features.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "net/http/http_util.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
namespace content {
namespace signed_exchange_utils {
namespace {
constexpr char kLoadResultHistogram[] = …;
std::optional<base::Time> g_verification_time_for_testing;
}
void RecordLoadResultHistogram(SignedExchangeLoadResult result) { … }
void ReportErrorAndTraceEvent(
SignedExchangeDevToolsProxy* devtools_proxy,
const std::string& error_message,
std::optional<SignedExchangeError::FieldIndexPair> error_field) { … }
bool IsSignedExchangeHandlingEnabled(BrowserContext* context) { … }
bool IsSignedExchangeReportingForDistributorsEnabled() { … }
bool ShouldHandleAsSignedHTTPExchange(
const GURL& request_url,
const network::mojom::URLResponseHead& head) { … }
std::optional<SignedExchangeVersion> GetSignedExchangeVersion(
const std::string& content_type) { … }
SignedExchangeLoadResult GetLoadResultFromSignatureVerifierResult(
SignedExchangeSignatureVerifier::Result verify_result) { … }
net::RedirectInfo CreateRedirectInfo(
const GURL& new_url,
const network::ResourceRequest& outer_request,
const network::mojom::URLResponseHead& outer_response,
bool is_fallback_redirect) { … }
network::mojom::URLResponseHeadPtr CreateRedirectResponseHead(
const network::mojom::URLResponseHead& outer_response,
bool is_fallback_redirect) { … }
int MakeRequestID() { … }
base::Time GetVerificationTime() { … }
void SetVerificationTimeForTesting(
std::optional<base::Time> verification_time_for_testing) { … }
bool IsCookielessOnlyExchange(const net::HttpResponseHeaders& inner_headers) { … }
}
}