Index: chrome/browser/autocomplete/shortcuts_extensions_manager.cc |
diff --git a/chrome/browser/autocomplete/shortcuts_extensions_manager.cc b/chrome/browser/autocomplete/shortcuts_extensions_manager.cc |
index a623a1ff4db9e9d7ab330adf34c1844230878762..30fab15ce7de91e540031ec67dbd1237c7663482 100644 |
--- a/chrome/browser/autocomplete/shortcuts_extensions_manager.cc |
+++ b/chrome/browser/autocomplete/shortcuts_extensions_manager.cc |
@@ -5,36 +5,24 @@ |
#include "chrome/browser/autocomplete/shortcuts_extensions_manager.h" |
#include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
-#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/profiles/profile.h" |
#include "components/omnibox/browser/shortcuts_backend.h" |
-#include "content/public/browser/notification_details.h" |
-#include "content/public/browser/notification_source.h" |
-#include "extensions/features/features.h" |
- |
-#if BUILDFLAG(ENABLE_EXTENSIONS) |
-#include "extensions/browser/notification_types.h" |
+#include "extensions/browser/extension_registry.h" |
#include "extensions/common/extension.h" |
-#endif |
+#include "extensions/features/features.h" |
ShortcutsExtensionsManager::ShortcutsExtensionsManager(Profile* profile) |
- : profile_(profile) { |
+ : registry_observer_(this), profile_(profile) { |
DCHECK(profile_); |
-#if BUILDFLAG(ENABLE_EXTENSIONS) |
- notification_registrar_.Add( |
- this, extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
- content::Source<Profile>(profile_)); |
-#endif |
+ registry_observer_.Add(extensions::ExtensionRegistry::Get(profile_)); |
} |
ShortcutsExtensionsManager::~ShortcutsExtensionsManager() {} |
Peter Kasting
2017/03/30 23:35:31
Nit: You're also welcome to =default this in the h
limasdf
2017/03/31 03:26:27
Linking error for `= default` in the header :(
Peter Kasting
2017/03/31 06:09:59
Oh? I would have expected the warning, if any, to
limasdf
2017/03/31 06:17:53
Sorry for the confusion. First I just commented ou
|
-void ShortcutsExtensionsManager::Observe( |
- int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
-#if BUILDFLAG(ENABLE_EXTENSIONS) |
- DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, type); |
+void ShortcutsExtensionsManager::OnExtensionUnloaded( |
+ content::BrowserContext* browser_context, |
+ const extensions::Extension* extension, |
+ extensions::UnloadedExtensionInfo::Reason reason) { |
scoped_refptr<ShortcutsBackend> shortcuts_backend = |
ShortcutsBackendFactory::GetForProfileIfExists(profile_); |
if (!shortcuts_backend) |
@@ -42,8 +30,10 @@ void ShortcutsExtensionsManager::Observe( |
// When an extension is unloaded, we want to remove any Shortcuts associated |
// with it. |
- shortcuts_backend->DeleteShortcutsBeginningWithURL( |
- content::Details<extensions::UnloadedExtensionInfo>(details) |
- ->extension->url()); |
-#endif |
+ shortcuts_backend->DeleteShortcutsBeginningWithURL(extension->url()); |
+} |
+ |
+void ShortcutsExtensionsManager::OnShutdown( |
+ extensions::ExtensionRegistry* registry) { |
+ registry_observer_.RemoveAll(); |
} |