blob: 420ef21abcb0fb51f11b0fab1600537b235693ad [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "extensions/browser/extension_registry_observer.h"
namespace content {
class BrowserContext;
namespace extensions {
// A helper class to manage extension service workers. Handles suspending
// them when the extension is unloaded and removing them when the extension is
// uninstalled.
class ServiceWorkerManager : public ExtensionRegistryObserver {
explicit ServiceWorkerManager(content::BrowserContext* browser_context);
~ServiceWorkerManager() override;
// ExtensionRegistryObserver:
void OnExtensionUnloaded(content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionReason reason) override;
void OnExtensionUninstalled(content::BrowserContext* browser_context,
const Extension* extension,
extensions::UninstallReason reason) override;
content::BrowserContext* browser_context_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
} // namespace extensions