chromium/chrome/browser/extensions/crx_installer.cc

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

#include "chrome/browser/extensions/crx_installer.h"

#include <map>
#include <set>
#include <utility>

#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/version.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/blocklist_check.h"
#include "chrome/browser/extensions/convert_user_script.h"
#include "chrome/browser/extensions/extension_assets_manager.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/forced_extensions/install_stage_tracker.h"
#include "chrome/browser/extensions/install_tracker.h"
#include "chrome/browser/extensions/install_tracker_factory.h"
#include "chrome/browser/extensions/load_error_reporter.h"
#include "chrome/browser/extensions/permissions/permissions_updater.h"
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
#include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/extensions/extension_install_ui.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/crx_file/crx_verifier.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/content_verifier/content_verifier.h"
#include "extensions/browser/extension_file_task_runner.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/install/crx_install_error.h"
#include "extensions/browser/install_flag.h"
#include "extensions/browser/install_stage.h"
#include "extensions/browser/policy_check.h"
#include "extensions/browser/preload_check_group.h"
#include "extensions/browser/requirements_checker.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/file_util.h"
#include "extensions/common/icons/extension_icon_set.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_handlers/kiosk_mode_info.h"
#include "extensions/common/manifest_handlers/shared_module_info.h"
#include "extensions/common/manifest_url_handlers.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/user_script.h"
#include "extensions/common/verifier_formats.h"
#include "extensions/strings/grit/extensions_strings.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/user_manager/user_manager.h"
#endif

BrowserThread;

namespace extensions {

// static
scoped_refptr<CrxInstaller> CrxInstaller::CreateSilent(
    ExtensionService* frontend) {}

// static
scoped_refptr<CrxInstaller> CrxInstaller::Create(
    ExtensionService* frontend,
    std::unique_ptr<ExtensionInstallPrompt> client) {}

// static
scoped_refptr<CrxInstaller> CrxInstaller::Create(
    ExtensionService* service,
    std::unique_ptr<ExtensionInstallPrompt> client,
    const WebstoreInstaller::Approval* approval) {}

CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> service_weak,
                           std::unique_ptr<ExtensionInstallPrompt> client,
                           const WebstoreInstaller::Approval* approval)
    :{}

CrxInstaller::~CrxInstaller() {}

void CrxInstaller::InstallCrx(const base::FilePath& source_file) {}

void CrxInstaller::InstallCrxFile(const CRXFileInfo& source_file) {}

void CrxInstaller::InstallUnpackedCrx(const ExtensionId& extension_id,
                                      const std::string& public_key,
                                      const base::FilePath& unpacked_dir) {}

void CrxInstaller::InstallUserScript(const base::FilePath& source_file,
                                     const GURL& download_url) {}

void CrxInstaller::ConvertUserScriptOnSharedFileThread() {}

void CrxInstaller::UpdateExtensionFromUnpackedCrx(
    const ExtensionId& extension_id,
    const std::string& public_key,
    const base::FilePath& unpacked_dir) {}

std::optional<CrxInstallError> CrxInstaller::CheckExpectations(
    const Extension* extension) {}

std::optional<CrxInstallError> CrxInstaller::AllowInstall(
    const Extension* extension) {}

void CrxInstaller::ShouldComputeHashesOnUI(
    scoped_refptr<const Extension> extension,
    base::OnceCallback<void(bool)> callback) {}

void CrxInstaller::GetContentVerifierKeyOnUI(
    base::OnceCallback<void(ContentVerifierKey)> callback) {}

void CrxInstaller::GetContentVerifierKey(
    base::OnceCallback<void(ContentVerifierKey)> callback) {}

void CrxInstaller::ShouldComputeHashesForOffWebstoreExtension(
    scoped_refptr<const Extension> extension,
    base::OnceCallback<void(bool)> callback) {}

void CrxInstaller::OnUnpackFailure(const CrxInstallError& error) {}

void CrxInstaller::OnUnpackSuccess(
    const base::FilePath& temp_dir,
    const base::FilePath& extension_dir,
    std::unique_ptr<base::Value::Dict> original_manifest,
    const Extension* extension,
    const SkBitmap& install_icon,
    base::Value::Dict ruleset_install_prefs) {}

void CrxInstaller::OnUnpackSuccessOnSharedFileThread(
    base::FilePath temp_dir,
    base::FilePath extension_dir,
    std::unique_ptr<base::Value::Dict> original_manifest,
    scoped_refptr<const Extension> extension,
    SkBitmap install_icon,
    base::Value::Dict ruleset_install_prefs) {}

void CrxInstaller::OnStageChanged(InstallationStage stage) {}

void CrxInstaller::OnProfileWillBeDestroyed(Profile* profile) {}

void CrxInstaller::CheckInstall() {}

void CrxInstaller::OnInstallChecksComplete(const PreloadCheck::Errors& errors) {}

void CrxInstaller::ConfirmInstall() {}

void CrxInstaller::OnInstallPromptDone(
    ExtensionInstallPrompt::DoneCallbackPayload payload) {}

void CrxInstaller::InitializeCreationFlagsForUpdate(const Extension* extension,
                                                    const int initial_flags) {}

void CrxInstaller::UpdateCreationFlagsAndCompleteInstall(
    WithholdingBehavior withholding_behavior) {}

void CrxInstaller::CompleteInstall(
    bool updates_from_webstore_or_empty_update_url) {}

void CrxInstaller::ReloadExtensionAfterInstall(
    const base::FilePath& version_dir) {}

void CrxInstaller::ReportFailureFromSharedFileThread(
    const CrxInstallError& error) {}

void CrxInstaller::ReportFailureFromUIThread(const CrxInstallError& error) {}

void CrxInstaller::ReportSuccessFromSharedFileThread() {}

void CrxInstaller::ReportSuccessFromUIThread() {}

void CrxInstaller::ReportInstallationStage(InstallationStage stage) {}

void CrxInstaller::NotifyCrxInstallBegin() {}

void CrxInstaller::NotifyCrxInstallComplete(
    const std::optional<CrxInstallError>& error) {}

void CrxInstaller::CleanupTempFiles() {}

void CrxInstaller::CheckUpdateFromSettingsPage() {}

void CrxInstaller::ConfirmReEnable() {}

base::SequencedTaskRunner* CrxInstaller::GetUnpackerTaskRunner() {}

void CrxInstaller::set_withhold_permissions() {}

void CrxInstaller::AddInstallerCallback(InstallerResultCallback callback) {}

void CrxInstaller::RunInstallerCallbacks(
    const std::optional<CrxInstallError>& error) {}

void CrxInstaller::set_expectations_verified_callback(
    ExpectationsVerifiedCallback callback) {}

}  // namespace extensions