#include "components/update_client/op_install.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/values.h"
#include "components/crx_file/crx_verifier.h"
#include "components/update_client/configurator.h"
#include "components/update_client/crx_cache.h"
#include "components/update_client/task_traits.h"
#include "components/update_client/unpacker.h"
#include "components/update_client/unzipper.h"
#include "components/update_client/update_client.h"
#include "components/update_client/update_client_errors.h"
#include "third_party/puffin/src/include/puffin/puffpatch.h"
namespace update_client {
namespace {
class CallbackChecker : public base::RefCountedThreadSafe<CallbackChecker> { … };
void InstallComplete(
base::OnceCallback<void(const CrxInstaller::Result&)> callback,
base::RepeatingCallback<void(base::Value::Dict)> event_adder,
const CrxInstaller::Result& result) { … }
void InstallBlocking(
CrxInstaller::ProgressCallback progress_callback,
base::OnceCallback<void(const CrxInstaller::Result&)> callback,
const base::FilePath& unpack_path,
const std::string& public_key,
const std::string& next_fp,
std::unique_ptr<CrxInstaller::InstallParams> install_params,
scoped_refptr<CrxInstaller> installer) { … }
void Install(base::OnceCallback<void(const CrxInstaller::Result&)> callback,
const std::string& next_fp,
std::unique_ptr<CrxInstaller::InstallParams> install_params,
scoped_refptr<CrxInstaller> installer,
CrxInstaller::ProgressCallback progress_callback,
const Unpacker::Result& result) { … }
void Unpack(base::OnceCallback<void(const Unpacker::Result&)> callback,
const base::FilePath& crx_file,
std::unique_ptr<Unzipper> unzipper,
const std::vector<uint8_t>& pk_hash,
crx_file::VerifierFormat crx_format,
const CrxCache::Result& cache_result) { … }
}
void InstallOperation(
std::optional<scoped_refptr<CrxCache>> crx_cache,
std::unique_ptr<Unzipper> unzipper,
crx_file::VerifierFormat crx_format,
const std::string& id,
const std::vector<uint8_t>& pk_hash,
scoped_refptr<CrxInstaller> installer,
std::unique_ptr<CrxInstaller::InstallParams> install_params,
const std::string& next_fp,
base::RepeatingCallback<void(base::Value::Dict)> event_adder,
base::OnceCallback<void(const CrxInstaller::Result&)> callback,
CrxInstaller::ProgressCallback progress_callback,
const base::FilePath& crx_file) { … }
}