Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / api / tabs / windows_event_router.cc
index e3d2113..a24d500 100644 (file)
 #include "chrome/common/extensions/extension_constants.h"
 #include "content/public/browser/notification_service.h"
 #include "extensions/browser/event_router.h"
-#include "extensions/browser/extension_system.h"
-
-#if defined(TOOLKIT_GTK)
-#include "ui/base/x/active_window_watcher_x.h"
-#endif
 
 using content::BrowserContext;
 
@@ -36,8 +31,6 @@ WindowsEventRouter::WindowsEventRouter(Profile* profile)
   WindowControllerList::GetInstance()->AddObserver(this);
 #if defined(TOOLKIT_VIEWS)
   views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this);
-#elif defined(TOOLKIT_GTK)
-  ui::ActiveWindowWatcherX::AddObserver(this);
 #elif defined(OS_MACOSX)
   // Needed for when no suitable window can be passed to an extension as the
   // currently focused window.
@@ -50,8 +43,6 @@ WindowsEventRouter::~WindowsEventRouter() {
   WindowControllerList::GetInstance()->RemoveObserver(this);
 #if defined(TOOLKIT_VIEWS)
   views::WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(this);
-#elif defined(TOOLKIT_GTK)
-  ui::ActiveWindowWatcherX::RemoveObserver(this);
 #endif
 }
 
@@ -88,12 +79,6 @@ void WindowsEventRouter::OnNativeFocusChange(
   if (!focused_now)
     OnActiveWindowChanged(NULL);
 }
-#elif defined(TOOLKIT_GTK)
-void WindowsEventRouter::ActiveWindowChanged(
-    GdkWindow* active_window) {
-  if (!active_window)
-    OnActiveWindowChanged(NULL);
-}
 #endif
 
 void WindowsEventRouter::Observe(
@@ -152,7 +137,7 @@ void WindowsEventRouter::OnActiveWindowChanged(
       base::Bind(&WillDispatchWindowFocusedEvent,
                  static_cast<BrowserContext*>(window_profile),
                  window_id);
-  ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent(event.Pass());
+  EventRouter::Get(profile_)->BroadcastEvent(event.Pass());
 }
 
 void WindowsEventRouter::DispatchEvent(const std::string& event_name,
@@ -160,7 +145,7 @@ void WindowsEventRouter::DispatchEvent(const std::string& event_name,
                                       scoped_ptr<base::ListValue> args) {
   scoped_ptr<Event> event(new Event(event_name, args.Pass()));
   event->restrict_to_browser_context = profile;
-  ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass());
+  EventRouter::Get(profile)->BroadcastEvent(event.Pass());
 }
 
 }  // namespace extensions