chromium/extensions/browser/zipfile_installer.cc

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

#include "extensions/browser/zipfile_installer.h"

#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "components/services/unzip/content/unzip_service.h"
#include "components/services/unzip/public/cpp/unzip.h"
#include "components/services/unzip/public/mojom/unzipper.mojom.h"
#include "extensions/browser/extension_file_task_runner.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/manifest.h"
#include "extensions/strings/grit/extensions_strings.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "services/data_decoder/public/mojom/json_parser.mojom.h"
#include "ui/base/l10n/l10n_util.h"

namespace extensions {

namespace {

constexpr char kExtensionHandlerTempDirError[] =;
constexpr char kExtensionHandlerUnpackedDirCreationError[] =;
constexpr char kExtensionHandlerZippedDirError[] =;
constexpr char kExtensionHandlerFileUnzipError[] =;

constexpr const base::FilePath::CharType* kAllowedThemeFiletypes[] =;

// Creates a directory in an OS temporary location based on `zip_file`.
// Directory format is (`zip_file` == "myzip.zip"):
//   <`root_unzip_dir`>/myzip_XXXXXX
// XXXXXX is populated with mkdtemp() logic.
ZipResultVariant PrepareAndGetTempUnzipDir(const base::FilePath& zip_file) {}

// Creates a unique directory based on `zip_file` inside `root_unzip_dir`.
// Directory format is (`zip_file` == "myzip.zip"):
//   <`root_unzip_dir`>/myzip_XXXXXX
// XXXXXX is populated with mkdtemp() logic.
ZipResultVariant PrepareAndGetUnzipDir(const base::FilePath& zip_file,
                                       const base::FilePath& root_unzip_dir) {}

std::optional<std::string> ReadFileContent(const base::FilePath& path) {}

}  // namespace

// static
scoped_refptr<ZipFileInstaller> ZipFileInstaller::Create(
    const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
    DoneCallback done_callback) {}

void ZipFileInstaller::InstallZipFileToTempDir(const base::FilePath& zip_file) {}

void ZipFileInstaller::InstallZipFileToUnpackedExtensionsDir(
    const base::FilePath& zip_file,
    const base::FilePath& unpacked_extensions_dir) {}

void ZipFileInstaller::LoadFromZipFileInDir(const base::FilePath& zip_file,
                                            const base::FilePath& unzip_dir) {}

void ZipFileInstaller::LoadFromZipFileImpl(const base::FilePath& zip_file,
                                           const base::FilePath& unzip_dir,
                                           bool create_unzip_dir) {}

ZipFileInstaller::ZipFileInstaller(
    const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
    DoneCallback done_callback)
    :{}

ZipFileInstaller::~ZipFileInstaller() = default;

void ZipFileInstaller::Unzip(ZipResultVariant unzip_dir_or_error) {}

void ZipFileInstaller::ManifestUnzipped(const base::FilePath& unzip_dir,
                                        bool success) {}

void ZipFileInstaller::ManifestRead(
    const base::FilePath& unzip_dir,
    std::optional<std::string> manifest_content) {}

void ZipFileInstaller::ManifestParsed(const base::FilePath& unzip_dir,
                                      std::optional<base::Value> result,
                                      const std::optional<std::string>& error) {}

void ZipFileInstaller::UnzipDone(const base::FilePath& unzip_dir,
                                 bool success) {}

void ZipFileInstaller::ReportFailure(const std::string& error) {}

// static
bool ZipFileInstaller::ShouldExtractFile(bool is_theme,
                                         const base::FilePath& file_path) {}

// static
bool ZipFileInstaller::IsManifestFile(const base::FilePath& file_path) {}

}  // namespace extensions