#include "extensions/browser/extension_registrar.h"
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "build/chromeos_buildflags.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host.h"
#include "extensions/browser/blocklist_extension_prefs.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/lazy_context_id.h"
#include "extensions/browser/lazy_context_task_queue.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/service_worker/service_worker_task_queue.h"
#include "extensions/browser/task_queue_util.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/permissions/permissions_data.h"
#include "third_party/blink/public/common/service_worker/service_worker_status_code.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/crosapi/browser_util.h"
#endif
DevToolsAgentHost;
namespace {
BASE_FEATURE(…);
}
namespace extensions {
ExtensionRegistrar::ExtensionRegistrar(content::BrowserContext* browser_context,
Delegate* delegate)
: … { … }
ExtensionRegistrar::~ExtensionRegistrar() = default;
void ExtensionRegistrar::Shutdown() { … }
void ExtensionRegistrar::AddExtension(
scoped_refptr<const Extension> extension) { … }
void ExtensionRegistrar::AddNewExtension(
scoped_refptr<const Extension> extension) { … }
void ExtensionRegistrar::RemoveExtension(const ExtensionId& extension_id,
UnloadedExtensionReason reason) { … }
void ExtensionRegistrar::EnableExtension(const ExtensionId& extension_id) { … }
void ExtensionRegistrar::DisableExtension(const ExtensionId& extension_id,
int disable_reasons) { … }
namespace {
std::vector<scoped_refptr<DevToolsAgentHost>> GetDevToolsAgentHostsFor(
ProcessManager* process_manager,
const Extension* extension) { … }
}
void ExtensionRegistrar::ReloadExtension(
const ExtensionId extension_id,
LoadErrorBehavior load_error_behavior) { … }
void ExtensionRegistrar::OnUnpackedExtensionReloadFailed(
const base::FilePath& path) { … }
void ExtensionRegistrar::TerminateExtension(const ExtensionId& extension_id) { … }
void ExtensionRegistrar::UntrackTerminatedExtension(
const ExtensionId& extension_id) { … }
bool ExtensionRegistrar::IsExtensionEnabled(
const ExtensionId& extension_id) const { … }
void ExtensionRegistrar::DidCreateMainFrameForBackgroundPage(
ExtensionHost* host) { … }
void ExtensionRegistrar::ActivateExtension(const Extension* extension,
bool is_newly_added) { … }
void ExtensionRegistrar::DeactivateExtension(const Extension* extension,
UnloadedExtensionReason reason) { … }
void ExtensionRegistrar::UnregisterServiceWorkerWithRootScope(
const Extension* new_extension) { … }
void ExtensionRegistrar::NotifyServiceWorkerUnregistered(
const ExtensionId& extension_id,
blink::ServiceWorkerStatusCode status) { … }
bool ExtensionRegistrar::ReplaceReloadedExtension(
scoped_refptr<const Extension> extension) { … }
void ExtensionRegistrar::MaybeSpinUpLazyContext(const Extension* extension,
bool is_newly_added) { … }
void ExtensionRegistrar::OnStartedTrackingServiceWorkerInstance(
const WorkerId& worker_id) { … }
}