summaryrefslogtreecommitdiffstats
path: root/ui/aura
diff options
context:
space:
mode:
Diffstat (limited to 'ui/aura')
-rw-r--r--ui/aura/client/default_activation_client.cc1
-rw-r--r--ui/aura/window.cc7
-rw-r--r--ui/aura/window.h2
-rw-r--r--ui/aura/window_observer.h10
4 files changed, 5 insertions, 15 deletions
diff --git a/ui/aura/client/default_activation_client.cc b/ui/aura/client/default_activation_client.cc
index ccb660b..629f12a 100644
--- a/ui/aura/client/default_activation_client.cc
+++ b/ui/aura/client/default_activation_client.cc
@@ -102,6 +102,7 @@ void DefaultActivationClient::OnWindowDestroyed(Window* window) {
last_active_ = NULL;
if (window == GetActiveWindow()) {
+ window->RemoveObserver(this);
active_windows_.pop_back();
Window* next_active = GetActiveWindow();
if (next_active && aura::client::GetActivationChangeObserver(next_active)) {
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 2655b8a..692e345 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -168,12 +168,7 @@ Window::~Window() {
// Delegate and observers need to be notified after transients are deleted.
if (delegate_)
delegate_->OnWindowDestroyed();
- ObserverListBase<WindowObserver>::Iterator iter(observers_);
- WindowObserver* observer;
- while ((observer = iter.GetNext())) {
- RemoveObserver(observer);
- observer->OnWindowDestroyed(this);
- }
+ FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this));
// Clear properties.
for (std::map<const void*, Value>::const_iterator iter = prop_map_.begin();
diff --git a/ui/aura/window.h b/ui/aura/window.h
index c6dcd09..f2a5672 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -588,7 +588,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
gfx::Insets hit_test_bounds_override_outer_touch_;
gfx::Insets hit_test_bounds_override_inner_;
- ObserverList<WindowObserver, true> observers_;
+ ObserverList<WindowObserver> observers_;
// Value struct to keep the name and deallocator for this property.
// Key cannot be used for this purpose because it can be char* or
diff --git a/ui/aura/window_observer.h b/ui/aura/window_observer.h
index 9408ee8..5008ac5 100644
--- a/ui/aura/window_observer.h
+++ b/ui/aura/window_observer.h
@@ -87,14 +87,8 @@ class AURA_EXPORT WindowObserver {
// destructor). This is called before the window is removed from its parent.
virtual void OnWindowDestroying(Window* window) {}
- // Invoked when the Window has been destroyed (i.e. at the end of
- // its destructor). This is called after the window is removed from
- // its parent. Window automatically removes its WindowObservers
- // before calling this method, so the following code is no op.
- //
- // void MyWindowObserver::OnWindowDestroyed(aura::Window* window) {
- // window->RemoveObserver(this);
- // }
+ // Invoked when the Window has been destroyed (i.e. at the end of its
+ // destructor). This is called after the window is removed from its parent.
virtual void OnWindowDestroyed(Window* window) {}
// Called when a Window has been added to a RootWindow.