#include "components/update_client/utils.h"
#include <stddef.h>
#include <cmath>
#include <cstring>
#include <memory>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
#include "base/functional/callback.h"
#include "base/json/json_file_value_serializer.h"
#include "base/path_service.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/system/sys_info.h"
#include "base/threading/platform_thread.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/crx_file/id_util.h"
#include "components/update_client/component.h"
#include "components/update_client/configurator.h"
#include "components/update_client/network.h"
#include "components/update_client/update_client.h"
#include "components/update_client/update_client_errors.h"
#include "crypto/secure_hash.h"
#include "crypto/sha2.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_WIN)
#include <shlobj.h>
#include "base/win/windows_version.h"
#endif
namespace update_client {
const char kArchAmd64[] = …;
const char kArchIntel[] = …;
const char kArchArm64[] = …;
bool HasDiffUpdate(const Component& component) { … }
bool IsHttpServerError(int status_code) { … }
bool DeleteFileAndEmptyParentDirectory(const base::FilePath& filepath) { … }
bool DeleteEmptyDirectory(const base::FilePath& dir_path) { … }
std::string GetCrxComponentID(const CrxComponent& component) { … }
std::string GetCrxIdFromPublicKeyHash(base::span<const uint8_t> pk_hash) { … }
bool VerifyFileHash256(const base::FilePath& filepath,
const std::string& expected_hash_str) { … }
bool IsValidBrand(const std::string& brand) { … }
bool IsValidInstallerAttributePart(const std::string& part,
const std::string& special_chars,
size_t min_length,
size_t max_length) { … }
bool IsValidInstallerAttributeName(const std::string& name) { … }
bool IsValidInstallerAttributeValue(const std::string& value) { … }
bool IsValidInstallerAttribute(const InstallerAttribute& attr) { … }
void RemoveUnsecureUrls(std::vector<GURL>* urls) { … }
CrxInstaller::Result InstallFunctionWrapper(
base::OnceCallback<bool()> callback) { … }
std::optional<base::Value::Dict> ReadManifest(
const base::FilePath& unpack_path) { … }
std::string GetArchitecture() { … }
bool RetryDeletePathRecursively(const base::FilePath& path) { … }
bool RetryDeletePathRecursivelyCustom(
const base::FilePath& path,
size_t tries,
const base::TimeDelta& seconds_between_tries) { … }
}