chromium/chrome/browser/extensions/extension_garbage_collector.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 "chrome/browser/extensions/extension_garbage_collector.h"

#include <stddef.h>

#include <memory>
#include <utility>

#include "base/check_op.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/notreached.h"
#include "base/one_shot_event.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/extensions/extension_garbage_collector_factory.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/install_tracker.h"
#include "chrome/browser/extensions/pending_extension_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_file_task_runner.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/file_util.h"

namespace extensions {

namespace {

// Wait this long before trying to garbage collect extensions again.
constexpr base::TimeDelta kGarbageCollectRetryDelay =;

// Wait this long after startup to see if there are any extensions which can be
// garbage collected.
constexpr base::TimeDelta kGarbageCollectStartupDelay =;

ExtensionPathsMultimap;

void CheckExtensionDirectory(const base::FilePath& path,
                             const ExtensionPathsMultimap& extension_paths) {}

// Deletes uninstalled extensions in the unpacked directory.
// Installed unpacked extensions are not saved in the same directory structure
// as packed extensions. For example they have no version subdirs and their root
// folders are not named with the extension's ID, so we can't use the same logic
// as packed extensions when deleting them. Note: This is meant to only handle
// unpacked .zip installs and should not be called for an `extension_directory`
// outside the profile directory because if `extension_directory` is not in
// `installed_extension_dirs` we'll delete it. Currently there's some certainty
// that `extension_directory` will not be outside the profile directory.
void CheckUnpackedExtensionDirectory(
    const base::FilePath& extension_directory,
    const ExtensionPathsMultimap& installed_extension_dirs) {}

}  // namespace

ExtensionGarbageCollector::ExtensionGarbageCollector(
    content::BrowserContext* context)
    :{}

ExtensionGarbageCollector::~ExtensionGarbageCollector() {}

// static
ExtensionGarbageCollector* ExtensionGarbageCollector::Get(
    content::BrowserContext* context) {}

void ExtensionGarbageCollector::Shutdown() {}

void ExtensionGarbageCollector::GarbageCollectExtensionsForTest() {}

// static
void ExtensionGarbageCollector::GarbageCollectExtensionsOnFileThread(
    const base::FilePath& install_directory,
    const ExtensionPathsMultimap& extension_paths,
    bool unpacked) {}

void ExtensionGarbageCollector::GarbageCollectExtensions() {}

void ExtensionGarbageCollector::OnBeginCrxInstall(
    content::BrowserContext* context,
    const CrxInstaller& installer,
    const ExtensionId& extension_id) {}

void ExtensionGarbageCollector::OnFinishCrxInstall(
    content::BrowserContext* context,
    const CrxInstaller& installer,
    const ExtensionId& extension_id,
    bool success) {}

}  // namespace extensions