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

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

Issue 6961027: Change event routers from singletons to being owned by the ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asargent and dmazzoni's comments Created 9 years, 7 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 8c3063fae772d61008a05605180d48fb7692e0fb..5d1a717107860482e6a93092af2c063b8e499861 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,11 +24,10 @@ class FilePath;
// the extension system.
class ExtensionBookmarkEventRouter : public BookmarkModelObserver {
public:
- static ExtensionBookmarkEventRouter* GetInstance();
- virtual ~ExtensionBookmarkEventRouter();
+ explicit ExtensionBookmarkEventRouter() {}
+ virtual ~ExtensionBookmarkEventRouter() {}
asargent_no_longer_on_chrome 2011/05/24 18:18:00 nit: probably shouldn't inline the constructor/des
Yoyo Zhou 2011/05/24 19:17:55 Done here and elsewhere.
- // Call this for each model to observe. Safe to call multiple times per
- // model.
+ // Initialize to observe this bookmark model.
void Observe(BookmarkModel* model);
// BookmarkModelObserver:
@@ -57,18 +55,13 @@ 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_;
+ // The model being observed.
+ BookmarkModel* model_;
DISALLOW_COPY_AND_ASSIGN(ExtensionBookmarkEventRouter);
};

Powered by Google App Engine
This is Rietveld 408576698