Index: chrome/browser/extensions/extension_toolbar_model.h |
diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h |
index 1bf95e9a5f6c58432743cbfadc1213e5988cd951..ba78a37c44b83f4fc302324b55ff5f235c267225 100644 |
--- a/chrome/browser/extensions/extension_toolbar_model.h |
+++ b/chrome/browser/extensions/extension_toolbar_model.h |
@@ -8,10 +8,12 @@ |
#include "base/compiler_specific.h" |
#include "base/observer_list.h" |
#include "base/prefs/pref_change_registrar.h" |
+#include "base/scoped_observer.h" |
#include "components/keyed_service/core/keyed_service.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
#include "extensions/browser/extension_prefs.h" |
+#include "extensions/browser/extension_registry_observer.h" |
#include "extensions/common/extension.h" |
class Browser; |
@@ -20,9 +22,11 @@ class PrefService; |
class Profile; |
namespace extensions { |
+class ExtensionRegistry; |
// Model for the browser actions toolbar. |
class ExtensionToolbarModel : public content::NotificationObserver, |
+ public ExtensionRegistryObserver, |
public KeyedService { |
public: |
ExtensionToolbarModel(Profile* profile, ExtensionPrefs* extension_prefs); |
@@ -137,6 +141,14 @@ class ExtensionToolbarModel : public content::NotificationObserver, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) OVERRIDE; |
+ // ExtensionRegistryObserver implementation. |
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
+ const Extension* extension) OVERRIDE; |
+ virtual void OnExtensionUnloaded( |
+ content::BrowserContext* browser_context, |
+ const Extension* extension, |
+ UnloadedExtensionInfo::Reason reason) OVERRIDE; |
+ |
// To be called after the extension service is ready; gets loaded extensions |
// from the extension service and their saved order from the pref service |
// and constructs |toolbar_items_| from these data. |
@@ -193,6 +205,10 @@ class ExtensionToolbarModel : public content::NotificationObserver, |
content::NotificationRegistrar registrar_; |
+ // Listen to extension load, unloaded notifications. |
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
+ extension_registry_observer_; |
+ |
// For observing change of toolbar order preference by external entity (sync). |
PrefChangeRegistrar pref_change_registrar_; |
base::Closure pref_change_callback_; |