Index: chrome/browser/autocomplete/extension_app_provider.cc |
diff --git a/chrome/browser/autocomplete/extension_app_provider.cc b/chrome/browser/autocomplete/extension_app_provider.cc |
index f29b991841390e2b58a5dd148d688a9b75686a47..d6d0b7c918b45a6d484b287867c137708342b104 100644 |
--- a/chrome/browser/autocomplete/extension_app_provider.cc |
+++ b/chrome/browser/autocomplete/extension_app_provider.cc |
@@ -29,16 +29,21 @@ |
ExtensionAppProvider::ExtensionAppProvider( |
AutocompleteProviderListener* listener, |
Profile* profile) |
- : AutocompleteProvider(listener, profile, |
- AutocompleteProvider::TYPE_EXTENSION_APP) { |
+ : AutocompleteProvider(listener, |
+ profile, |
+ AutocompleteProvider::TYPE_EXTENSION_APP), |
+ extension_registry_observer_(this) { |
// Notifications of extensions loading and unloading always come from the |
// non-incognito profile, but we need to see them regardless, as the incognito |
// windows can be affected. |
- registrar_.Add(this, |
- chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
- content::Source<Profile>(profile_->GetOriginalProfile())); |
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
content::Source<Profile>(profile_->GetOriginalProfile())); |
+ |
+ // ExtensionRegistryObserver will handle getting the original profile itself |
+ // as necessary. |
+ extension_registry_observer_.Add( |
+ extensions::ExtensionRegistry::Get(profile_)); |
+ |
RefreshAppList(); |
} |
@@ -183,9 +188,16 @@ void ExtensionAppProvider::RefreshAppList() { |
} |
} |
+void ExtensionAppProvider::OnExtensionLoaded( |
+ content::BrowserContext* browser_context, |
+ const extensions::Extension* extension) { |
+ RefreshAppList(); |
+} |
+ |
void ExtensionAppProvider::Observe(int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
+ DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNINSTALLED, type); |
RefreshAppList(); |
} |