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

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

Issue 48853005: Remove ExtensionToolbarModel from ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile after rebase Created 7 years, 1 month 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 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.
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698