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

Unified Diff: chrome/browser/extensions/extension_browser_event_router.cc

Issue 6125003: Make ExtensionBrowserEventRouter owned by ExtensionService.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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_browser_event_router.cc
===================================================================
--- chrome/browser/extensions/extension_browser_event_router.cc (revision 71520)
+++ chrome/browser/extensions/extension_browser_event_router.cc (working copy)
@@ -61,10 +61,6 @@
return changed_properties;
}
-ExtensionBrowserEventRouter* ExtensionBrowserEventRouter::GetInstance() {
- return Singleton<ExtensionBrowserEventRouter>::get();
-}
-
static void DispatchEvent(Profile* profile,
const char* event_name,
const std::string& json_args) {
@@ -111,11 +107,9 @@
DispatchEvent(profile, event_name, json_args);
}
-void ExtensionBrowserEventRouter::Init(Profile* profile) {
+void ExtensionBrowserEventRouter::Init() {
if (initialized_)
return;
- DCHECK(!profile->IsOffTheRecord());
- profile_ = profile;
BrowserList::AddObserver(this);
#if defined(TOOLKIT_VIEWS)
views::FocusManager::GetWidgetFocusManager()->AddFocusChangeListener(this);
@@ -148,12 +142,21 @@
initialized_ = true;
}
-ExtensionBrowserEventRouter::ExtensionBrowserEventRouter()
+ExtensionBrowserEventRouter::ExtensionBrowserEventRouter(Profile* profile)
: initialized_(false),
focused_window_id_(extension_misc::kUnknownWindowId),
- profile_(NULL) { }
+ profile_(profile) {
+ DCHECK(!profile->IsOffTheRecord());
+}
-ExtensionBrowserEventRouter::~ExtensionBrowserEventRouter() {}
+ExtensionBrowserEventRouter::~ExtensionBrowserEventRouter() {
+ BrowserList::RemoveObserver(this);
+#if defined(TOOLKIT_VIEWS)
+ views::FocusManager::GetWidgetFocusManager()->RemoveFocusChangeListener(this);
+#elif defined(TOOLKIT_GTK)
+ ActiveWindowWatcherX::RemoveObserver(this);
+#endif
+}
void ExtensionBrowserEventRouter::OnBrowserAdded(const Browser* browser) {
RegisterForBrowserNotifications(browser);
« no previous file with comments | « chrome/browser/extensions/extension_browser_event_router.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698