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

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

Issue 11366074: Coalesce event router Init calls into their constructors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: aa Created 8 years, 1 month 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
« no previous file with comments | « chrome/browser/extensions/window_event_router.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/window_event_router.cc
diff --git a/chrome/browser/extensions/window_event_router.cc b/chrome/browser/extensions/window_event_router.cc
index b90e04a29d6cb0a3d24da117fb57550325655913..efd48d7dcb0560dd15f4145d3279e7a98843a00b 100644
--- a/chrome/browser/extensions/window_event_router.cc
+++ b/chrome/browser/extensions/window_event_router.cc
@@ -24,27 +24,10 @@ namespace event_names = extensions::event_names;
namespace extensions {
WindowEventRouter::WindowEventRouter(Profile* profile)
- : initialized_(false),
- profile_(profile),
+ : profile_(profile),
focused_profile_(NULL),
focused_window_id_(extension_misc::kUnknownWindowId) {
DCHECK(!profile->IsOffTheRecord());
-}
-
-WindowEventRouter::~WindowEventRouter() {
- if (initialized_) {
- WindowControllerList::GetInstance()->RemoveObserver(this);
-#if defined(TOOLKIT_VIEWS)
- views::WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(this);
-#elif defined(TOOLKIT_GTK)
- ui::ActiveWindowWatcherX::RemoveObserver(this);
-#endif
- }
-}
-
-void WindowEventRouter::Init() {
- if (initialized_)
- return;
WindowControllerList::GetInstance()->AddObserver(this);
#if defined(TOOLKIT_VIEWS)
@@ -57,8 +40,15 @@ void WindowEventRouter::Init() {
registrar_.Add(this, chrome::NOTIFICATION_NO_KEY_WINDOW,
content::NotificationService::AllSources());
#endif
+}
- initialized_ = true;
+WindowEventRouter::~WindowEventRouter() {
+ WindowControllerList::GetInstance()->RemoveObserver(this);
+#if defined(TOOLKIT_VIEWS)
+ views::WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(this);
+#elif defined(TOOLKIT_GTK)
+ ui::ActiveWindowWatcherX::RemoveObserver(this);
+#endif
}
void WindowEventRouter::OnWindowControllerAdded(
« no previous file with comments | « chrome/browser/extensions/window_event_router.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698