chromium/content/browser/web_package/signed_exchange_reporter.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/web_package/signed_exchange_reporter.h"

#include <string>
#include <utility>

#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/web_package/signed_exchange_utils.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
#include "net/base/ip_endpoint.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "url/origin.h"

namespace content {

namespace {

constexpr char kSXGResultOk[] =;
constexpr char kSXGResultFailed[] =;
constexpr char kSXGResultMiError[] =;
constexpr char kSXGResultNonSecureDistributor[] =;
constexpr char kSXGResultParseError[] =;
constexpr char kSXGResultInvalidIntegrityHeader[] =;
constexpr char kSXGResultSignatureVerificationError[] =;
constexpr char kSXGResultCertVerificationError[] =;
constexpr char kSXGResultCertFetchError[] =;
constexpr char kSXGResultCertParseError[] =;
constexpr char kSXGResultVariantMismatch[] =;
constexpr char kSXGHeaderIntegrityMismatch[] =;
constexpr char kSXGResultHadCookie[] =;

const char* GetResultTypeString(SignedExchangeLoadResult result) {}

bool IsCertRelatedErrorResult(const char* result_string) {}

// [spec text]
// - If report body’s "sxg"'s "cert_url"'s scheme is not "data" and report’s
//   result is "signature_verification_error" or "cert_verification_error" or
//   "cert_fetch_error" or "cert_parse_error":
//   - If report’s outer request's url's origin is different from any origin
//     of the URLs in report’s cert URL list, or report’s server IP is
//     different from any of the IP address in report’s cert server IP list:
bool ShouldDowngradeReport(const char* result_string,
                           const network::mojom::SignedExchangeReport& report,
                           const net::IPAddress& cert_server_ip_address) {}

void ReportResult(
    int frame_tree_node_id,
    network::mojom::SignedExchangeReportPtr report,
    const net::NetworkAnonymizationKey& network_anonymization_key) {}

}  // namespace

// static
std::unique_ptr<SignedExchangeReporter> SignedExchangeReporter::MaybeCreate(
    const GURL& outer_url,
    const std::string& referrer,
    const network::mojom::URLResponseHead& response,
    const net::NetworkAnonymizationKey& network_anonymization_key,
    int frame_tree_node_id) {}

SignedExchangeReporter::SignedExchangeReporter(
    const GURL& outer_url,
    const std::string& referrer,
    const network::mojom::URLResponseHead& response,
    const net::NetworkAnonymizationKey& network_anonymization_key,
    int frame_tree_node_id)
    :{}

SignedExchangeReporter::~SignedExchangeReporter() = default;

void SignedExchangeReporter::set_cert_server_ip_address(
    const net::IPAddress& cert_server_ip_address) {}

void SignedExchangeReporter::set_inner_url(const GURL& inner_url) {}

void SignedExchangeReporter::set_cert_url(const GURL& cert_url) {}

void SignedExchangeReporter::ReportLoadResultAndFinish(
    SignedExchangeLoadResult result) {}

void SignedExchangeReporter::ReportHeaderIntegrityMismatch() {}

}  // namespace content