diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 22:53:51 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 22:53:51 +0000 |
commit | 6f0479fa6d498b8ba48c8b7cbcd507534fda610e (patch) | |
tree | ccd432f1d28d3535ec23c9d6330afbaede7420b6 /chrome | |
parent | 9a0d91236e8557d37498f002254a6a5427ebf842 (diff) | |
download | chromium_src-6f0479fa6d498b8ba48c8b7cbcd507534fda610e.zip chromium_src-6f0479fa6d498b8ba48c8b7cbcd507534fda610e.tar.gz chromium_src-6f0479fa6d498b8ba48c8b7cbcd507534fda610e.tar.bz2 |
Revert 39942 - Switch NetworkChangeNotifier implementations to use ObserverList.
Fix up observer list so we can use FOR_EACH_OBSERVER when check_empty is set.
Clean up the ObserverList API a bit, replacing GetElementAt() with HasObserver() and Clear().
BUG=36590
Review URL: http://codereview.chromium.org/652205
TBR=willchan@chromium.org
Review URL: http://codereview.chromium.org/661029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39945 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/extensions/extension_shelf_model.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.cc | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/extensions/extension_shelf_model.cc b/chrome/browser/extensions/extension_shelf_model.cc index 51a8ce1..dc584d8 100644 --- a/chrome/browser/extensions/extension_shelf_model.cc +++ b/chrome/browser/extensions/extension_shelf_model.cc @@ -44,7 +44,8 @@ ExtensionShelfModel::~ExtensionShelfModel() { FOR_EACH_OBSERVER(ExtensionShelfModelObserver, observers_, ShelfModelDeleting()); - observers_.Clear(); + while (observers_.size()) + observers_.RemoveObserver(observers_.GetElementAt(0)); for (iterator t = toolstrips_.begin(); t != toolstrips_.end(); ++t) delete t->host; diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 2fba4b5..3b216d4 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -86,7 +86,11 @@ bool TabStripModel::HasNonPhantomTabs() const { } bool TabStripModel::HasObserver(TabStripModelObserver* observer) { - return observers_.HasObserver(observer); + for (size_t i = 0; i < observers_.size(); ++i) { + if (observers_.GetElementAt(i) == observer) + return true; + } + return false; } bool TabStripModel::ContainsIndex(int index) const { |