blundell | 33ec649 | 2015-06-19 08:35:38 | [diff] [blame] | 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. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
| 6 | #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
| 7 | |
avi | e4d7b6f | 2015-12-26 00:59:18 | [diff] [blame] | 8 | #include "base/macros.h" |
Sigurdur Asgeirsson | bddb19b | 2021-05-10 15:03:16 | [diff] [blame] | 9 | #include "base/scoped_observation.h" |
blundell | 33ec649 | 2015-06-19 08:35:38 | [diff] [blame] | 10 | #include "base/supports_user_data.h" |
Evan Stade | 0a86f98 | 2019-09-23 20:52:58 | [diff] [blame] | 11 | #include "extensions/browser/extension_registry.h" |
limasdf | 01409c3 | 2017-03-31 08:36:08 | [diff] [blame] | 12 | #include "extensions/browser/extension_registry_observer.h" |
blundell | 33ec649 | 2015-06-19 08:35:38 | [diff] [blame] | 13 | |
| 14 | class Profile; |
| 15 | |
| 16 | // This class manages the removal of shortcuts associated with an extension when |
| 17 | // that extension is unloaded. |
limasdf | 01409c3 | 2017-03-31 08:36:08 | [diff] [blame] | 18 | class ShortcutsExtensionsManager |
| 19 | : public base::SupportsUserData::Data, |
| 20 | public extensions::ExtensionRegistryObserver { |
blundell | 33ec649 | 2015-06-19 08:35:38 | [diff] [blame] | 21 | public: |
| 22 | explicit ShortcutsExtensionsManager(Profile* profile); |
| 23 | ~ShortcutsExtensionsManager() override; |
| 24 | |
limasdf | 01409c3 | 2017-03-31 08:36:08 | [diff] [blame] | 25 | // extensions::ExtensionRegistryObserver: |
limasdf | 0deef204 | 2017-05-03 19:17:17 | [diff] [blame] | 26 | void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 27 | const extensions::Extension* extension, |
| 28 | extensions::UnloadedExtensionReason reason) override; |
limasdf | 01409c3 | 2017-03-31 08:36:08 | [diff] [blame] | 29 | void OnShutdown(extensions::ExtensionRegistry* registry) override; |
blundell | 33ec649 | 2015-06-19 08:35:38 | [diff] [blame] | 30 | |
limasdf | 01409c3 | 2017-03-31 08:36:08 | [diff] [blame] | 31 | private: |
Sigurdur Asgeirsson | bddb19b | 2021-05-10 15:03:16 | [diff] [blame] | 32 | base::ScopedObservation<extensions::ExtensionRegistry, |
| 33 | extensions::ExtensionRegistryObserver> |
| 34 | registry_observation_{this}; |
blundell | 33ec649 | 2015-06-19 08:35:38 | [diff] [blame] | 35 | Profile* profile_; |
blundell | 33ec649 | 2015-06-19 08:35:38 | [diff] [blame] | 36 | |
| 37 | DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager); |
| 38 | }; |
| 39 | |
| 40 | #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |