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

Side by Side Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc

Issue 101013002: Make sure WindowObservers are removed from window before destruction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 5 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
6 6
7 #include "apps/shell_window.h" 7 #include "apps/shell_window.h"
8 #include "apps/shell_window_registry.h" 8 #include "apps/shell_window_registry.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/multi_profile_uma.h" 10 #include "ash/multi_profile_uma.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 void MultiUserWindowManagerChromeOS::OnWindowDestroyed(aura::Window* window) { 357 void MultiUserWindowManagerChromeOS::OnWindowDestroyed(aura::Window* window) {
358 if (GetWindowOwner(window).empty()) { 358 if (GetWindowOwner(window).empty()) {
359 // This must be a window in the transient chain - remove it and its 359 // This must be a window in the transient chain - remove it and its
360 // children from the owner. 360 // children from the owner.
361 RemoveTransientOwnerRecursive(window); 361 RemoveTransientOwnerRecursive(window);
362 return; 362 return;
363 } 363 }
364 // Remove the state and the window observer. 364 // Remove the state and the window observer.
365 ash::wm::GetWindowState(window)->RemoveObserver(this); 365 ash::wm::GetWindowState(window)->RemoveObserver(this);
366 window->RemoveObserver(this);
367 // Remove the window from the owners list. 366 // Remove the window from the owners list.
368 delete window_to_entry_[window]; 367 delete window_to_entry_[window];
369 window_to_entry_.erase(window); 368 window_to_entry_.erase(window);
370 } 369 }
371 370
372 void MultiUserWindowManagerChromeOS::OnWindowVisibilityChanging( 371 void MultiUserWindowManagerChromeOS::OnWindowVisibilityChanging(
373 aura::Window* window, bool visible) { 372 aura::Window* window, bool visible) {
374 // This command gets called first and immediately when show or hide gets 373 // This command gets called first and immediately when show or hide gets
375 // called. We remember here the desired state for restoration IF we were 374 // called. We remember here the desired state for restoration IF we were
376 // not ourselves issuing the call. 375 // not ourselves issuing the call.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // To prevent these commands from being recorded as any other commands, we 584 // To prevent these commands from being recorded as any other commands, we
586 // are suppressing any window entry changes while this is going on. 585 // are suppressing any window entry changes while this is going on.
587 // Instead of calling SetWindowVisible, only show gets called here since all 586 // Instead of calling SetWindowVisible, only show gets called here since all
588 // dependents have been shown previously already. 587 // dependents have been shown previously already.
589 base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true); 588 base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true);
590 window->Show(); 589 window->Show();
591 } 590 }
592 } 591 }
593 592
594 } // namespace chrome 593 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698