summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_shelf_model.h
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-19 20:19:13 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-19 20:19:13 +0000
commite81dba3039c19788d9fb58038816430078db7fd9 (patch)
treee10de1c875e1a93f02d95bb6650ae7055edef5c8 /chrome/browser/extensions/extension_shelf_model.h
parent40b5462b21d0c41ef6acc57a9da7ba5c3d44c0fe (diff)
downloadchromium_src-e81dba3039c19788d9fb58038816430078db7fd9.zip
chromium_src-e81dba3039c19788d9fb58038816430078db7fd9.tar.gz
chromium_src-e81dba3039c19788d9fb58038816430078db7fd9.tar.bz2
part 3 of toolstrip dragging - persist the drag order
Also notify other browser windows of changes to the order. BUG=http://code.google.com/p/chromium/issues/detail?id=12123 TEST=browser_tests.exe --gtest_filter=ExtensionShelfModelTest.* Review URL: http://codereview.chromium.org/131114 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18845 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_shelf_model.h')
-rw-r--r--chrome/browser/extensions/extension_shelf_model.h35
1 files changed, 28 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extension_shelf_model.h b/chrome/browser/extensions/extension_shelf_model.h
index 13fc520..7af61f8 100644
--- a/chrome/browser/extensions/extension_shelf_model.h
+++ b/chrome/browser/extensions/extension_shelf_model.h
@@ -11,11 +11,11 @@
#include "base/observer_list.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extensions_service.h"
class Browser;
-class ExtensionHost;
-class ExtensionView;
+class ExtensionPrefs;
// Objects implement this interface when they wish to be notified of changes to
// the ExtensionShelfModel.
@@ -41,10 +41,16 @@ class ExtensionShelfModelObserver {
// There are no more toolstrips in the model.
virtual void ExtensionShelfEmpty() {}
+ // The entire model may have changed.
+ virtual void ShelfModelReloaded() {}
+
// TODO(erikkay) - any more?
};
-// The model representing the toolstrips on an ExtensionShelf.
+// The model representing the toolstrips on an ExtensionShelf. The order of
+// the toolstrips is common across all of the models for a given Profile,
+// but there are multiple models. Each model contains the hosts/views which
+// are specific to a Browser.
class ExtensionShelfModel : public NotificationObserver {
public:
ExtensionShelfModel(Browser* browser);
@@ -82,27 +88,42 @@ class ExtensionShelfModel : public NotificationObserver {
const NotificationDetails& details);
private:
+ // Add all of the toolstrips from |extension|.
+ void AddExtension(Extension* extension);
+
// Add all of the toolstrips from each extension in |extensions|.
void AddExtensions(const ExtensionList* extensions);
// Remove all of the toolstrips in |extension| from the shelf.
- void RemoveExtension(const Extension* extension);
+ void RemoveExtension(Extension* extension);
+
+ // Update prefs with the most recent changes.
+ void UpdatePrefs();
+
+ // Reloads order from prefs.
+ void SortToolstrips();
// The browser that this model is attached to.
Browser* browser_;
+ // The preferences that this model uses.
+ ExtensionPrefs* prefs_;
+
// Manages our notification registrations.
NotificationRegistrar registrar_;
- // The Toolstrips in this model. The model owns these objects.
- typedef std::vector<ExtensionHost*> ExtensionToolstripList;
- ExtensionToolstripList toolstrips_;
+ // The Toolstrips loaded in this model. The model owns these objects.
+ typedef std::vector<ExtensionHost*> ExtensionToolstrips;
+ ExtensionToolstrips toolstrips_;
// Our observers.
typedef ObserverList<ExtensionShelfModelObserver>
ExtensionShelfModelObservers;
ExtensionShelfModelObservers observers_;
+ // Whether the model has received an EXTENSIONS_READY notification.
+ bool ready_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionShelfModel);
};