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

Side by Side Diff: ui/aura/client/default_activation_client.cc

Issue 101013002: Make sure WindowObservers are removed from window before destruction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix shutdown order Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/client/default_activation_client.h" 5 #include "ui/aura/client/default_activation_client.h"
6 6
7 #include "ui/aura/client/activation_change_observer.h" 7 #include "ui/aura/client/activation_change_observer.h"
8 #include "ui/aura/client/activation_delegate.h" 8 #include "ui/aura/client/activation_delegate.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 //////////////////////////////////////////////////////////////////////////////// 97 ////////////////////////////////////////////////////////////////////////////////
98 // DefaultActivationClient, WindowObserver implementation: 98 // DefaultActivationClient, WindowObserver implementation:
99 99
100 void DefaultActivationClient::OnWindowDestroyed(Window* window) { 100 void DefaultActivationClient::OnWindowDestroyed(Window* window) {
101 if (window == last_active_) 101 if (window == last_active_)
102 last_active_ = NULL; 102 last_active_ = NULL;
103 103
104 if (window == GetActiveWindow()) { 104 if (window == GetActiveWindow()) {
105 window->RemoveObserver(this);
106 active_windows_.pop_back(); 105 active_windows_.pop_back();
107 Window* next_active = GetActiveWindow(); 106 Window* next_active = GetActiveWindow();
108 if (next_active && aura::client::GetActivationChangeObserver(next_active)) { 107 if (next_active && aura::client::GetActivationChangeObserver(next_active)) {
109 aura::client::GetActivationChangeObserver(next_active)->OnWindowActivated( 108 aura::client::GetActivationChangeObserver(next_active)->OnWindowActivated(
110 next_active, NULL); 109 next_active, NULL);
111 } 110 }
112 return; 111 return;
113 } 112 }
114 113
115 RemoveActiveWindow(window); 114 RemoveActiveWindow(window);
116 } 115 }
117 116
118 void DefaultActivationClient::RemoveActiveWindow(Window* window) { 117 void DefaultActivationClient::RemoveActiveWindow(Window* window) {
119 for (unsigned int i = 0; i < active_windows_.size(); ++i) { 118 for (unsigned int i = 0; i < active_windows_.size(); ++i) {
120 if (active_windows_[i] == window) { 119 if (active_windows_[i] == window) {
121 active_windows_.erase(active_windows_.begin() + i); 120 active_windows_.erase(active_windows_.begin() + i);
122 window->RemoveObserver(this); 121 window->RemoveObserver(this);
123 return; 122 return;
124 } 123 }
125 } 124 }
126 } 125 }
127 126
128 } // namespace client 127 } // namespace client
129 } // namespace aura 128 } // namespace aura
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc ('k') | ui/aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698