diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-28 17:36:10 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-28 17:36:10 +0000 |
commit | f825df2b1438559506e0a8511ad371daac41d2d1 (patch) | |
tree | 36a7964f87d0b6ab6c6ee64344c165112948d410 /chrome/browser/extensions/extension_bookmarks_module.cc | |
parent | be843e26b00f611d3bcf3b2652b8eccf95310346 (diff) | |
download | chromium_src-f825df2b1438559506e0a8511ad371daac41d2d1.zip chromium_src-f825df2b1438559506e0a8511ad371daac41d2d1.tar.gz chromium_src-f825df2b1438559506e0a8511ad371daac41d2d1.tar.bz2 |
Revert "Revert "Change extension event routers to not be singletons and to be more profile-aware.""
This time, we handle incognito profiles correctly (see comment in 57186).
This reverts commit 4b62f4fb0fe15eee4e573f7182552a7bd2125262.
BUG=57186, 87145
TEST=existing tests
Review URL: http://codereview.chromium.org/7230035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90789 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_bookmarks_module.cc')
-rw-r--r-- | chrome/browser/extensions/extension_bookmarks_module.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc index e325aa0..c61c8dd 100644 --- a/chrome/browser/extensions/extension_bookmarks_module.cc +++ b/chrome/browser/extensions/extension_bookmarks_module.cc @@ -118,22 +118,18 @@ void BookmarksFunction::Observe(NotificationType type, Release(); // Balanced in Run(). } -// static -ExtensionBookmarkEventRouter* ExtensionBookmarkEventRouter::GetInstance() { - return Singleton<ExtensionBookmarkEventRouter>::get(); -} - -ExtensionBookmarkEventRouter::ExtensionBookmarkEventRouter() { +ExtensionBookmarkEventRouter::ExtensionBookmarkEventRouter( + BookmarkModel* model) : model_(model) { } ExtensionBookmarkEventRouter::~ExtensionBookmarkEventRouter() { + if (model_) { + model_->RemoveObserver(this); + } } -void ExtensionBookmarkEventRouter::Observe(BookmarkModel* model) { - if (models_.find(model) == models_.end()) { - model->AddObserver(this); - models_.insert(model); - } +void ExtensionBookmarkEventRouter::Init() { + model_->AddObserver(this); } void ExtensionBookmarkEventRouter::DispatchEvent(Profile *profile, @@ -150,6 +146,11 @@ void ExtensionBookmarkEventRouter::Loaded(BookmarkModel* model) { // so they know when it's safe to use the API? } +void ExtensionBookmarkEventRouter::BookmarkModelBeingDeleted( + BookmarkModel* model) { + model_ = NULL; +} + void ExtensionBookmarkEventRouter::BookmarkNodeMoved( BookmarkModel* model, const BookmarkNode* old_parent, |