diff options
author | chrome-bot@google.com <chrome-bot@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-02 00:14:02 +0000 |
---|---|---|
committer | chrome-bot@google.com <chrome-bot@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-02 00:14:02 +0000 |
commit | 4523fd290e2915710025b46c15be689cb7638a00 (patch) | |
tree | 85ab2b1efd9ec09e08ac247128c8dda0735b4399 /chrome/browser/extensions/extension_shelf_model.h | |
parent | bf0b51cbeef6ec8f7dc0d5fb46c76a739be5f84d (diff) | |
download | chromium_src-4523fd290e2915710025b46c15be689cb7638a00.zip chromium_src-4523fd290e2915710025b46c15be689cb7638a00.tar.gz chromium_src-4523fd290e2915710025b46c15be689cb7638a00.tar.bz2 |
Rolling back change 22245.
Too much red :-(
BUG=None
TEST=None
TBR=erikkay
Review URL: http://codereview.chromium.org/159763
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_shelf_model.h')
-rw-r--r-- | chrome/browser/extensions/extension_shelf_model.h | 99 |
1 files changed, 39 insertions, 60 deletions
diff --git a/chrome/browser/extensions/extension_shelf_model.h b/chrome/browser/extensions/extension_shelf_model.h index 29f6592..28fb00b 100644 --- a/chrome/browser/extensions/extension_shelf_model.h +++ b/chrome/browser/extensions/extension_shelf_model.h @@ -16,7 +16,36 @@ class Browser; class ExtensionPrefs; -class ExtensionShelfModelObserver; + +// Objects implement this interface when they wish to be notified of changes to +// the ExtensionShelfModel. +// +// Register your ExtensionShelfModelObserver with the ExtensionShelfModel using +// Add/RemoveObserver methods. +class ExtensionShelfModelObserver { + public: + // A new toolstrip was inserted into ExtensionShelfModel at |index|. + virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index) {} + + // The specified toolstrip is being removed and destroyed. + virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index) {} + + // |toolstrip| moved from |from_index| to |to_index|. + virtual void ToolstripMoved(ExtensionHost* toolstrip, + int from_index, + int to_index) {} + + // The specified toolstrip changed in some way (currently only size changes) + virtual void ToolstripChangedAt(ExtensionHost* toolstrip, int index) {} + + // 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 order of // the toolstrips is common across all of the models for a given Profile, @@ -31,13 +60,8 @@ class ExtensionShelfModel : public NotificationObserver { ExtensionHost* host; Extension::ToolstripInfo info; void* data; - int height; - GURL url; }; - typedef std::vector<ToolstripItem> ToolstripList; - typedef ToolstripList::iterator iterator; - // Add and remove observers to changes within this ExtensionShelfModel. void AddObserver(ExtensionShelfModelObserver* observer); void RemoveObserver(ExtensionShelfModelObserver* observer); @@ -46,10 +70,6 @@ class ExtensionShelfModel : public NotificationObserver { int count() const { return static_cast<int>(toolstrips_.size()); } bool empty() const { return toolstrips_.empty(); } - // Iterators for the toolstrips in the model. - iterator begin() { return toolstrips_.begin(); } - ExtensionShelfModel::iterator end() { return toolstrips_.end(); } - // Add |toolstrip| to the end of the shelf. void AppendToolstrip(const ToolstripItem& toolstrip); @@ -62,28 +82,18 @@ class ExtensionShelfModel : public NotificationObserver { // Move the toolstrip at |index| to |to_index|. void MoveToolstripAt(int index, int to_index); - // Lookup the index of |host|. Returns -1 if not present. - int IndexOfHost(ExtensionHost* host); + // Lookup the index of |toolstrip|. Returns -1 if not present. + int IndexOfToolstrip(ExtensionHost* toolstrip); // Return the toolstrip at |index|. - const ToolstripItem& ToolstripAt(int index); + ExtensionHost* ToolstripAt(int index); - // Return the ToolstripItem associated with |host| or NULL if it's not - // present. - ToolstripList::iterator ToolstripForHost(ExtensionHost* host); + // Return the ToolstripInfo at |index|. + Extension::ToolstripInfo& ToolstripInfoAt(int index); - // Set some arbitrary data associated with a particular toolstrip. + // Get/Set some arbitrary data associated with a particular toolstrip. void SetToolstripDataAt(int index, void* data); - - // Update the ToolstripItem for |toolstrip| to set its |url| and |height| - // and then call ToolstripChanged for all observers. - // If |url| is empty, no navigation is requested. - void ExpandToolstrip(iterator toolstrip, const GURL& url, int height); - - // Update the ToolstripItem for |toolstrip| to set its |url| and its height - // to 0, and then call ToolstripChanged for all observers. - // If |url| is empty, no navigation is requested. - void CollapseToolstrip(iterator toolstrip, const GURL& url); + void* ToolstripDataAt(int index); // NotificationObserver virtual void Observe(NotificationType type, @@ -116,7 +126,8 @@ class ExtensionShelfModel : public NotificationObserver { NotificationRegistrar registrar_; // The Toolstrips loaded in this model. The model owns these objects. - ToolstripList toolstrips_; + typedef std::vector<ToolstripItem> ExtensionToolstrips; + ExtensionToolstrips toolstrips_; // Our observers. typedef ObserverList<ExtensionShelfModelObserver> @@ -129,36 +140,4 @@ class ExtensionShelfModel : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(ExtensionShelfModel); }; -// Objects implement this interface when they wish to be notified of changes to -// the ExtensionShelfModel. -// -// Register your ExtensionShelfModelObserver with the ExtensionShelfModel using -// Add/RemoveObserver methods. -class ExtensionShelfModelObserver { - public: - // A new toolstrip was inserted into ExtensionShelfModel at |index|. - virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index) {} - - // The specified toolstrip is being removed and destroyed. - virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index) {} - - // |toolstrip| moved from |from_index| to |to_index|. - virtual void ToolstripMoved(ExtensionHost* toolstrip, - int from_index, - int to_index) {} - - // The specified toolstrip changed in some way (currently only size changes) - virtual void ToolstripChanged(ExtensionShelfModel::iterator toolstrip) {} - - // There are no more toolstrips in the model. - virtual void ExtensionShelfEmpty() {} - - // The entire model may have changed. - virtual void ShelfModelReloaded() {} - - // The model is being destroyed. - virtual void ShelfModelDeleting() {} -}; - - #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SHELF_MODEL_H_ |