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

Unified Diff: chrome/browser/extensions/extension_toolbar_model.h

Issue 259843004: Remove some NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED from c/b/extensions Part2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comment Created 6 years, 8 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/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_;
« no previous file with comments | « chrome/browser/extensions/extension_infobar_delegate.cc ('k') | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698