Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4518)

Unified Diff: chrome/browser/extensions/extension_bookmarks_module.h

Issue 7243012: Change many extension event routers to not be singletons and to be more profile-aware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bookmark remove observer Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_bookmarks_module.h
diff --git a/chrome/browser/extensions/extension_bookmarks_module.h b/chrome/browser/extensions/extension_bookmarks_module.h
index 48be1b74557329e98df2f1c91a49760f310c9313..079656e131f622c666f5b281e3d30f4ed05e6e76 100644
--- a/chrome/browser/extensions/extension_bookmarks_module.h
+++ b/chrome/browser/extensions/extension_bookmarks_module.h
@@ -12,7 +12,6 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/singleton.h"
#include "chrome/browser/bookmarks/bookmark_model_observer.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/ui/shell_dialogs.h"
@@ -25,16 +24,14 @@ class FilePath;
// the extension system.
class ExtensionBookmarkEventRouter : public BookmarkModelObserver {
public:
- static ExtensionBookmarkEventRouter* GetInstance();
+ explicit ExtensionBookmarkEventRouter(BookmarkModel* model);
virtual ~ExtensionBookmarkEventRouter();
- // Call this for each model to observe. Safe to call multiple times per
- // model.
- void Observe(BookmarkModel* model);
+ void Init();
// BookmarkModelObserver:
virtual void Loaded(BookmarkModel* model) OVERRIDE;
- virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE {}
+ virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE;
virtual void BookmarkNodeMoved(BookmarkModel* model,
const BookmarkNode* old_parent,
int old_index,
@@ -57,18 +54,12 @@ class ExtensionBookmarkEventRouter : public BookmarkModelObserver {
virtual void BookmarkImportEnding(BookmarkModel* model) OVERRIDE;
private:
- ExtensionBookmarkEventRouter();
- friend struct DefaultSingletonTraits<ExtensionBookmarkEventRouter>;
-
// Helper to actually dispatch an event to extension listeners.
void DispatchEvent(Profile* profile,
const char* event_name,
const std::string& json_args);
- // These are stored so that Observe can be called multiple times safely.
- // This way the caller doesn't have to know whether it's already observing
- // a particular model or not. The pointers are not owned by this object.
- std::set<BookmarkModel*> models_;
+ BookmarkModel* model_;
DISALLOW_COPY_AND_ASSIGN(ExtensionBookmarkEventRouter);
};

Powered by Google App Engine
This is Rietveld 408576698