Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / extensions / browser / service_worker_manager.h
blob2ba3ad10e1a1b82260d8ca07eb65a47c4bae616b
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/macros.h"
6 #include "base/scoped_observer.h"
7 #include "extensions/browser/extension_registry_observer.h"
9 namespace content {
10 class BrowserContext;
13 namespace extensions {
15 // A helper class to manage extension service workers. Handles suspending
16 // them when the extension is unloaded and removing them when the extension is
17 // uninstalled.
18 class ServiceWorkerManager : public ExtensionRegistryObserver {
19 public:
20 explicit ServiceWorkerManager(content::BrowserContext* browser_context);
21 ~ServiceWorkerManager() override;
23 private:
24 // ExtensionRegistryObserver:
25 void OnExtensionUnloaded(content::BrowserContext* browser_context,
26 const Extension* extension,
27 UnloadedExtensionInfo::Reason reason) override;
28 void OnExtensionUninstalled(content::BrowserContext* browser_context,
29 const Extension* extension,
30 extensions::UninstallReason reason) override;
32 content::BrowserContext* browser_context_;
34 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
35 registry_observer_;
37 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerManager);
40 } // namespace extensions