blob: 33b3bbbcdf3ce5a05780ea36eaa9ce033fbe13d6 [file] [log] [blame]
blundell33ec6492015-06-19 08:35:381// 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.
4
5#ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_
6#define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_
7
avie4d7b6f2015-12-26 00:59:188#include "base/macros.h"
Sigurdur Asgeirssonbddb19b2021-05-10 15:03:169#include "base/scoped_observation.h"
blundell33ec6492015-06-19 08:35:3810#include "base/supports_user_data.h"
Evan Stade0a86f982019-09-23 20:52:5811#include "extensions/browser/extension_registry.h"
limasdf01409c32017-03-31 08:36:0812#include "extensions/browser/extension_registry_observer.h"
blundell33ec6492015-06-19 08:35:3813
14class Profile;
15
16// This class manages the removal of shortcuts associated with an extension when
17// that extension is unloaded.
limasdf01409c32017-03-31 08:36:0818class ShortcutsExtensionsManager
19 : public base::SupportsUserData::Data,
20 public extensions::ExtensionRegistryObserver {
blundell33ec6492015-06-19 08:35:3821 public:
22 explicit ShortcutsExtensionsManager(Profile* profile);
23 ~ShortcutsExtensionsManager() override;
24
limasdf01409c32017-03-31 08:36:0825 // extensions::ExtensionRegistryObserver:
limasdf0deef2042017-05-03 19:17:1726 void OnExtensionUnloaded(content::BrowserContext* browser_context,
27 const extensions::Extension* extension,
28 extensions::UnloadedExtensionReason reason) override;
limasdf01409c32017-03-31 08:36:0829 void OnShutdown(extensions::ExtensionRegistry* registry) override;
blundell33ec6492015-06-19 08:35:3830
limasdf01409c32017-03-31 08:36:0831 private:
Sigurdur Asgeirssonbddb19b2021-05-10 15:03:1632 base::ScopedObservation<extensions::ExtensionRegistry,
33 extensions::ExtensionRegistryObserver>
34 registry_observation_{this};
blundell33ec6492015-06-19 08:35:3835 Profile* profile_;
blundell33ec6492015-06-19 08:35:3836
37 DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager);
38};
39
40#endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_