| 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 1d77d4ee81cd91f0b6ff2180fa9043e2821c4215..7f88f67b02bd723641d6d411d89b1aa2401783a0 100644
|
| --- a/chrome/browser/extensions/extension_toolbar_model.h
|
| +++ b/chrome/browser/extensions/extension_toolbar_model.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/prefs/pref_change_registrar.h"
|
| #include "chrome/common/extensions/extension.h"
|
| #include "chrome/browser/extensions/extension_prefs.h"
|
| +#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
|
| #include "content/public/browser/notification_observer.h"
|
| #include "content/public/browser/notification_registrar.h"
|
|
|
| @@ -18,9 +19,11 @@ class ExtensionService;
|
| class PrefService;
|
|
|
| // Model for the browser actions toolbar.
|
| -class ExtensionToolbarModel : public content::NotificationObserver {
|
| +class ExtensionToolbarModel : public content::NotificationObserver,
|
| + public BrowserContextKeyedService {
|
| public:
|
| - explicit ExtensionToolbarModel(ExtensionService* service);
|
| + ExtensionToolbarModel(Profile* profile,
|
| + extensions::ExtensionPrefs* extension_prefs);
|
| virtual ~ExtensionToolbarModel();
|
|
|
| // The action that should be taken as a result of clicking a browser action.
|
| @@ -59,6 +62,9 @@ class ExtensionToolbarModel : public content::NotificationObserver {
|
| virtual ~Observer() {}
|
| };
|
|
|
| + // Convenience function to get the ExtensionToolbarModel for a Profile.
|
| + static ExtensionToolbarModel* Get(Profile* profile);
|
| +
|
| // Functions called by the view.
|
| void AddObserver(Observer* observer);
|
| void RemoveObserver(Observer* observer);
|
| @@ -106,11 +112,13 @@ class ExtensionToolbarModel : public content::NotificationObserver {
|
| // 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.
|
| - void InitializeExtensionList();
|
| - void Populate(const extensions::ExtensionIdList& positions);
|
| + void InitializeExtensionList(ExtensionService* service);
|
| + void Populate(const extensions::ExtensionIdList& positions,
|
| + ExtensionService* service);
|
|
|
| // Fills |list| with extensions based on provided |order|.
|
| - void FillExtensionList(const extensions::ExtensionIdList& order);
|
| + void FillExtensionList(const extensions::ExtensionIdList& order,
|
| + ExtensionService* service);
|
|
|
| // Save the model to prefs.
|
| void UpdatePrefs();
|
| @@ -127,9 +135,10 @@ class ExtensionToolbarModel : public content::NotificationObserver {
|
| void RemoveExtension(const extensions::Extension* extension);
|
| void UninstalledExtension(const extensions::Extension* extension);
|
|
|
| - // Our ExtensionService, guaranteed to outlive us.
|
| - ExtensionService* service_;
|
| + // The Profile this toolbar model is for.
|
| + Profile* profile_;
|
|
|
| + extensions::ExtensionPrefs* extension_prefs_;
|
| PrefService* prefs_;
|
|
|
| // True if we've handled the initial EXTENSIONS_READY notification.
|
|
|