Index: chrome/browser/extensions/extension_bookmarks_module.cc |
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc |
index e325aa01dbc879290259e28750aa531675578b17..c61c8ddc56d8a3af89fa9ec29e6895fb7effe418 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, |