Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6547)

Unified Diff: chrome/browser/autocomplete/extension_app_provider.cc

Issue 271393003: Use ExtensionRegistryObserver instead of deprecated extension notification from autocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: colon to period Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}
« no previous file with comments | « chrome/browser/autocomplete/extension_app_provider.h ('k') | chrome/browser/autocomplete/extension_app_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698