| 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/scoped_observer.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| 11 #include "extensions/browser/extension_registry_observer.h" | 11 #include "extensions/browser/extension_registry_observer.h" |
| 12 | 12 |
| 13 class Profile; | 13 class Profile; |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 class ExtensionRegistry; | 16 class ExtensionRegistry; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // 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 |
| 20 // that extension is unloaded. | 20 // that extension is unloaded. |
| 21 class ShortcutsExtensionsManager | 21 class ShortcutsExtensionsManager |
| 22 : public base::SupportsUserData::Data, | 22 : public base::SupportsUserData::Data, |
| 23 public extensions::ExtensionRegistryObserver { | 23 public extensions::ExtensionRegistryObserver { |
| 24 public: | 24 public: |
| 25 explicit ShortcutsExtensionsManager(Profile* profile); | 25 explicit ShortcutsExtensionsManager(Profile* profile); |
| 26 ~ShortcutsExtensionsManager() override; | 26 ~ShortcutsExtensionsManager() override; |
| 27 | 27 |
| 28 // extensions::ExtensionRegistryObserver: | 28 // extensions::ExtensionRegistryObserver: |
| 29 void OnExtensionUnloaded( | 29 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 30 content::BrowserContext* browser_context, | 30 const extensions::Extension* extension, |
| 31 const extensions::Extension* extension, | 31 extensions::UnloadedExtensionReason reason) override; |
| 32 extensions::UnloadedExtensionInfo::Reason reason) override; | |
| 33 void OnShutdown(extensions::ExtensionRegistry* registry) override; | 32 void OnShutdown(extensions::ExtensionRegistry* registry) override; |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 ScopedObserver<extensions::ExtensionRegistry, | 35 ScopedObserver<extensions::ExtensionRegistry, |
| 37 extensions::ExtensionRegistryObserver> | 36 extensions::ExtensionRegistryObserver> |
| 38 registry_observer_; | 37 registry_observer_; |
| 39 Profile* profile_; | 38 Profile* profile_; |
| 40 | 39 |
| 41 DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager); | 40 DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager); |
| 42 }; | 41 }; |
| 43 | 42 |
| 44 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ | 43 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
| OLD | NEW |