#include "chrome/browser/component_updater/translate_kit_component_installer.h"
#include <memory>
#include <string>
#include <utility>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/services/on_device_translation/public/cpp/features.h"
#include "components/component_updater/component_updater_service.h"
#include "components/crx_file/id_util.h"
#include "components/update_client/update_client_errors.h"
#include "content/public/browser/browser_thread.h"
#include "crypto/sha2.h"
namespace component_updater {
namespace {
constexpr uint8_t kTranslateKitPublicKeySHA256[32] = …;
static_assert …;
constexpr base::FilePath::CharType
kTranslateKitComponentInstallationRelativePath[] = …);
#if BUILDFLAG(IS_WIN)
constexpr base::FilePath::CharType kTranslateKitBinaryRelativePath[] =
FILE_PATH_LITERAL("TranslateKitFiles/libtranslatekit.dll");
#else
constexpr base::FilePath::CharType kTranslateKitBinaryRelativePath[] = …);
#endif
constexpr char kTranslateKitManifestName[] = …;
base::FilePath GetInstalledPath(const base::FilePath& base) { … }
}
TranslateKitComponentInstallerPolicy::TranslateKitComponentInstallerPolicy() =
default;
TranslateKitComponentInstallerPolicy::~TranslateKitComponentInstallerPolicy() =
default;
bool TranslateKitComponentInstallerPolicy::VerifyInstallation(
const base::Value::Dict& manifest,
const base::FilePath& install_dir) const { … }
bool TranslateKitComponentInstallerPolicy::
SupportsGroupPolicyEnabledComponentUpdates() const { … }
bool TranslateKitComponentInstallerPolicy::RequiresNetworkEncryption() const { … }
update_client::CrxInstaller::Result
TranslateKitComponentInstallerPolicy::OnCustomInstall(
const base::Value::Dict& manifest,
const base::FilePath& install_dir) { … }
void TranslateKitComponentInstallerPolicy::OnCustomUninstall() { … }
void TranslateKitComponentInstallerPolicy::ComponentReady(
const base::Version& version,
const base::FilePath& install_dir,
base::Value::Dict manifest) { … }
base::FilePath TranslateKitComponentInstallerPolicy::GetRelativeInstallDir()
const { … }
void TranslateKitComponentInstallerPolicy::GetHash(
std::vector<uint8_t>* hash) const { … }
std::string TranslateKitComponentInstallerPolicy::GetName() const { … }
update_client::InstallerAttributes
TranslateKitComponentInstallerPolicy::GetInstallerAttributes() const { … }
void RegisterTranslateKitComponent(ComponentUpdateService* cus) { … }
}