blob: 758f9914940eef5e8e8d95f21b840ff55fa13eb8 [file] [log] [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_UPDATE_CLIENT_OP_INSTALL_H_
#define COMPONENTS_UPDATE_CLIENT_OP_INSTALL_H_
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include "base/functional/callback_forward.h"
#include "base/memory/scoped_refptr.h"
#include "base/values.h"
#include "components/crx_file/crx_verifier.h"
#include "components/update_client/crx_cache.h"
#include "components/update_client/update_client.h"
namespace base {
class FilePath;
}
namespace update_client {
class Unzipper;
// Installs a CRX. `callback` is posted to the sequence InstallOperation was
// called on. If `crx_cache` is provided, `crx_file` is placed into the cache,
// regardless of whether the install is successful or not. Otherwise, `crx_file`
// is deleted. Returns a cancellation callback.
base::OnceClosure InstallOperation(
scoped_refptr<CrxCache> crx_cache,
std::unique_ptr<Unzipper> unzipper,
crx_file::VerifierFormat crx_format,
const std::string& id,
const std::string& file_hash,
const std::vector<uint8_t>& pk_hash,
scoped_refptr<CrxInstaller> installer,
std::unique_ptr<CrxInstaller::InstallParams> install_params,
base::RepeatingCallback<void(base::Value::Dict)> event_adder,
base::RepeatingCallback<void(ComponentState)> state_tracker,
CrxInstaller::ProgressCallback progress_callback,
base::OnceCallback<void(const CrxInstaller::Result&)>
install_result_callback,
const base::FilePath& crx_file,
base::OnceCallback<void(base::expected<base::FilePath, CategorizedError>)>
callback);
} // namespace update_client
#endif // COMPONENTS_UPDATE_CLIENT_OP_INSTALL_H_