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

Unified Diff: ui/aura/window.h

Issue 8253001: aura: Some changes in Window and Desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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: ui/aura/window.h
diff --git a/ui/aura/window.h b/ui/aura/window.h
index 9820b29880da8de71d0798c317d6c83aeb9f17d5..56c5315518345cc42292108c2c02f8f07e068158 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/observer_list.h"
#include "base/string16.h"
#include "ui/base/ui_base_types.h"
#include "ui/aura/aura_export.h"
@@ -45,6 +46,14 @@ class RootWindow;
// TODO(beng): resolve ownership.
class AURA_EXPORT Window : public ui::LayerDelegate {
public:
+ // Observers can listen to various events on the Windows.
+ class Observer {
+ public:
+ virtual void OnWindowClosing(Window* widget) {}
sky 2011/10/12 21:11:27 Same comments as for Desktop::Observer.
+ virtual void OnWindowVisibilityChanged(Window* widget, bool visible) {}
+ virtual void OnWindowActivationChanged(Window* widget, bool active) {}
+ };
+
typedef std::vector<Window*> Windows;
explicit Window(WindowDelegate* delegate);
@@ -158,6 +167,11 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
WindowDelegate* delegate() { return delegate_; }
+ // Add/remove observer.
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+ bool HasObserver(Observer* observer);
+
// When set to true, this Window will stop propagation of all events targeted
// at Windows below it in the z-order, but only if this Window has children.
// This is used to implement lock-screen type functionality where we do not
@@ -263,6 +277,8 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
// provided this window has children. See set_stops_event_propagation().
bool stops_event_propagation_;
+ ObserverList<Observer> observers_;
+
DISALLOW_COPY_AND_ASSIGN(Window);
};
« ui/aura/desktop.h ('K') | « ui/aura/desktop_host_linux.cc ('k') | ui/aura/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698