OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/scoped_observer.h" |
9 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
10 #include "content/public/browser/notification_observer.h" | 11 #include "extensions/browser/extension_registry_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | |
12 | 12 |
13 class Profile; | 13 class Profile; |
14 | 14 |
| 15 namespace extensions { |
| 16 class ExtensionRegistry; |
| 17 } |
| 18 |
15 // This class manages the removal of shortcuts associated with an extension when | 19 // This class manages the removal of shortcuts associated with an extension when |
16 // that extension is unloaded. | 20 // that extension is unloaded. |
17 class ShortcutsExtensionsManager : public base::SupportsUserData::Data, | 21 class ShortcutsExtensionsManager |
18 public content::NotificationObserver { | 22 : public base::SupportsUserData::Data, |
| 23 public extensions::ExtensionRegistryObserver { |
19 public: | 24 public: |
20 explicit ShortcutsExtensionsManager(Profile* profile); | 25 explicit ShortcutsExtensionsManager(Profile* profile); |
21 ~ShortcutsExtensionsManager() override; | 26 ~ShortcutsExtensionsManager() override; |
22 | 27 |
| 28 // extensions::ExtensionRegistryObserver: |
| 29 void OnExtensionUnloaded( |
| 30 content::BrowserContext* browser_context, |
| 31 const extensions::Extension* extension, |
| 32 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 33 void OnShutdown(extensions::ExtensionRegistry* registry) override; |
| 34 |
23 private: | 35 private: |
24 // content::NotificationObserver: | 36 ScopedObserver<extensions::ExtensionRegistry, |
25 void Observe(int type, | 37 extensions::ExtensionRegistryObserver> |
26 const content::NotificationSource& source, | 38 registry_observer_; |
27 const content::NotificationDetails& details) override; | |
28 | |
29 Profile* profile_; | 39 Profile* profile_; |
30 content::NotificationRegistrar notification_registrar_; | |
31 | 40 |
32 DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager); | 41 DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager); |
33 }; | 42 }; |
34 | 43 |
35 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ | 44 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
OLD | NEW |