summaryrefslogtreecommitdiffstats
path: root/app/active_window_watcher_x.h
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 20:19:54 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 20:19:54 +0000
commit82838b02f4b0943196f7e7b4ac7fca78885cbe54 (patch)
treea98be86ffa39b206dd839bb6ebefcc59bafc6c48 /app/active_window_watcher_x.h
parent6affd92124f01ee0eb2b75af96d4ab5576cbccf2 (diff)
downloadchromium_src-82838b02f4b0943196f7e7b4ac7fca78885cbe54.zip
chromium_src-82838b02f4b0943196f7e7b4ac7fca78885cbe54.tar.gz
chromium_src-82838b02f4b0943196f7e7b4ac7fca78885cbe54.tar.bz2
Pulls ActiveWindowWatcher into app so that we can use it in
views. Converts from using notification server to observer as notification service is chrome only. Also changes the pointer type used by window_gtk to be a left arrow. BUG=none TEST=none Review URL: http://codereview.chromium.org/245016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27398 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/active_window_watcher_x.h')
-rw-r--r--app/active_window_watcher_x.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/app/active_window_watcher_x.h b/app/active_window_watcher_x.h
new file mode 100644
index 0000000..2ea524e
--- /dev/null
+++ b/app/active_window_watcher_x.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef APP_ACTIVE_WINDOW_WATCHER_X_H_
+#define APP_ACTIVE_WINDOW_WATCHER_X_H_
+
+#include <gdk/gdk.h>
+
+#include "base/basictypes.h"
+#include "base/observer_list.h"
+#include "base/singleton.h"
+
+// This is a helper class that is used to keep track of which window the X
+// window manager thinks is active. Add an Observer to listener for changes to
+// the active window.
+class ActiveWindowWatcherX {
+ public:
+ class Observer {
+ public:
+ virtual void ActiveWindowChanged(GdkWindow* active_window) = 0;
+ };
+
+ static void AddObserver(Observer* observer);
+ static void RemoveObserver(Observer* observer);
+
+ private:
+ friend struct DefaultSingletonTraits<ActiveWindowWatcherX>;
+
+ ActiveWindowWatcherX();
+
+ void Init();
+
+ // Sends a notification out through the NotificationService that the active
+ // window has changed.
+ void NotifyActiveWindowChanged();
+
+ // Callback for PropertyChange XEvents.
+ static GdkFilterReturn OnWindowXEvent(GdkXEvent* xevent,
+ GdkEvent* event,
+ gpointer window_watcher);
+
+ ObserverList<Observer> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActiveWindowWatcherX);
+};
+
+#endif // APP_ACTIVE_WINDOW_WATCHER_X_H_