chromium/components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc

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

#include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h"

#include <string_view>

#include "base/base64.h"
#include "base/hash/hash.h"
#include "base/hash/sha1.h"
#include "base/metrics/histogram_functions.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/escape.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/version_info/version_info.h"
#include "crypto/sha2.h"
#include "google_apis/google_api_keys.h"
#include "net/base/ip_address.h"
#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h"
#include "url/url_util.h"

Time;

namespace safe_browsing {

// Can be overriden by tests.
const char* g_sbv4_url_prefix_for_testing =;

const char kSbV4UrlPrefix[] =;

const base::FilePath::CharType kStoreSuffix[] =);

namespace {

// The default URL prefix where browser reports safe browsing hits and malware
// details.
const char kSbReportsURLPrefix[] =;

std::string Unescape(const std::string& url) {}

std::string Escape(const std::string& url) {}

}  // namespace

V4ProtocolConfig GetV4ProtocolConfig(const std::string& client_name,
                                     bool disable_auto_update) {}

void SetSbV4UrlPrefixForTesting(const char* url_prefix) {}

std::string GetReportUrl(const V4ProtocolConfig& config,
                         const std::string& method,
                         const ExtendedReportingLevel* reporting_level,
                         const bool is_enhanced_protection) {}

std::ostream& operator<<(std::ostream& os, const ListIdentifier& id) {}

PlatformType GetCurrentPlatformType() {}

ListIdentifier GetChromeExtMalwareId() {}

ListIdentifier GetChromeUrlApiId() {}

ListIdentifier GetUrlBillingId() {}

ListIdentifier GetUrlCsdDownloadAllowlistId() {}

ListIdentifier GetUrlCsdAllowlistId() {}

ListIdentifier GetUrlHighConfidenceAllowlistId() {}

ListIdentifier GetUrlMalwareId() {}

ListIdentifier GetUrlMalBinId() {}

ListIdentifier GetUrlSocEngId() {}

ListIdentifier GetUrlSubresourceFilterId() {}

ListIdentifier GetUrlSuspiciousSiteId() {}

ListIdentifier GetUrlUwsId() {}

std::string GetUmaSuffixForStore(const base::FilePath& file_path) {}

StoreAndHashPrefix::StoreAndHashPrefix(ListIdentifier list_id,
                                       const HashPrefixStr& hash_prefix)
    :{}

StoreAndHashPrefix::~StoreAndHashPrefix() {}

bool StoreAndHashPrefix::operator==(const StoreAndHashPrefix& other) const {}

bool StoreAndHashPrefix::operator!=(const StoreAndHashPrefix& other) const {}

size_t StoreAndHashPrefix::hash() const {}

bool SBThreatTypeSetIsValidForCheckBrowseUrl(const SBThreatTypeSet& set) {}

bool ListIdentifier::operator==(const ListIdentifier& other) const {}

bool ListIdentifier::operator!=(const ListIdentifier& other) const {}

size_t ListIdentifier::hash() const {}

ListIdentifier::ListIdentifier(PlatformType platform_type,
                               ThreatEntryType threat_entry_type,
                               ThreatType threat_type)
    :{}

ListIdentifier::ListIdentifier(const ListUpdateResponse& response)
    :{}

V4ProtocolConfig::V4ProtocolConfig(const std::string& client_name,
                                   bool disable_auto_update,
                                   const std::string& key_param,
                                   const std::string& version)
    :{}

V4ProtocolConfig::V4ProtocolConfig(const V4ProtocolConfig& other) = default;

V4ProtocolConfig::~V4ProtocolConfig() {}

// static
base::TimeDelta V4ProtocolManagerUtil::GetNextBackOffInterval(
    size_t* error_count,
    size_t* multiplier) {}

// static
void V4ProtocolManagerUtil::GetRequestUrlAndHeaders(
    const std::string& request_base64,
    const std::string& method_name,
    const V4ProtocolConfig& config,
    GURL* gurl,
    net::HttpRequestHeaders* headers) {}

// static
std::string V4ProtocolManagerUtil::ComposeUrl(const std::string& prefix,
                                              const std::string& method,
                                              const std::string& request_base64,
                                              const std::string& key_param) {}

// static
void V4ProtocolManagerUtil::UpdateHeaders(net::HttpRequestHeaders* headers) {}

// static
void V4ProtocolManagerUtil::UrlToFullHashes(
    const GURL& url,
    std::vector<FullHashStr>* full_hashes) {}

// static
bool V4ProtocolManagerUtil::FullHashToHashPrefix(const FullHashStr& full_hash,
                                                 PrefixSize prefix_size,
                                                 HashPrefixStr* hash_prefix) {}

// static
bool V4ProtocolManagerUtil::FullHashToSmallestHashPrefix(
    const FullHashStr& full_hash,
    HashPrefixStr* hash_prefix) {}

// static
bool V4ProtocolManagerUtil::FullHashMatchesHashPrefix(
    const FullHashStr& full_hash,
    const HashPrefixStr& hash_prefix) {}

// static
void V4ProtocolManagerUtil::GenerateHostsToCheck(
    const GURL& url,
    std::vector<std::string>* hosts) {}

// static
void V4ProtocolManagerUtil::GeneratePathsToCheck(
    const GURL& url,
    std::vector<std::string>* paths) {}

// static
void V4ProtocolManagerUtil::GeneratePatternsToCheck(
    const GURL& url,
    std::vector<std::string>* urls) {}

// static
FullHashStr V4ProtocolManagerUtil::GetFullHash(const GURL& url) {}

// static
void V4ProtocolManagerUtil::CanonicalizeUrl(const GURL& url,
                                            std::string* canonicalized_hostname,
                                            std::string* canonicalized_path,
                                            std::string* canonicalized_query) {}

// static
std::string V4ProtocolManagerUtil::RemoveConsecutiveChars(std::string_view str,
                                                          const char c) {}

// static
void V4ProtocolManagerUtil::GenerateHostVariantsToCheck(
    const std::string& host,
    std::vector<std::string>* hosts) {}

// static
void V4ProtocolManagerUtil::GeneratePathVariantsToCheck(
    const std::string& path,
    const std::string& query,
    std::vector<std::string>* paths) {}

// static
void V4ProtocolManagerUtil::SetClientInfoFromConfig(
    ClientInfo* client_info,
    const V4ProtocolConfig& config) {}

// static
void V4ProtocolManagerUtil::GetListClientStatesFromStoreStateMap(
    const std::unique_ptr<StoreStateMap>& store_state_map,
    std::vector<std::string>* list_client_states) {}

}  // namespace safe_browsing